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?
This commit is contained in:
bors-servo 2019-11-14 20:07:04 -05:00 committed by GitHub
commit 2caa227e10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -223,7 +223,18 @@ class DummyContext(object):
pass 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): 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 from servo.bootstrap import bootstrap
context = DummyContext() context = DummyContext()
@ -265,10 +276,7 @@ def bootstrap(topdir):
print('You are running Python', platform.python_version()) print('You are running Python', platform.python_version())
sys.exit(1) sys.exit(1)
# See if we're inside a Firefox checkout. is_firefox = 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'))
_activate_virtualenv(topdir, is_firefox) _activate_virtualenv(topdir, is_firefox)