jenkins-bot has submitted this change and it was merged.
Change subject: Archive features.py ......................................................................
Archive features.py
Also building an archive system
Bug: T109210 Change-Id: I3143241f64e36762f4065f4eeef6f5460c114090 --- M pwb.py A scripts/archive/README A scripts/archive/__init__.py R scripts/archive/featured.py M tests/script_tests.py M tox.ini 6 files changed, 22 insertions(+), 8 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pwb.py b/pwb.py index 834620b..a630c5f 100755 --- a/pwb.py +++ b/pwb.py @@ -209,6 +209,11 @@ 'scripts', filename) file_package = 'scripts' + if not os.path.exists(testpath): + testpath = os.path.join( + os.path.split(__file__)[0], 'scripts/archive', filename) + file_package = 'scripts.archive' + if os.path.exists(testpath): filename = testpath else: diff --git a/scripts/archive/README b/scripts/archive/README new file mode 100644 index 0000000..92d5958 --- /dev/null +++ b/scripts/archive/README @@ -0,0 +1 @@ +This folder consists scripts that will not maintened but we keep them for historical reasons. diff --git a/scripts/archive/__init__.py b/scripts/archive/__init__.py new file mode 100644 index 0000000..335234f --- /dev/null +++ b/scripts/archive/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +"""THIS DIRECTORY IS TO HOLD BOT SCRIPTS THAT NO LONGER IS MAINTENANCED.""" diff --git a/scripts/featured.py b/scripts/archive/featured.py similarity index 100% rename from scripts/featured.py rename to scripts/archive/featured.py diff --git a/tests/script_tests.py b/tests/script_tests.py index 68d394d..5f9fb85 100644 --- a/tests/script_tests.py +++ b/tests/script_tests.py @@ -23,6 +23,8 @@
scripts_path = join_root_path('scripts')
+archive_path = join_root_path('scripts', 'archive') + if PY2: TK_IMPORT = 'Tkinter' else: @@ -77,13 +79,18 @@ 'script_wui', # depends on lua compiling ]
+ +def list_scripts(path, exclude=None): + """Return list of scripts in given path.""" + scripts = [name[0:-3] for name in os.listdir(path) # strip '.py' + if name.endswith('.py') and + not name.startswith('_') and # skip __init__.py and _* + name != exclude] + return scripts + script_list = (['login'] + - [name[0:-3] for name in os.listdir(scripts_path) # strip '.py' - if name.endswith('.py') and - not name.startswith('_') and # skip __init__.py and _* - name != 'login.py' # this is moved to be first - ] - ) + list_scripts(scripts_path, 'login.py') + + list_scripts(archive_path))
runnable_script_list = (['login'] + sorted(set(script_list) - @@ -115,7 +122,6 @@ 'checkimages', 'clean_sandbox', 'disambredir', - 'featured', 'imagerecat', 'login', 'lonelypages', diff --git a/tox.ini b/tox.ini index df4f55e..5437e66 100644 --- a/tox.ini +++ b/tox.ini @@ -130,7 +130,7 @@ tests/pwb/ : +T001 scripts/casechecker.py,scripts/imagetransfer.py : +T001 scripts/maintenance/make_i18n_dict.py : +T001 - scripts/archivebot.py,scripts/casechecker.py,scripts/commons_link.py,scripts/cfd.py,scripts/featured.py,scripts/imagecopy.py,scripts/imagecopy_self.py,scripts/interwiki.py,scripts/replicate_wiki.py,scripts/solve_disambiguation.py,scripts/maintenance/compat2core.py : +D102, D103 + scripts/archivebot.py,scripts/casechecker.py,scripts/commons_link.py,scripts/cfd.py,scripts/imagecopy.py,scripts/imagecopy_self.py,scripts/interwiki.py,scripts/replicate_wiki.py,scripts/solve_disambiguation.py,scripts/maintenance/compat2core.py,scripts/archive/ : +D102, D103 scripts/checkimages.py,scripts/freebasemappingupload.py,scripts/imagetransfer.py,scripts/lonelypages.py,scripts/movepages.py,scripts/nowcommons.py,scripts/redirect.py,scripts/isbn.py,scripts/reflinks.py,scripts/script_wui.py,scripts/revertbot.py,scripts/weblinkchecker.py,scripts/welcome.py : +D102 scripts/catall.py,scripts/imageharvest.py,scripts/makecat.py,scripts/maintenance/cache.py,scripts/maintenance/wikimedia_sites.py : +D103 scripts/interwiki.py,/""/ : +P102
pywikibot-commits@lists.wikimedia.org