Wikimedia

Detect "Wikimedia Toolforge" environment in pywikibot.version

version.py detects the version being used, using git on Unix. As Toolforge is a major customer, and partially managed by the Pywikibot team, it would be nice if Pywikibot detected that it is being run from the 'shared' environment, so that it can be better maintained and bug reports clearly indicate that the problem exists on Toolforge.

We need to create a new function in pywikibot/version.py that first check the hostname (command hostname -d of similar, in python perhaps using subprocess or a built-in function to see if the script is running in a ToolForge host. Then if yes, we can add a more accurate information, using socket.gethostname(), to print the machine name, something like tools-bastion-02 (2nd string).

Having already some basic understanding of these Python commands on a Linux/Unix system could be helpful.

Pywikibot is a Python-based framework to write bots for MediaWiki (more information). Documentation on Gerrit is available.

Task tags

  • python
  • pywikibot

Students who completed this task

Rafid Aslam

Task type

  • code Code
close

2017