jenkins-bot has submitted this change and it was merged.
Change subject: Partially merge branch 'python3': ......................................................................
Partially merge branch 'python3':
family.py Use key function instead of comparator for sorting interwikis https://gerrit.wikimedia.org/r/#/c/90753/
api.py Change Request from DictMixin to MutableMapping https://gerrit.wikimedia.org/r/#/c/90752/
Change-Id: Ia0039c7989cb31fbcff59b9cc1e5fb07c505c231 --- M .gitreview M pywikibot/comms/http.py M pywikibot/page.py M setup.py 4 files changed, 15 insertions(+), 20 deletions(-)
Approvals: Xqt: Looks good to me, approved Pyfisch: Looks good to me, but someone else must approve jenkins-bot: Verified
diff --git a/.gitreview b/.gitreview index bd3baf7..9c70b97 100644 --- a/.gitreview +++ b/.gitreview @@ -2,5 +2,5 @@ host=gerrit.wikimedia.org port=29418 project=pywikibot/core.git -defaultbranch=python3 +defaultbranch=master defaultrebase=0 diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py index 49e57ac..1dee9ec 100644 --- a/pywikibot/comms/http.py +++ b/pywikibot/comms/http.py @@ -27,10 +27,7 @@ import logging import atexit
-try: - from httplib2 import SSLHandshakeError -except ImportError: - from ssl import SSLError as SSLHandshakeError +from httplib2 import SSLHandshakeError from pywikibot import config from pywikibot.exceptions import FatalServerError, Server504Error import pywikibot diff --git a/pywikibot/page.py b/pywikibot/page.py index 2888f5e..cb06350 100644 --- a/pywikibot/page.py +++ b/pywikibot/page.py @@ -21,10 +21,7 @@ import re import threading import unicodedata -try: - from urllib.parse import quote_from_bytes, unquote_to_bytes -except ImportError: - from urllib import quote as quote_from_bytes, unquote as unquote_to_bytes +import urllib import collections
logger = logging.getLogger("pywiki.wiki.page") @@ -169,7 +166,7 @@ title = title.replace(u' ', u'_') if asUrl: encodedTitle = title.encode(self.site.encoding()) - title = quote_from_bytes(encodedTitle) + title = urllib.quote(encodedTitle) if as_filename: # Replace characters that are not possible in file names on some # systems. @@ -3458,7 +3455,7 @@ for enc in encList: try: t = title.encode(enc) - t = unquote_to_bytes(t) + t = urllib.unquote(t) return unicode(t, enc) except UnicodeError, ex: if not firstException: diff --git a/setup.py b/setup.py index 717771c..b022d2f 100644 --- a/setup.py +++ b/setup.py @@ -18,14 +18,16 @@ from setuptools.command import install
test_deps = [] -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] != 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"
class pwb_install(install.install): @@ -65,6 +67,5 @@ ], cmdclass={ 'install': pwb_install - }, - use_2to3=True + } )