Exemple #1
0
def create_env():
    if env_exists():
        raise Exception('Virtual environment already exists.')

    log('Creating virtual environment...')

    home_dir, lib_dir, inc_dir, bin_dir = venv.path_locations(ENV_PATH)
    python_loc = venv.install_python(
        home_dir,
        lib_dir,
        inc_dir,
        bin_dir,
        site_packages=False,
        clear=False,
        symlink=True
    )

    python_abs_loc = os.path.abspath(python_loc)

    venv.install_activate(home_dir, bin_dir)
    venv.install_wheel(['setuptools', 'pip'], python_abs_loc, None)
    venv.install_distutils(home_dir)

    log('Installing requirements...')
    req_cmd = '{0}/bin/pip install {1}'.format(
        ENV_PATH,
        get_config().requirements
    )
    execute_under_env(req_cmd)

    log('Virtual environment created!')
def create_env():
    if env_exists():
        raise Exception('Virtual environment already exists.')

    log('Creating virtual environment...')

    home_dir, lib_dir, inc_dir, bin_dir = venv.path_locations(ENV_PATH)
    python_loc = venv.install_python(home_dir,
                                     lib_dir,
                                     inc_dir,
                                     bin_dir,
                                     site_packages=False,
                                     clear=False,
                                     symlink=True)

    python_abs_loc = os.path.abspath(python_loc)

    venv.install_activate(home_dir, bin_dir)
    venv.install_wheel(['setuptools', 'pip'], python_abs_loc, None)
    venv.install_distutils(home_dir)

    log('Installing requirements...')
    req_cmd = '{0}/bin/pip install {1}'.format(ENV_PATH,
                                               get_config().requirements)
    execute_under_env(req_cmd)

    log('Virtual environment created!')
Exemple #3
0
    def build(self):
        print('Building Python Virtual Environment: {0}...'.format(self.uuid))
        home_dir, lib_dir, inc_dir, bin_dir = venv.path_locations(
            self._env_path)

        self._python = os.path.abspath(venv.install_python(
            home_dir, lib_dir, inc_dir, bin_dir, site_packages=False,
            clear=False, symlink=True))

        venv.install_wheel(['setuptools', 'pip'], self._python, None)
        venv.install_distutils(home_dir)

        print('Build complete!')
        return self._python
Exemple #4
0
 def _create(self, clear=False, pip_source_dir=None, relocatable=False):
     # Create the actual virtual environment
     _virtualenv.create_environment(
         self.location,
         clear=clear,
         download=False,
         no_pip=True,
         no_wheel=True,
     )
     _virtualenv.install_wheel([pip_source_dir or '.'],
                               self.bin.join("python"))
     if relocatable:
         _virtualenv.make_environment_relocatable(self.location)
     # FIXME: some tests rely on 'easy-install.pth' being already present.
     site_package = distutils.sysconfig.get_python_lib(prefix=self.location)
     Path(site_package).join('easy-install.pth').touch()
Exemple #5
0
 def _create(self, clear=False, pip_source_dir=None, relocatable=False):
     # Create the actual virtual environment
     _virtualenv.create_environment(
         self.location,
         clear=clear,
         download=False,
         no_pip=True,
         no_wheel=True,
     )
     _virtualenv.install_wheel([pip_source_dir or '.'],
                               self.bin.join("python"))
     if relocatable:
         _virtualenv.make_environment_relocatable(self.location)
     # FIXME: some tests rely on 'easy-install.pth' being already present.
     site_package = distutils.sysconfig.get_python_lib(prefix=self.location)
     Path(site_package).join('easy-install.pth').touch()