diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-11-14 20:07:04 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-14 20:07:04 -0500 |
commit | 2caa227e10369c4590cba5b6bceb85d907cd1f8c (patch) | |
tree | 303b8551267da7fa10f4a7d5f7d181c2a04b9772 /python | |
parent | 36c2a131ac9c854001ab5ce046138c867e9bcece (diff) | |
parent | ecc1244e59507560f2a77d0fe3cd0a2e14d2af8d (diff) | |
download | servo-2caa227e10369c4590cba5b6bceb85d907cd1f8c.tar.gz servo-2caa227e10369c4590cba5b6bceb85d907cd1f8c.zip |
Auto merge of #24567 - JoshMcguigan:mach-venv, r=SimonSapin
mach bootstrap - activate virtual env
This modifies the `./mach bootstrap` script to activate the python virtual environment, fixing issues on systems that don't have `six` and `distro` pre-installed.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #24561 (also relevant to #24541)
<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they are in the `./mach bootstrap` script - although this may be something that could be checked in CI - Is there any interest in setting this up?
Diffstat (limited to 'python')
-rw-r--r-- | python/mach_bootstrap.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/python/mach_bootstrap.py b/python/mach_bootstrap.py index ec506c881a6..2c83c6492e7 100644 --- a/python/mach_bootstrap.py +++ b/python/mach_bootstrap.py @@ -223,7 +223,18 @@ class DummyContext(object): pass +def is_firefox_checkout(topdir): + parentdir = os.path.normpath(os.path.join(topdir, '..')) + is_firefox = os.path.isfile(os.path.join(parentdir, + 'build/mach_bootstrap.py')) + return is_firefox + + def bootstrap_command_only(topdir): + # we should activate the venv before importing servo.boostrap + # because the module requires non-standard python packages + _activate_virtualenv(topdir, is_firefox_checkout(topdir)) + from servo.bootstrap import bootstrap context = DummyContext() @@ -265,10 +276,7 @@ def bootstrap(topdir): print('You are running Python', platform.python_version()) sys.exit(1) - # See if we're inside a Firefox checkout. - parentdir = os.path.normpath(os.path.join(topdir, '..')) - is_firefox = os.path.isfile(os.path.join(parentdir, - 'build/mach_bootstrap.py')) + is_firefox = is_firefox_checkout(topdir) _activate_virtualenv(topdir, is_firefox) |