Jump to content

Manual:Pywikibot/Compat/Installation/fr

From mediawiki.org
This page is a translated version of the page Manual:Pywikibot/Compat/Installation and the translation is 25% complete.

version du python

La version python 2.7.2 ou supérieure est recommandé strictement pour les projets Wikimedia qui utilisent le branchement Compat.

Deux versions de pywikibot

Il existe deux branches en développement actif. Vous pouvez choisir parmi :

  • Core (formerly rewrite), which should be your first choice. If you don't know what to choose, take this branch.
  • Compat (formerly trunk) is an older version of the framework that is not actively maintained.

There are limit scenarios where it might still be useful. Compat was able to edit on MediaWiki 1.13 and earlier, even before MediaWiki had an API, and it includes a few scripts that are not available on core yet (see the compatibility list). However, if are going to edit WikiMedia wikis, compat is deprecated.

Télécharger Pywikibot avec Git

Pour "compat" (anciennement "trunk")

git clone --recursive https://gerrit.wikimedia.org/r/pywikibot/compat.git

SVN

Pour compat (anciennement "trunk")

svn co https://github.com/wikimedia/pywikibot-compat/trunk compat cd compat svn co https://github.com/wikimedia/pywikibot-i18n/trunk i18n

Pour mettre à jour le code (branche compat) :

svn up compat/trunk
cd compat
svn up i18n

Dépendances

The pywikibot framework is quite a big and complex code and some scripts needs external python modules (libraries) from other sources also in order to work properly. The dependencies can be installed manually or automatically (not supported by core yet). If any issues arise during installation (of dependencies) please file a bug report or write to the pywikipedia-l mailing list.

Automatique (recommandé)

If available this is the recommended way, because this will result in an identical setup on all machines. All you have to do is just execute your favorite script after installation (for example, python pwb.py clean_sandbox.py -simulate) and pywikibot will ask you whether you want to install missing packages, and continue to ask questions on how you want to configure your local copy. Packages will be installed from OS package management if possible (all Linux, not under win). If they cannot be found they will be downloaded as archive from original source, extracted and installed. In the course of this process a few packages have to be slightly modified in order to work seamlessly with pywikibot. This modification needs an additional binary tool called patch (patch.exe under win). Unfortunately this is not available from MS; however, we can use a port of the original linux code (gnuwin32 patch.exe)

It is worth mentioning here that - despite the OS package management "install mode" - all files are installed locally into the externals/ directory of pywikibot. This is a very useful feature for users that do not have permission to install software to their system, e.g. non-admins.

Manual (for experts)

In order to install the needed packages manually, you first need to know which ones. A full list of all needed modules can be found in externals/__init__.py and contains:

  • framework core code:
    • i18n [git submodule]
    • spelling [git submodule]
    • httplib2 [git submodule]
    • BeautifulSoup.py [included since important]
    • patch.exe
  • depending of which script will be used:
    • opencv, opencv/haarcascades [git submodule]
    • pycolorname [git submodule]
    • irclib
    • mwparserfromhell
    • parse-crontab
    • odfpy
    • openpyxl
    • python-colormath
    • jseg, jseg/jpeg-6b
    • mlpy
    • music21
    • ocropus
    • pydmtx
    • py_w3c
    • zbar
    • (slic)
    • (bob, xbob_flandmark)

Which ones you really need, depends strongly on the script you intend to run - if you are unsure use the automatic mode above. In order to check correct installation just run a bot script. If the dependencies are satisfied everything will be ok, else the framework will complain and ask whether it should install missing packages automatically.

For compat release (formerly trunk)
  1. Right-click on your prefered directory and execute "SVN Checkout..."
  1. Choose "URL of repository" and paste the URL https://github.com/wikimedia/pywikibot-compat/trunk
  1. Choose "Checkout directory and change the default directory which is <your preferred directory>/pywikibot-compat e.g. to <your preferred directory>/svn-compat if you like.
  1. Confirm with [ OK ]
Now we have to install external libraries used by the framework.

There are different ways to do that e.g. again with the checkout command. Another way is using properties in a similar way as in core release.

Installer le code du robot

compat

Effectuer:

git clone --recursive https://gerrit.wikimedia.org/r/pywikibot/compat.git pywikibot-compat

Now, as similarly described in the core section above, you have to setup pywikibot. Choose any one of the following processes to configure your system:

  • Execute python generate_user_files.py
  • Run your favorite bot script (e.g. python pwb.py clean_sandbox.py -simulate) since you are doing this in a fresh clone, it will trigger a bunch of questions on how you want to configure your local copy, answer them carefully in order to proceed.
  • If you already have a config file(s) from a previous version, you can copy those existing files into the right places (e.g. pywikibot-compat/).

See this article for more details on configuring your bot including creating the files manually. You may setup all externals manually if you want - but this is not needed in compat, confer Manual:Pywikipediabot/Installation#Dependencies for further info. You will also have to enter the password for your bot eventually. Now you have finished the configuration of compat and can continue setting up the webspace and jobs to execute.