def test_install_python_bin(): """Should create the right python executables and links""" tmp_virtualenv = tempfile.mkdtemp() try: home_dir, lib_dir, inc_dir, bin_dir = virtualenv.path_locations( tmp_virtualenv) virtualenv.install_python(home_dir, lib_dir, inc_dir, bin_dir, False, False) if virtualenv.IS_WIN: required_executables = ["python.exe", "pythonw.exe"] else: py_exe_no_version = "python" py_exe_version_major = "python%s" % sys.version_info[0] py_exe_version_major_minor = "python{}.{}".format( sys.version_info[0], sys.version_info[1]) required_executables = [ py_exe_no_version, py_exe_version_major, py_exe_version_major_minor ] for pth in required_executables: assert os.path.exists(os.path.join( bin_dir, pth)), "%s should exist in bin_dir" % pth if not virtualenv.IS_JYTHON: assert os.path.exists(inc_dir) root_inc_dir = os.path.join(home_dir, "include") assert not os.path.islink(root_inc_dir) finally: shutil.rmtree(tmp_virtualenv)
def test_install_python_bin(): """Should create the right python executables and links""" tmp_virtualenv = tempfile.mkdtemp() try: home_dir, lib_dir, inc_dir, bin_dir = \ virtualenv.path_locations(tmp_virtualenv) virtualenv.install_python(home_dir, lib_dir, inc_dir, bin_dir, False, False) if virtualenv.is_win: required_executables = ['python.exe', 'pythonw.exe'] else: py_exe_no_version = 'python' py_exe_version_major = 'python%s' % sys.version_info[0] py_exe_version_major_minor = 'python%s.%s' % (sys.version_info[0], sys.version_info[1]) required_executables = [ py_exe_no_version, py_exe_version_major, py_exe_version_major_minor ] for pth in required_executables: assert os.path.exists(os.path.join(bin_dir, pth)), \ ("%s should exist in bin_dir" % pth) finally: shutil.rmtree(tmp_virtualenv)
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!')
def test_install_python_bin(): """Should create the right python executables and links""" tmp_virtualenv = tempfile.mkdtemp() try: home_dir, lib_dir, inc_dir, bin_dir = virtualenv.path_locations(tmp_virtualenv) virtualenv.install_python(home_dir, lib_dir, inc_dir, bin_dir, False, False) if virtualenv.is_win: required_executables = ["python.exe", "pythonw.exe"] else: py_exe_no_version = "python" py_exe_version_major = "python%s" % sys.version_info[0] py_exe_version_major_minor = "python%s.%s" % (sys.version_info[0], sys.version_info[1]) required_executables = [py_exe_no_version, py_exe_version_major, py_exe_version_major_minor] for pth in required_executables: assert os.path.exists(os.path.join(bin_dir, pth)), "%s should " "exist in bin_dir" % pth finally: shutil.rmtree(tmp_virtualenv)
def test_install_python_symlinks(): """Should create the right symlinks in bin_dir""" tmp_virtualenv = tempfile.mkdtemp() try: home_dir, lib_dir, inc_dir, bin_dir = \ virtualenv.path_locations(tmp_virtualenv) virtualenv.install_python(home_dir, lib_dir, inc_dir, bin_dir, False, False) py_exe_no_version = 'python' py_exe_version_major = 'python%s' % sys.version_info[0] py_exe_version_major_minor = 'python%s.%s' % ( sys.version_info[0], sys.version_info[1]) required_executables = [ py_exe_no_version, py_exe_version_major, py_exe_version_major_minor ] for pth in required_executables: assert os.path.exists(os.path.join(bin_dir, pth)), ("%s should " "exist in bin_dir" % pth) finally: shutil.rmtree(tmp_virtualenv)
def test_install_python_bin(): """Should create the right python executables and links""" tmp_virtualenv = tempfile.mkdtemp() try: home_dir, lib_dir, inc_dir, bin_dir = virtualenv.path_locations(tmp_virtualenv) virtualenv.install_python(home_dir, lib_dir, inc_dir, bin_dir, False, False) if virtualenv.IS_WIN: required_executables = ["python.exe", "pythonw.exe"] else: py_exe_no_version = "python" py_exe_version_major = "python%s" % sys.version_info[0] py_exe_version_major_minor = "python{}.{}".format(sys.version_info[0], sys.version_info[1]) required_executables = [py_exe_no_version, py_exe_version_major, py_exe_version_major_minor] for pth in required_executables: assert os.path.exists(os.path.join(bin_dir, pth)), "%s should exist in bin_dir" % pth if not virtualenv.IS_JYTHON: assert os.path.exists(inc_dir) root_inc_dir = os.path.join(home_dir, "include") assert not os.path.islink(root_inc_dir) finally: shutil.rmtree(tmp_virtualenv)
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
def reinstall(self): home_dir, lib_dir, inc_dir, bin_dir = virtualenv.path_locations( self.root_path) virtualenv.install_python(home_dir, lib_dir, inc_dir, bin_dir, False, True) self.install()