jenkins-bot has submitted this change and it was merged.
Change subject: Remove custom lunatic-python patches ......................................................................
Remove custom lunatic-python patches
Replace custom instructions in externals/README and remove custom patch file externals/patch-lua as several github repos include that change are a few are advanced well past that patch.
If a custom lua is required, it should be placed in externals as 'lua' so the pywikibot code finds it automatically without looking for '_lua'.
Change-Id: I096e55da10323b1a77fcc9f822f77ba23610c563 --- M externals/README D externals/patch-lua M scripts/script_wui.py 3 files changed, 15 insertions(+), 162 deletions(-)
Approvals: Legoktm: Looks good to me, approved jenkins-bot: Verified
diff --git a/externals/README b/externals/README index 2e9b788..52cb293 100644 --- a/externals/README +++ b/externals/README @@ -1,33 +1,11 @@ -External dependencies for the rewrite branch. This package is only necessary to -run pywikibot from a fully self-sufficient (no other dependencies other than -python 2.6+) directory. This is especially useful on Windows. +This package is only necessary to run pywikibot from a fully self-sufficient +(no other dependencies other than python 2.6+) directory. +This is especially useful on Windows.
Usually - under normal circumstances - these packages should be installed separately elsewhere in the OS by the standard package managing system.
-If you want to run the rewrite as a stand-alone package, please also download -the contents of the externals/ subdirectory. Furthermore this includes git -repos and zip archives like: +If you want to run the rewrite as a stand-alone package, you may download +dependencies into the externals/ subdirectory, and they will automatically +be used by the pwb.py script.
-* parse-crontab: Parse and use crontab schedules in Python - Version .14 - (from https://github.com/josiahcarlson/parse-crontab) - Checkout the git repository and copy the 'crontab' dir into the path - 'externals/crontab' afterwards. Or download the zip archive and unpack the - 'parse-crontab-master/crontab' dir into the path 'externals/crontab'. - $ wget https://github.com/josiahcarlson/parse-crontab/archive/master.zip - $ unzip master.zip - $ mv parse-crontab-master/crontab crontab - $ rm -rf parse-crontab-master - -* lunatic-python: Two-way bridge between Python and Lua - Version 1.0 - (from https://labix.org/lunatic-python) - Download the zip archive and unpack the 'lunatic-python-1.0' dir into the - path 'externals/_lua' afterwards. - $ wget https://labix.org/download/lunatic-python/lunatic-python-1.0.tar.bz2 - $ tar -xvf lunatic-python-1.0.tar.bz2 - $ mv lunatic-python-1.0 _lua - Patch package dir in order to work with newer lua (>= 5.1) versions - $ patch -p1 -d [path-to-install-dir]/_lua < [path-to-externals]/patch-lua - and you are done. - For the sake of completeness, the command invoked to create the patch was: - $ diff -Naur lunatic-python-1.0 _lua > patch-lua diff --git a/externals/patch-lua b/externals/patch-lua deleted file mode 100644 index 22f1f6b..0000000 --- a/externals/patch-lua +++ /dev/null @@ -1,128 +0,0 @@ -diff -Naur lunatic-python-1.0/__init__.py _lua/__init__.py ---- lunatic-python-1.0/__init__.py 1970-01-01 01:00:00.000000000 +0100 -+++ _lua/__init__.py 2013-10-12 17:32:58.954669463 +0200 -@@ -0,0 +1,39 @@ -+# patches applied for compatibility with lua5.1: -+# https://github.com/bastibe/lunatic-python/issues/1 -+# http://lua-users.org/wiki/LunaticPython -+ -+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)) -+scriptdir = os.path.abspath(os.path.join(os.path.split(__file__)[0], '..', '..', 'scripts')) -+ -+libdir = os.path.join(scriptdir, '../externals/_lua/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 lua 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/_lua') ) -+ -+ # remove/reset if existing already -+ if os.path.exists(os.path.join(libdir, 'lua.so')): -+ os.remove( os.path.join(libdir, 'lua.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("'lua.so' could not be compiled!") -+ -+ os.chdir( cur ) -+ -+ # re-try to import -+ from lua import * -diff -Naur lunatic-python-1.0/python.lua _lua/python.lua ---- lunatic-python-1.0/python.lua 2003-12-13 05:37:57.000000000 +0100 -+++ _lua/python.lua 2013-10-12 17:31:55.467702300 +0200 -@@ -1,6 +1,6 @@ - local path = os.getenv("LUA_SOPATH") - if path then -- func = loadlib(path.."/lua-python.so", "luaopen_python") -+ func = package.loadlib(path.."/lua-python.so", "luaopen_python") - if func then - func() - return -@@ -10,7 +10,7 @@ - local loaded = false - for i = 10, 2, -1 do - for j = 10, 2, -1 do -- func = loadlib(string.format(modmask, i, j), "luaopen_python") -+ func = package.loadlib(string.format(modmask, i, j), "luaopen_python") - if func then - loaded = true - func() -diff -Naur lunatic-python-1.0/setup.py _lua/setup.py ---- lunatic-python-1.0/setup.py 2005-10-19 01:10:07.000000000 +0200 -+++ _lua/setup.py 2013-10-12 17:31:55.481702073 +0200 -@@ -1,7 +1,7 @@ - #!/usr/bin/python - from distutils.core import setup, Extension - from distutils.sysconfig import get_python_lib, get_python_version --import os -+import os, platform - - if os.path.isfile("MANIFEST"): - os.unlink("MANIFEST") -@@ -9,7 +9,13 @@ - # You may have to change these - PYLIBS = ["python"+get_python_version(), "pthread", "util"] - PYLIBDIR = [get_python_lib(standard_lib=True)+"/config"] --LUALIBS = ["lua", "lualib"] -+pltfrm = platform.platform().lower() -+if 'ubuntu' in pltfrm: -+ LUALIBS = ["lua5.1"] -+elif 'fedora' in pltfrm: -+ LUALIBS = ["lua"] -+else: -+ LUALIBS = ["lua5.1"] - LUALIBDIR = [] - - setup(name="lunatic-python", -@@ -31,13 +37,13 @@ - ["src/pythoninlua.c", "src/luainpython.c"], - library_dirs=PYLIBDIR, - libraries=PYLIBS, -- extra_compile_args=["-rdynamic"], -+ extra_compile_args=["-rdynamic", "-I/usr/include/lua5.1"], - extra_link_args=["-rdynamic"]), - Extension("lua", - ["src/pythoninlua.c", "src/luainpython.c"], - library_dirs=LUALIBDIR, - libraries=LUALIBS, -- extra_compile_args=["-rdynamic"], -+ extra_compile_args=["-rdynamic", "-I/usr/include/lua5.1"], - extra_link_args=["-rdynamic"]), - ], - ) -diff -Naur lunatic-python-1.0/src/luainpython.c _lua/src/luainpython.c ---- lunatic-python-1.0/src/luainpython.c 2005-10-19 01:07:02.000000000 +0200 -+++ _lua/src/luainpython.c 2013-10-12 17:31:55.482702057 +0200 -@@ -488,12 +488,12 @@ - - if (!L) { - L = lua_open(); -- luaopen_base(L); -- luaopen_table(L); -- luaopen_io(L); -- luaopen_string(L); -- luaopen_debug(L); -- luaopen_loadlib(L); -+ -+ /* loading each lib separately has some deep conflict -+ * with python's readline module so we obey the holy -+ * docs by lua people and use the magic loader. -+ */ -+ luaL_openlibs(L); - luaopen_python(L); - lua_settop(L, 0); - } diff --git a/scripts/script_wui.py b/scripts/script_wui.py index 3bbe3fd..ab2a595 100755 --- a/scripts/script_wui.py +++ b/scripts/script_wui.py @@ -71,15 +71,18 @@ import resource import re
-# https://labix.org/lunatic-python -try: - import lua # installed packages (on f15: 'lua', 'lunatic-python') -except ImportError: - import _lua as lua # compiled in externals with patch (ubuntu on TS/labs) -# https://github.com/josiahcarlson/parse-crontab +# https://labix.org/lunatic-python is bit-rotting, and there are maintained +# versions on github: +# https://github.com/bastibe/lunatic-python.git +# https://github.com/AlereDevices/lunatic-python.git +import lua +# The crontab package is https://github.com/josiahcarlson/parse-crontab +# version 0.20 installs a package called 'tests' which conflicts with our +# test suite. Use https://github.com/jayvdb/parse-crontab until it is fixed. import crontab
import pywikibot +# pywikibot.botirc depends on https://pypi.python.org/pypi/irc import pywikibot.botirc
pywikibot-commits@lists.wikimedia.org