jenkins-bot has submitted this change and it was merged.
Change subject: Check httplib2.__version__ exists ......................................................................
Check httplib2.__version__ exists
Python 3.4+ will load externals/httplib2 when there is no system package of that name, even if the directory is empty because the user has not cloned the git sub-modules.
Bug: 72249 Change-Id: Ica1fb38d40f8c5e6e9d458b4c0ea2008df4b65c5 --- M pwb.py 1 file changed, 13 insertions(+), 2 deletions(-)
Approvals: XZise: Looks good to me, approved jenkins-bot: Verified
diff --git a/pwb.py b/pwb.py index 66b3aa0..befa539 100644 --- a/pwb.py +++ b/pwb.py @@ -101,11 +101,21 @@ # try importing the known externals, and raise an error if they are not found try: import httplib2 + if not hasattr(httplib2, '__version__'): + print("httplib2 import problem: httplib2.__version__ does not exist.") + if sys.version_info > (3, 3): + print("Python 3.4+ has probably loaded externals/httplib2 " + "although it doesnt have an __init__.py.") + httplib2 = None except ImportError as e: print("ImportError: %s" % e) + httplib2 = None + +if not httplib2: print("Python module httplib2 >= 0.6.0 is required.") print("Did you clone without --recursive?\n" - "Try running 'git submodule update --init'.") + "Try running 'git submodule update --init' " + "or 'pip install httplib2'.") sys.exit(1)
# httplib2 0.6.0 was released with __version__ as '$Rev$' @@ -117,7 +127,8 @@ print("Python module httplib2 (%s) needs to be 0.6.0 or greater." % httplib2.__file__) print("Did you clone without --recursive?\n" - "Try running 'git submodule update --init'.") + "Try running 'git submodule update --init' " + "or 'pip install --upgrade httplib2'.") sys.exit(1)
del httplib2
pywikibot-commits@lists.wikimedia.org