mozext: use bootstrap.py (bug 1244786); r?dminor draft
authorGregory Szorc <gps@mozilla.com>
Mon, 01 Feb 2016 12:17:30 -0800
changeset 7028 e37e52baff9663edbd079f49e4bca43e8e086a85
parent 7022 79284f382e6bb2a2558a22338a1b23f02e158475
push id582
push usergszorc@mozilla.com
push dateMon, 01 Feb 2016 20:17:48 +0000
reviewersdminor
bugs1244786
mozext: use bootstrap.py (bug 1244786); r?dminor bootstrap.py exists to configure sys.path with every vendored Python package path. mozext wasn't using this script - instead it was manually configuring sys.path. A recent change to mozautomation introduced requests as a dependency. Since mozext wasn't inserting pylib/requests into sys.path, this could result in an import failure due to requests not being found. Using bootstrap.py adds pylib/requests and makes the ImportError go away.
hgext/mozext/__init__.py
--- a/hgext/mozext/__init__.py
+++ b/hgext/mozext/__init__.py
@@ -306,21 +306,18 @@ from mercurial import (
     encoding,
     error,
     extensions,
     hg,
     scmutil,
     util,
 )
 
-OUR_DIR = os.path.dirname(__file__)
-REPO_ROOT = os.path.normpath(os.path.join(OUR_DIR, '..', '..'))
-PYLIB = os.path.join(REPO_ROOT, 'pylib')
-for p in ('flake8', 'mccabe', 'mozautomation', 'pep8', 'pyflakes'):
-    sys.path.insert(0, os.path.join(PYLIB, p))
+OUR_DIR = os.path.normpath(os.path.dirname(__file__))
+execfile(os.path.join(OUR_DIR, '..', 'bootstrap.py'))
 
 
 # Disable demand importing for mozautomation because "requests" doesn't
 # play nice with the demand importer.
 demandenabled = demandimport.isenabled()
 try:
     demandimport.disable()