mach bootstrap factor out common is_firefox check

This commit is contained in:
Josh Mcguigan 2019-10-28 05:12:20 -07:00
parent 01978ccf32
commit ecc1244e59

View file

@ -223,14 +223,17 @@ class DummyContext(object):
pass
def bootstrap_command_only(topdir):
# See if we're inside a Firefox checkout.
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)
_activate_virtualenv(topdir, is_firefox_checkout(topdir))
from servo.bootstrap import bootstrap
@ -273,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)