http://www.mediawiki.org/wiki/Special:Code/pywikipedia/11527
Revision: 11527 Author: drtrigon Date: 2013-05-12 20:54:27 +0000 (Sun, 12 May 2013) Log Message: ----------- improvement; most of the necessary externals merged/moved
Modified Paths: -------------- trunk/pywikipedia/catimages.py trunk/pywikipedia/externals/__init__.py
Added Paths: ----------- trunk/pywikipedia/externals/patch-jseg trunk/pywikipedia/externals/patch-music21 trunk/pywikipedia/externals/patch-pydmtx trunk/pywikipedia/externals/patch-zbar
Property Changed: ---------------- trunk/pywikipedia/externals/
Modified: trunk/pywikipedia/catimages.py =================================================================== --- trunk/pywikipedia/catimages.py 2013-05-12 18:51:23 UTC (rev 11526) +++ trunk/pywikipedia/catimages.py 2013-05-12 20:54:27 UTC (rev 11527) @@ -91,8 +91,18 @@ import wikipedia as pywikibot import pagegenerators, catlib import checkimages -import dtbext as externals # check for and install needed 'externals' -externals.check_setup_all() # +import dtbext # check for and install needed 'externals' +dtbext.check_setup_all() # +import externals # check for and install needed 'externals' +externals.check_setup('colormath') # +externals.check_setup('jseg') # +externals.check_setup('jseg/jpeg-6b')# +#externals.check_setup('_mlpy') # +externals.check_setup('_music21') # +#externals.check_setup('opencv/haarcascades')# +externals.check_setup('pydmtx') # +externals.check_setup('py_w3c') # +externals.check_setup('_zbar') #
# DrTrigonBot framework packages target = os.path.join(scriptdir, 'dtbext') @@ -1507,10 +1517,7 @@ return
# DataMatrix - try: - from pydmtx import DataMatrix # linux distro package (fedora) - except: - from _pydmtx import DataMatrix # TS (debian) + from pydmtx import DataMatrix # linux distro package (fedora) / TS (debian)
## Write a Data Matrix barcode #dm_write = DataMatrix()
Property changes on: trunk/pywikipedia/externals ___________________________________________________________________ Added: svn:externals + pycolorname https://svn.toolserver.org/svnroot/drtrigon/externals/pycolorname
Modified: trunk/pywikipedia/externals/__init__.py =================================================================== --- trunk/pywikipedia/externals/__init__.py 2013-05-12 18:51:23 UTC (rev 11526) +++ trunk/pywikipedia/externals/__init__.py 2013-05-12 20:54:27 UTC (rev 11527) @@ -98,11 +98,11 @@ 'path': 'haarcascades',}), # OK # 'pdfminer' is not used anymore/at the moment... # 'pycolorname': $ svn propset svn:externals 'pycolorname https://svn.toolserver.org/svnroot/drtrigon/externals/pycolorname' . - '_pydmtx': ({'linux-fedora': ['python-libdmtx'], + 'pydmtx': ({'linux-fedora': ['python-libdmtx'], 'linux-ubuntu': ['libdmtx-dev'],}, { 'url': 'https://github.com/dmtx/dmtx-wrappers/archive/master.zip', 'path': 'dmtx-wrappers-master/python', - #$ diff -Naur TEST__pydmtx/ _pydmtx/ > patch-pydmtx + #$ diff -Nau --exclude="*.pyc" TEST_pydmtx/ pydmtx/ > patch-pydmtx 'patch': 'patch-pydmtx',}), # OK 'py_w3c': ({}, { 'url': 'https://bitbucket.org/nmb10/py_w3c/downloads/py_w3c-v0.1.0.tar.gz', @@ -134,11 +134,11 @@
#modules_order = ['crontab', 'odf', 'openpyxl', # 'colormath', 'jseg', 'jseg/jpeg-6b', '_mlpy', '_music21', -# '_ocropus', 'opencv', 'opencv/haarcascades', '_pydmtx', +# '_ocropus', 'opencv', 'opencv/haarcascades', 'pydmtx', # 'py_w3c', 'slic', '_zbar', '_bob', 'xbob_flandmark',] modules_order = [#'crontab', 'odf', 'openpyxl', 'colormath', 'jseg', 'jseg/jpeg-6b', '_music21', - 'opencv/haarcascades', '_pydmtx', 'py_w3c', '_zbar',] + 'opencv/haarcascades', 'pydmtx', 'py_w3c', '_zbar',]
import os, sys
Added: trunk/pywikipedia/externals/patch-jseg =================================================================== (Binary files differ)
Property changes on: trunk/pywikipedia/externals/patch-jseg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream
Added: trunk/pywikipedia/externals/patch-music21 =================================================================== --- trunk/pywikipedia/externals/patch-music21 (rev 0) +++ trunk/pywikipedia/externals/patch-music21 2013-05-12 20:54:27 UTC (rev 11527) @@ -0,0 +1,15 @@ +diff -Naur '--exclude=*.pyc' TEST__music21/__init__.py _music21/__init__.py +--- TEST__music21/__init__.py 1970-01-01 01:00:00.000000000 +0100 ++++ _music21/__init__.py 2013-05-06 17:50:47.519400978 +0200 +@@ -0,0 +1,11 @@ ++import sys, os ++ ++scriptdir = os.path.dirname(sys.argv[0]) ++if not os.path.isabs(scriptdir): ++ scriptdir = os.path.abspath(os.path.join(os.curdir, scriptdir)) ++ ++libdir = os.path.join(scriptdir, 'externals/_music21') ++sys.path.append(os.path.join(libdir)) ++ ++from music21 import * ++
Added: trunk/pywikipedia/externals/patch-pydmtx =================================================================== --- trunk/pywikipedia/externals/patch-pydmtx (rev 0) +++ trunk/pywikipedia/externals/patch-pydmtx 2013-05-12 20:54:27 UTC (rev 11527) @@ -0,0 +1,48 @@ +Gemeinsame Unterverzeichnisse: TEST_pydmtx/build und pydmtx/build. +diff -Nau '--exclude=*.pyc' TEST_pydmtx/__init__.py pydmtx/__init__.py +--- TEST_pydmtx/__init__.py 1970-01-01 01:00:00.000000000 +0100 ++++ pydmtx/__init__.py 2013-05-12 22:10:39.526184591 +0200 +@@ -0,0 +1,43 @@ ++import sys, os ++ ++scriptdir = os.path.dirname(sys.argv[0]) ++if not os.path.isabs(scriptdir): ++ scriptdir = os.path.abspath(os.path.join(os.curdir, scriptdir)) ++ ++libdir = os.path.join(scriptdir, 'externals/pydmtx/build/lib.linux-x86_64-%s.%s' % sys.version_info[:2]) ++if not os.path.exists(libdir): ++ os.makedirs(libdir) ++# path has to exist BEFORE appending, otherwise the re-import fails ++sys.path.append(libdir) ++ ++try: ++ # try to import ++ from pydmtx import DataMatrix ++except ImportError, e: ++ print "(re-)compilation triggered because of: '%s'" % e ++ ++ cur = os.path.abspath(os.curdir) ++ os.chdir( os.path.join(scriptdir, 'externals/pydmtx') ) ++ ++ # remove/reset if existing already ++ if os.path.exists(os.path.join(libdir, '_pydmtx.so')): ++ os.remove( os.path.join(libdir, '_pydmtx.so') ) ++ ++ # compile python module (may be use 'distutil' instead of 'make' here) ++ if os.system("python setup.py build"): ++ #if os.system("make"): ++ raise ImportError("'_pydmtx.so' could not be compiled!") ++ ++ os.chdir( cur ) ++ ++ # re-try to import ++ from pydmtx import DataMatrix ++ ++## skip processing of DataMatrix with this dummy ++#class DataMatrix(object): ++# def __init__(self, *arg, **kwd): ++# return None ++# def decode(self, *arg, **kwd): ++# return None ++# def count(self, *arg, **kwd): ++# return 0
Added: trunk/pywikipedia/externals/patch-zbar =================================================================== --- trunk/pywikipedia/externals/patch-zbar (rev 0) +++ trunk/pywikipedia/externals/patch-zbar 2013-05-12 20:54:27 UTC (rev 11527) @@ -0,0 +1,41 @@ +Gemeinsame Unterverzeichnisse: TEST__zbar/build und _zbar/build. +Gemeinsame Unterverzeichnisse: TEST__zbar/examples und _zbar/examples. +diff -Nau '--exclude=*.pyc' TEST__zbar/__init__.py _zbar/__init__.py +--- TEST__zbar/__init__.py 1970-01-01 01:00:00.000000000 +0100 ++++ _zbar/__init__.py 2013-05-12 13:58:08.098509211 +0200 +@@ -0,0 +1,34 @@ ++import sys, os ++ ++scriptdir = os.path.dirname(sys.argv[0]) ++if not os.path.isabs(scriptdir): ++ scriptdir = os.path.abspath(os.path.join(os.curdir, scriptdir)) ++ ++libdir = os.path.join(scriptdir, 'externals/_zbar/build/lib.linux-x86_64-%s.%s' % sys.version_info[:2]) ++if not os.path.exists(libdir): ++ os.makedirs(libdir) ++# path has to exist BEFORE appending, otherwise the re-import fails ++sys.path.append(libdir) ++ ++try: ++ # try to import ++ from zbar import * ++except ImportError, e: ++ print "(re-)compilation triggered because of: '%s'" % e ++ ++ cur = os.path.abspath(os.curdir) ++ os.chdir( os.path.join(scriptdir, 'externals/_zbar') ) ++ ++ # remove/reset if existing already ++ if os.path.exists(os.path.join(libdir, 'zbar.so')): ++ os.remove( os.path.join(libdir, 'zbar.so') ) ++ ++ # compile python module (may be use 'distutil' instead of 'make' here) ++ if os.system("python setup.py build"): ++ #if os.system("make"): ++ raise ImportError("'zbar.so' could not be compiled!") ++ ++ os.chdir( cur ) ++ ++ # re-try to import ++ from zbar import * +Gemeinsame Unterverzeichnisse: TEST__zbar/test und _zbar/test.