Bug 1356101 - Derive the mach_bootstrap search path from build/virtualenv_packages.txt. r=gps

Most entries in virtualenv_packages.txt that are .pth or packages.txt
are currently in SEARCH_PATHS in mach_bootstrap. The ones that are
missing would make sense in SEARCH_PATHS. None of non-.pth or
packages.txt entries, however, are in SEARCH_PATHS and don't make sense
there.

On the other hand, virtualenv_packages.txt misses a lot of things that
are in SEARCH_PATHS, all of which should be there. One exception:
xpcom/idl-parser, which causes problems due to the xpidl package
containing an xpidl module, which causes problems with the in-tree
scripts using it. Plus, it needs a cache directory, which is messy, so
it's preferable to keep it away from the virtualenv. It turns out it was
added to mach_bootstrap.py in bug 893976 for a command that was since
then removed (bug 1244736), so we can get away with removing it.

So instead of keeping those two separate lists out of sync, we replace
the SEARCH_PATHS list from mach_bootstrap with one that is derived at
runtime from the contents of virtualenv_packages.txt.

And since a .pth can't fail to install in the virtualenv, it makes no
sense to have psutil.pth defined as optional, which allows it to end up
in the mach_bootstrap search path automatically.

Finally, because we do have overlapping module names in the tree (e.g.
runtests), and mach_bootstrap's SEARCH_PATHS had a guaranteed order,
we change the order of the virtualenv_packages.txt file to match what
used to be in mach_bootstrap, and make all the pth entries use the same
file name so that the order is more guaranteed in the virtualenv too.

--HG--
extra : rebase_source : 5bd09f2f984d6f78a76b38e768d8a67806af5954
This commit is contained in:
Mike Hommey 2017-04-14 08:19:08 +09:00
Родитель d9e412fe4d
Коммит 1170646315
2 изменённых файлов: 67 добавлений и 105 удалений

Просмотреть файл

@ -32,74 +32,6 @@ Press ENTER/RETURN to continue or CTRL+c to abort.
'''.lstrip()
# TODO Bug 794506 Integrate with the in-tree virtualenv configuration.
SEARCH_PATHS = [
'python/mach',
'python/mozboot',
'python/mozbuild',
'python/mozlint',
'python/mozversioncontrol',
'python/blessings',
'python/compare-locales',
'python/configobj',
'python/dlmanager',
'python/futures',
'python/jsmin',
'python/psutil',
'python/pylru',
'python/which',
'python/pystache',
'python/pyyaml/lib',
'python/requests',
'python/slugid',
'python/py',
'python/pytest',
'python/pytoml',
'python/redo',
'python/voluptuous',
'build',
'build/pymake',
'config',
'dom/bindings',
'dom/bindings/parser',
'dom/media/test/external',
'layout/tools/reftest',
'other-licenses/ply',
'taskcluster',
'testing',
'testing/firefox-ui/harness',
'testing/marionette/client',
'testing/marionette/harness',
'testing/marionette/harness/marionette_harness/runner/mixins/browsermob-proxy-py',
'testing/marionette/puppeteer/firefox',
'testing/mozbase/mozcrash',
'testing/mozbase/mozdebug',
'testing/mozbase/mozdevice',
'testing/mozbase/mozfile',
'testing/mozbase/mozhttpd',
'testing/mozbase/mozinfo',
'testing/mozbase/mozinstall',
'testing/mozbase/mozleak',
'testing/mozbase/mozlog',
'testing/mozbase/moznetwork',
'testing/mozbase/mozprocess',
'testing/mozbase/mozprofile',
'testing/mozbase/mozrunner',
'testing/mozbase/mozsystemmonitor',
'testing/mozbase/mozscreenshot',
'testing/mozbase/moztest',
'testing/mozbase/mozversion',
'testing/mozbase/manifestparser',
'testing/taskcluster',
'testing/tools/autotry',
'testing/web-platform',
'testing/web-platform/harness',
'testing/web-platform/tests/tools/wptserve',
'testing/web-platform/tests/tools/six',
'testing/xpcshell',
'xpcom/idl-parser',
]
# Individual files providing mach commands.
MACH_MODULES = [
'addon-sdk/mach_commands.py',
@ -184,6 +116,21 @@ CATEGORIES = {
TELEMETRY_SUBMISSION_FREQUENCY = 10
def search_path(mozilla_dir, packages_txt):
with open(os.path.join(mozilla_dir, packages_txt)) as f:
packages = [line.rstrip().split(':') for line in f]
for package in packages:
if package[0] == 'packages.txt':
assert len(package) == 2
for p in search_path(mozilla_dir, package[1]):
yield os.path.join(mozilla_dir, p)
if package[0].endswith('.pth'):
assert len(package) == 2
yield os.path.join(mozilla_dir, package[1])
def bootstrap(topsrcdir, mozilla_dir=None):
if mozilla_dir is None:
mozilla_dir = topsrcdir
@ -204,7 +151,9 @@ def bootstrap(topsrcdir, mozilla_dir=None):
# case. For default behavior, we educate users and give them an opportunity
# to react. We always exit after creating the directory because users don't
# like surprises.
sys.path[0:0] = [os.path.join(mozilla_dir, path) for path in SEARCH_PATHS]
sys.path[0:0] = [os.path.join(mozilla_dir, path)
for path in search_path(mozilla_dir,
'build/virtualenv_packages.txt')]
import mach.main
from mozboot.util import get_state_dir

Просмотреть файл

@ -1,43 +1,56 @@
marionette_driver.pth:testing/marionette/client
marionette_harness.pth:testing/marionette/harness
browsermobproxy.pth:testing/marionette/harness/marionette_harness/runner/mixins/browsermob-proxy-py
six.pth:testing/web-platform/tests/tools/six
wptserve.pth:testing/web-platform/tests/tools/wptserve
blessings.pth:python/blessings
configobj.pth:python/configobj
jsmin.pth:python/jsmin
mach.pth:python/mach
mozbuild.pth:python/mozbuild
mozversioncontrol.pth:python/mozversioncontrol
mozlint.pth:python/mozlint
pymake.pth:build/pymake
mozilla.pth:python/mach
mozilla.pth:python/mozboot
mozilla.pth:python/mozbuild
mozilla.pth:python/mozlint
mozilla.pth:python/mozversioncontrol
mozilla.pth:python/blessings
mozilla.pth:python/compare-locales
mozilla.pth:python/configobj
mozilla.pth:python/dlmanager
mozilla.pth:python/futures
mozilla.pth:python/jsmin
optional:setup.py:python/psutil:build_ext:--inplace
optional:psutil.pth:python/psutil
which.pth:python/which
ply.pth:other-licenses/ply/
mock.pth:python/mock-1.0.0
py.pth:python/py
pytest.pth:python/pytest
mozilla.pth:python/psutil
mozilla.pth:python/pylru
mozilla.pth:python/which
mozilla.pth:python/pystache
mozilla.pth:python/pyyaml/lib
mozilla.pth:python/requests
mozilla.pth:python/slugid
mozilla.pth:python/py
mozilla.pth:python/pytest
mozilla.pth:python/pytoml
mozilla.pth:python/redo
mozilla.pth:python/voluptuous
mozilla.pth:build
objdir:build
mozilla.pth:build/pymake
mozilla.pth:config
mozilla.pth:xpcom/typelib/xpt/tools
mozilla.pth:dom/bindings
mozilla.pth:dom/bindings/parser
mozilla.pth:dom/media/test/external
mozilla.pth:layout/tools/reftest
moztreedocs.pth:tools/docs
mozilla.pth:other-licenses/ply/
mozilla.pth:taskcluster
mozilla.pth:testing
mozilla.pth:testing/firefox-ui/harness
mozilla.pth:testing/marionette/client
mozilla.pth:testing/marionette/harness
mozilla.pth:testing/marionette/harness/marionette_harness/runner/mixins/browsermob-proxy-py
mozilla.pth:testing/marionette/puppeteer/firefox
packages.txt:testing/mozbase/packages.txt
objdir:build
gyp.pth:media/webrtc/trunk/tools/gyp/pylib
pyasn1.pth:python/pyasn1
pyasn1_modules.pth:python/pyasn1-modules
redo.pth:python/redo
requests.pth:python/requests
rsa.pth:python/rsa
futures.pth:python/futures
ecc.pth:python/PyECC
xpcshell.pth:testing/xpcshell
pyyaml.pth:python/pyyaml/lib
pytoml.pth:python/pytoml
pylru.pth:python/pylru
taskcluster.pth:taskcluster
dlmanager.pth:python/dlmanager
mozilla.pth:testing/taskcluster
mozilla.pth:testing/tools/autotry
mozilla.pth:testing/web-platform
mozilla.pth:testing/web-platform/harness
mozilla.pth:testing/web-platform/tests/tools/wptserve
mozilla.pth:testing/web-platform/tests/tools/six
mozilla.pth:testing/xpcshell
mozilla.pth:python/mock-1.0.0
mozilla.pth:xpcom/typelib/xpt/tools
mozilla.pth:tools/docs
mozilla.pth:media/webrtc/trunk/tools/gyp/pylib
mozilla.pth:python/pyasn1
mozilla.pth:python/pyasn1-modules
mozilla.pth:python/rsa
mozilla.pth:python/PyECC