Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mach Bootstrap: Support for more platforms #13226

Closed
wants to merge 7 commits into from

Install missing pip/virtualenv before creating virtual environment

  • Loading branch information
UK992 committed Sep 11, 2016
commit 3eec74429627b3235f552fece9cebba6ae3b3a29
@@ -106,6 +106,16 @@ def _activate_virtualenv(topdir):
script_dir = _get_virtualenv_script_dir()
activate_path = os.path.join(virtualenv_path, script_dir, "activate_this.py")
if not (os.path.exists(virtualenv_path) and os.path.exists(activate_path)):
# Install missing pip and/or virtualenv packages before creating virtual environment
if not _get_exec_path(PIP_NAMES) or not _get_exec_path(VIRTUALENV_NAMES):
try:
from servo.bootstrapper.bootstrap import Bootstrapper

bootstrapper = Bootstrapper()
bootstrapper.virtualenv()
except:
pass

virtualenv = _get_exec_path(VIRTUALENV_NAMES)
if not virtualenv:
sys.exit("Python virtualenv is not installed. Please install it prior to running mach.")
@@ -79,3 +79,6 @@ def _update_package_manager(self):
This should be defined in child classes.
"""

def install_virtualenv(self):
"""Install virtualenv and pip packages"""
@@ -75,3 +75,8 @@ def bootstrap(self, android=False, interactive=False, force=False):
self.instance.install_mobile_android_packages()

print

def virtualenv(self):
self.instance.install_virtualenv()

print
@@ -32,6 +32,9 @@ def install_system_packages(self, packages=desktop_deps):
def install_mobile_android_packages(self):
raise NotImplementedError('Bootstrap support for Android not yet available.')

def install_virtualenv(self):
self.dnf_install(*["python-pip", "python-virtualenv"])

def dnf_install(self, *packages):
if self.which('dnf'):
command = ['dnf', 'reinstall' if self.force else 'install']
@@ -43,6 +43,9 @@ def install_system_packages(self, packages=desktop_deps):
def install_mobile_android_packages(self):
raise NotImplementedError('Bootstrap support for Android not yet available.')

def install_virtualenv(self):
self.apt_install(*["python-pip", self.virtualenv])

def _update_package_manager(self):
self.apt_update()

@@ -8,12 +8,13 @@
from distutils import spawn

from base import BaseBootstrapper
from packages import WINDOWS_MSVC as deps


class WindowsMsvcBootstrapper(BaseBootstrapper):
'''Bootstrapper for MSVC building on Windows.'''

from packages import WINDOWS_MSVC as deps

def __init__(self, **kwargs):
BaseBootstrapper.__init__(self, **kwargs)

@@ -84,3 +85,6 @@ def install_system_packages(self, packages=deps):

def install_mobile_android_packages(self):
sys.exit('We do not support building Android on Windows. Sorry!')

def install_virtualenv(self):
self.run(['pip', 'install', 'virtualenv'])
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.