jenkins-bot has submitted this change and it was merged.
Change subject: Add --python3ok option to setup.py
......................................................................
Add --python3ok option to setup.py
This allows us to run tests on Python 3.3+, while keeping
the error message we only support Python 2.
Change-Id: I7473a595a5acd464a74343f2d675f285033ec5b1
---
M setup.py
1 file changed, 19 insertions(+), 10 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/setup.py b/setup.py
index c61b298..1b21060 100644
--- a/setup.py
+++ b/setup.py
@@ -19,16 +19,24 @@
from setuptools.command import install
test_deps = []
+testcollector = "tests"
-if sys.version_info[0] != 2:
- raise RuntimeError("ERROR: Pywikipediabot only runs under Python 2")
-elif sys.version_info[1] < 6:
- raise RuntimeError("ERROR: Pywikipediabot only runs under Python 2.6 or
higher")
-elif sys.version_info[1] == 6:
- test_deps = ['unittest2']
- testcollector = "tests.utils.collector"
-else:
- testcollector = "tests"
+if sys.version_info[0] == 2:
+ if sys.version_info[1] < 6:
+ raise RuntimeError("ERROR: Pywikipediabot only runs under Python 2.6 or
higher")
+ elif sys.version_info[1] == 6:
+ test_deps = ['unittest2']
+ testcollector = "tests.utils.collector"
+
+if sys.version_info[0] == 3:
+ if "--python3ok" not in sys.argv:
+ # use setup.py test --python3ok to run tests
+ print("ERROR: Pywikipediabot only runs under Python 2")
+ sys.exit(1)
+ sys.argv.remove('--python3ok')
+ if sys.version_info[1] < 3:
+ print("ERROR: Python 3.3 or higher is required!")
+ sys.exit(1)
class pwb_install(install.install):
@@ -68,5 +76,6 @@
],
cmdclass={
'install': pwb_install
- }
+ },
+ use_2to3=False
)
--
To view, visit
https://gerrit.wikimedia.org/r/98272
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7473a595a5acd464a74343f2d675f285033ec5b1
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Xqt <info(a)gno.de>
Gerrit-Reviewer: jenkins-bot