--- a/virtualenv/web/virtualenv.py Tue Jan 21 22:11:51 2020 +0100
+++ b/virtualenv/web/virtualenv.py Sat Jan 25 02:22:57 2020 +0100
@@ -1,253 +1,244 @@
#!/usr/bin/env python
-"""Create a "virtual" Python installation
-"""
+"""Create a "virtual" Python installation"""
+
+# fmt: off
+import os # isort:skip
+import sys # isort:skip
+
+# If we are running in a new interpreter to create a virtualenv,
+# we do NOT want paths from our existing location interfering with anything,
+# So we remove this file's directory from sys.path - most likely to be
+# the previous interpreter's site-packages. Solves #705, #763, #779
+
-# If you change the version here, change it in setup.py
-# and docs/conf.py as well.
-virtualenv_version = "1.7.1.2"
+if os.environ.get("VIRTUALENV_INTERPRETER_RUNNING"):
+ for path in sys.path[:]:
+ if os.path.realpath(os.path.dirname(__file__)) == os.path.realpath(path):
+ sys.path.remove(path)
+# fmt: on
+import ast
import base64
-import sys
+import codecs
+import contextlib
+import distutils.spawn
+import distutils.sysconfig
+import errno
+import glob
+import logging
+import optparse
import os
-import optparse
import re
import shutil
-import logging
+import struct
+import subprocess
+import sys
import tempfile
+import textwrap
+import zipfile
import zlib
-import errno
-import distutils.sysconfig
from distutils.util import strtobool
-
-try:
- import subprocess
-except ImportError:
- if sys.version_info <= (2, 3):
- print('ERROR: %s' % sys.exc_info()[1])
- print('ERROR: this script requires Python 2.4 or greater; or at least the subprocess module.')
- print('If you copy subprocess.py from a newer version of Python this script will probably work')
- sys.exit(101)
- else:
- raise
-try:
- set
-except NameError:
- from sets import Set as set
-try:
- basestring
-except NameError:
- basestring = str
+from os.path import join
try:
import ConfigParser
except ImportError:
+ # noinspection PyPep8Naming
import configparser as ConfigParser
-join = os.path.join
-py_version = 'python%s.%s' % (sys.version_info[0], sys.version_info[1])
+__version__ = "16.7.9"
+virtualenv_version = __version__ # legacy
+DEBUG = os.environ.get("_VIRTUALENV_DEBUG", None) == "1"
+if sys.version_info < (2, 7):
+ print("ERROR: {}".format(sys.exc_info()[1]))
+ print("ERROR: this script requires Python 2.7 or greater.")
+ sys.exit(101)
-is_jython = sys.platform.startswith('java')
-is_pypy = hasattr(sys, 'pypy_version_info')
-is_win = (sys.platform == 'win32')
-abiflags = getattr(sys, 'abiflags', '')
+HERE = os.path.dirname(os.path.abspath(__file__))
+IS_ZIPAPP = os.path.isfile(HERE)
+
+try:
+ # noinspection PyUnresolvedReferences,PyUnboundLocalVariable
+ basestring
+except NameError:
+ basestring = str
+
+VERSION = "{}.{}".format(*sys.version_info)
+PY_VERSION = "python{}.{}".format(*sys.version_info)
-user_dir = os.path.expanduser('~')
-if sys.platform == 'win32':
- user_dir = os.environ.get('APPDATA', user_dir) # Use %APPDATA% for roaming
- default_storage_dir = os.path.join(user_dir, 'virtualenv')
+IS_PYPY = hasattr(sys, "pypy_version_info")
+IS_WIN = sys.platform == "win32"
+IS_CYGWIN = sys.platform == "cygwin"
+IS_DARWIN = sys.platform == "darwin"
+ABI_FLAGS = getattr(sys, "abiflags", "")
+
+USER_DIR = os.path.expanduser("~")
+if IS_WIN:
+ DEFAULT_STORAGE_DIR = os.path.join(USER_DIR, "virtualenv")
else:
- default_storage_dir = os.path.join(user_dir, '.virtualenv')
-default_config_file = os.path.join(default_storage_dir, 'virtualenv.ini')
+ DEFAULT_STORAGE_DIR = os.path.join(USER_DIR, ".virtualenv")
+DEFAULT_CONFIG_FILE = os.path.join(DEFAULT_STORAGE_DIR, "virtualenv.ini")
-if is_pypy:
- expected_exe = 'pypy'
-elif is_jython:
- expected_exe = 'jython'
+if IS_PYPY:
+ EXPECTED_EXE = "pypy"
else:
- expected_exe = 'python'
+ EXPECTED_EXE = "python"
+
+# Return a mapping of version -> Python executable
+# Only provided for Windows, where the information in the registry is used
+if not IS_WIN:
+
+ def get_installed_pythons():
+ return {}
-REQUIRED_MODULES = ['os', 'posix', 'posixpath', 'nt', 'ntpath', 'genericpath',
- 'fnmatch', 'locale', 'encodings', 'codecs',
- 'stat', 'UserDict', 'readline', 'copy_reg', 'types',
- 're', 'sre', 'sre_parse', 'sre_constants', 'sre_compile',
- 'zlib']
+else:
+ try:
+ import winreg
+ except ImportError:
+ # noinspection PyUnresolvedReferences
+ import _winreg as winreg
+
+ def get_installed_pythons():
+ final_exes = dict()
-REQUIRED_FILES = ['lib-dynload', 'config']
+ # Grab exes from 32-bit registry view
+ exes = _get_installed_pythons_for_view("-32", winreg.KEY_WOW64_32KEY)
+ # Grab exes from 64-bit registry view
+ exes_64 = _get_installed_pythons_for_view("-64", winreg.KEY_WOW64_64KEY)
+ # Check if exes are unique
+ if set(exes.values()) != set(exes_64.values()):
+ exes.update(exes_64)
+
+ # Create dict with all versions found
+ for version, bitness in sorted(exes):
+ exe = exes[(version, bitness)]
+ # Add minor version (X.Y-32 or X.Y-64)
+ final_exes[version + bitness] = exe
+ # Add minor extensionless version (X.Y); 3.2-64 wins over 3.2-32
+ final_exes[version] = exe
+ # Add major version (X-32 or X-64)
+ final_exes[version[0] + bitness] = exe
+ # Add major extensionless version (X); 3.3-32 wins over 3.2-64
+ final_exes[version[0]] = exe
+
+ return final_exes
-majver, minver = sys.version_info[:2]
-if majver == 2:
- if minver >= 6:
- REQUIRED_MODULES.extend(['warnings', 'linecache', '_abcoll', 'abc'])
- if minver >= 7:
- REQUIRED_MODULES.extend(['_weakrefset'])
- if minver <= 3:
- REQUIRED_MODULES.extend(['sets', '__future__'])
-elif majver == 3:
+ def _get_installed_pythons_for_view(bitness, view):
+ exes = dict()
+ # If both system and current user installations are found for a
+ # particular Python version, the current user one is used
+ for key in (winreg.HKEY_LOCAL_MACHINE, winreg.HKEY_CURRENT_USER):
+ try:
+ python_core = winreg.OpenKey(key, "Software\\Python\\PythonCore", 0, view | winreg.KEY_READ)
+ except WindowsError:
+ # No registered Python installations
+ continue
+ i = 0
+ while True:
+ try:
+ version = winreg.EnumKey(python_core, i)
+ i += 1
+ try:
+ at_path = winreg.QueryValue(python_core, "{}\\InstallPath".format(version))
+ except WindowsError:
+ continue
+ # Remove bitness from version
+ if version.endswith(bitness):
+ version = version[: -len(bitness)]
+ exes[(version, bitness)] = join(at_path, "python.exe")
+ except WindowsError:
+ break
+ winreg.CloseKey(python_core)
+
+ return exes
+
+
+REQUIRED_MODULES = [
+ "os",
+ "posix",
+ "posixpath",
+ "nt",
+ "ntpath",
+ "genericpath",
+ "fnmatch",
+ "locale",
+ "encodings",
+ "codecs",
+ "stat",
+ "UserDict",
+ "readline",
+ "copy_reg",
+ "types",
+ "re",
+ "sre",
+ "sre_parse",
+ "sre_constants",
+ "sre_compile",
+ "zlib",
+]
+
+REQUIRED_FILES = ["lib-dynload", "config"]
+
+MAJOR, MINOR = sys.version_info[:2]
+if MAJOR == 2:
+ if MINOR >= 6:
+ REQUIRED_MODULES.extend(["warnings", "linecache", "_abcoll", "abc"])
+ if MINOR >= 7:
+ REQUIRED_MODULES.extend(["_weakrefset"])
+elif MAJOR == 3:
# Some extra modules are needed for Python 3, but different ones
# for different versions.
- REQUIRED_MODULES.extend(['_abcoll', 'warnings', 'linecache', 'abc', 'io',
- '_weakrefset', 'copyreg', 'tempfile', 'random',
- '__future__', 'collections', 'keyword', 'tarfile',
- 'shutil', 'struct', 'copy'])
- if minver >= 2:
- REQUIRED_FILES[-1] = 'config-%s' % majver
- if minver == 3:
- # The whole list of 3.3 modules is reproduced below - the current
- # uncommented ones are required for 3.3 as of now, but more may be
- # added as 3.3 development continues.
- REQUIRED_MODULES.extend([
- #"aifc",
- #"antigravity",
- #"argparse",
- #"ast",
- #"asynchat",
- #"asyncore",
- "base64",
- #"bdb",
- #"binhex",
- "bisect",
- #"calendar",
- #"cgi",
- #"cgitb",
- #"chunk",
- #"cmd",
- #"codeop",
- #"code",
- #"colorsys",
- #"_compat_pickle",
- #"compileall",
- #"concurrent",
- #"configparser",
- #"contextlib",
- #"cProfile",
- #"crypt",
- #"csv",
- #"ctypes",
- #"curses",
- #"datetime",
- #"dbm",
- #"decimal",
- #"difflib",
- #"dis",
- #"doctest",
- #"dummy_threading",
- "_dummy_thread",
- #"email",
- #"filecmp",
- #"fileinput",
- #"formatter",
- #"fractions",
- #"ftplib",
- #"functools",
- #"getopt",
- #"getpass",
- #"gettext",
- #"glob",
- #"gzip",
- "hashlib",
+ REQUIRED_MODULES.extend(
+ [
+ "_abcoll",
+ "warnings",
+ "linecache",
+ "abc",
+ "io",
+ "_weakrefset",
+ "copyreg",
+ "tempfile",
+ "random",
+ "__future__",
+ "collections",
+ "keyword",
+ "tarfile",
+ "shutil",
+ "struct",
+ "copy",
+ "tokenize",
+ "token",
+ "functools",
"heapq",
- "hmac",
- #"html",
- #"http",
- #"idlelib",
- #"imaplib",
- #"imghdr",
- #"importlib",
- #"inspect",
- #"json",
- #"lib2to3",
- #"logging",
- #"macpath",
- #"macurl2path",
- #"mailbox",
- #"mailcap",
- #"_markupbase",
- #"mimetypes",
- #"modulefinder",
- #"multiprocessing",
- #"netrc",
- #"nntplib",
- #"nturl2path",
- #"numbers",
- #"opcode",
- #"optparse",
- #"os2emxpath",
- #"pdb",
- #"pickle",
- #"pickletools",
- #"pipes",
- #"pkgutil",
- #"platform",
- #"plat-linux2",
- #"plistlib",
- #"poplib",
- #"pprint",
- #"profile",
- #"pstats",
- #"pty",
- #"pyclbr",
- #"py_compile",
- #"pydoc_data",
- #"pydoc",
- #"_pyio",
- #"queue",
- #"quopri",
+ "bisect",
+ "weakref",
"reprlib",
- "rlcompleter",
- #"runpy",
- #"sched",
- #"shelve",
- #"shlex",
- #"smtpd",
- #"smtplib",
- #"sndhdr",
- #"socket",
- #"socketserver",
- #"sqlite3",
- #"ssl",
- #"stringprep",
- #"string",
- #"_strptime",
- #"subprocess",
- #"sunau",
- #"symbol",
- #"symtable",
- #"sysconfig",
- #"tabnanny",
- #"telnetlib",
- #"test",
- #"textwrap",
- #"this",
- #"_threading_local",
- #"threading",
- #"timeit",
- #"tkinter",
- #"tokenize",
- #"token",
- #"traceback",
- #"trace",
- #"tty",
- #"turtledemo",
- #"turtle",
- #"unittest",
- #"urllib",
- #"uuid",
- #"uu",
- #"wave",
- "weakref",
- #"webbrowser",
- #"wsgiref",
- #"xdrlib",
- #"xml",
- #"xmlrpc",
- #"zipfile",
- ])
+ ]
+ )
+ if MINOR >= 2:
+ REQUIRED_FILES[-1] = "config-{}".format(MAJOR)
+ if MINOR >= 3:
+ import sysconfig
-if is_pypy:
+ platform_dir = sysconfig.get_config_var("PLATDIR")
+ REQUIRED_FILES.append(platform_dir)
+ REQUIRED_MODULES.extend(["base64", "_dummy_thread", "hashlib", "hmac", "imp", "importlib", "rlcompleter"])
+ if MINOR >= 4:
+ REQUIRED_MODULES.extend(["operator", "_collections_abc", "_bootlocale"])
+ if MINOR >= 6:
+ REQUIRED_MODULES.extend(["enum"])
+
+if IS_PYPY:
# these are needed to correctly display the exceptions that may happen
# during the bootstrap
- REQUIRED_MODULES.extend(['traceback', 'linecache'])
+ REQUIRED_MODULES.extend(["traceback", "linecache"])
+
+ if MAJOR == 3:
+ # _functools is needed to import locale during stdio initialization and
+ # needs to be copied on PyPy because it's not built in
+ REQUIRED_MODULES.append("_functools")
+
class Logger(object):
@@ -258,7 +249,7 @@
DEBUG = logging.DEBUG
INFO = logging.INFO
- NOTIFY = (logging.INFO+logging.WARN)/2
+ NOTIFY = (logging.INFO + logging.WARN) / 2
WARN = WARNING = logging.WARN
ERROR = logging.ERROR
FATAL = logging.FATAL
@@ -273,63 +264,66 @@
def debug(self, msg, *args, **kw):
self.log(self.DEBUG, msg, *args, **kw)
+
def info(self, msg, *args, **kw):
self.log(self.INFO, msg, *args, **kw)
+
def notify(self, msg, *args, **kw):
self.log(self.NOTIFY, msg, *args, **kw)
+
def warn(self, msg, *args, **kw):
self.log(self.WARN, msg, *args, **kw)
+
def error(self, msg, *args, **kw):
- self.log(self.WARN, msg, *args, **kw)
+ self.log(self.ERROR, msg, *args, **kw)
+
def fatal(self, msg, *args, **kw):
self.log(self.FATAL, msg, *args, **kw)
+
def log(self, level, msg, *args, **kw):
if args:
if kw:
- raise TypeError(
- "You may give positional or keyword arguments, not both")
+ raise TypeError("You may give positional or keyword arguments, not both")
args = args or kw
rendered = None
for consumer_level, consumer in self.consumers:
if self.level_matches(level, consumer_level):
- if (self.in_progress_hanging
- and consumer in (sys.stdout, sys.stderr)):
+ if self.in_progress_hanging and consumer in (sys.stdout, sys.stderr):
self.in_progress_hanging = False
- sys.stdout.write('\n')
+ print("")
sys.stdout.flush()
if rendered is None:
if args:
rendered = msg % args
else:
rendered = msg
- rendered = ' '*self.indent + rendered
- if hasattr(consumer, 'write'):
- consumer.write(rendered+'\n')
+ rendered = " " * self.indent + rendered
+ if hasattr(consumer, "write"):
+ consumer.write(rendered + "\n")
else:
consumer(rendered)
def start_progress(self, msg):
- assert not self.in_progress, (
- "Tried to start_progress(%r) while in_progress %r"
- % (msg, self.in_progress))
+ assert not self.in_progress, "Tried to start_progress({!r}) while in_progress {!r}".format(
+ msg, self.in_progress
+ )
if self.level_matches(self.NOTIFY, self._stdout_level()):
- sys.stdout.write(msg)
+ print(msg)
sys.stdout.flush()
self.in_progress_hanging = True
else:
self.in_progress_hanging = False
self.in_progress = msg
- def end_progress(self, msg='done.'):
- assert self.in_progress, (
- "Tried to end_progress without start_progress")
+ def end_progress(self, msg="done."):
+ assert self.in_progress, "Tried to end_progress without start_progress"
if self.stdout_level_matches(self.NOTIFY):
if not self.in_progress_hanging:
# Some message has been printed out since start_progress
- sys.stdout.write('...' + self.in_progress + msg + '\n')
+ print("...{}{}".format(self.in_progress, msg))
sys.stdout.flush()
else:
- sys.stdout.write(msg + '\n')
+ print(msg)
sys.stdout.flush()
self.in_progress = None
self.in_progress_hanging = False
@@ -338,7 +332,7 @@
"""If we are in a progress scope, and no log messages have been
shown, write out another '.'"""
if self.in_progress_hanging:
- sys.stdout.write('.')
+ print(".")
sys.stdout.flush()
def stdout_level_matches(self, level):
@@ -352,7 +346,8 @@
return level
return self.FATAL
- def level_matches(self, level, consumer_level):
+ @staticmethod
+ def level_matches(level, consumer_level):
"""
>>> l = Logger([])
>>> l.level_matches(3, 4)
@@ -378,7 +373,7 @@
else:
return level >= consumer_level
- #@classmethod
+ @classmethod
def level_for_integer(cls, level):
levels = cls.LEVELS
if level < 0:
@@ -387,279 +382,123 @@
return levels[-1]
return levels[level]
- level_for_integer = classmethod(level_for_integer)
# create a silent logger just to prevent this from being undefined
# will be overridden with requested verbosity main() is called.
logger = Logger([(Logger.LEVELS[-1], sys.stdout)])
-def mkdir(path):
- if not os.path.exists(path):
- logger.info('Creating %s', path)
- os.makedirs(path)
+
+def mkdir(at_path):
+ if not os.path.exists(at_path):
+ logger.info("Creating %s", at_path)
+ os.makedirs(at_path)
else:
- logger.info('Directory %s already exists', path)
+ logger.info("Directory %s already exists", at_path)
+
-def copyfileordir(src, dest):
+def copy_file_or_folder(src, dest, symlink=True):
if os.path.isdir(src):
- shutil.copytree(src, dest, True)
+ shutil.copytree(src, dest, symlink)
else:
shutil.copy2(src, dest)
+
def copyfile(src, dest, symlink=True):
if not os.path.exists(src):
# Some bad symlink in the src
- logger.warn('Cannot find file %s (bad symlink)', src)
+ logger.warn("Cannot find file %s (bad symlink)", src)
return
if os.path.exists(dest):
- logger.debug('File %s already exists', dest)
+ logger.debug("File %s already exists", dest)
return
if not os.path.exists(os.path.dirname(dest)):
- logger.info('Creating parent directories for %s' % os.path.dirname(dest))
+ logger.info("Creating parent directories for %s", os.path.dirname(dest))
os.makedirs(os.path.dirname(dest))
- if not os.path.islink(src):
- srcpath = os.path.abspath(src)
+ if symlink and hasattr(os, "symlink") and not IS_WIN:
+ logger.info("Symlinking %s", dest)
+ try:
+ os.symlink(os.path.realpath(src), dest)
+ except (OSError, NotImplementedError):
+ logger.info("Symlinking failed, copying to %s", dest)
+ copy_file_or_folder(src, dest, symlink)
else:
- srcpath = os.readlink(src)
- if symlink and hasattr(os, 'symlink') and not is_win:
- logger.info('Symlinking %s', dest)
- try:
- os.symlink(srcpath, dest)
- except (OSError, NotImplementedError):
- logger.info('Symlinking failed, copying to %s', dest)
- copyfileordir(src, dest)
- else:
- logger.info('Copying to %s', dest)
- copyfileordir(src, dest)
+ logger.info("Copying to %s", dest)
+ copy_file_or_folder(src, dest, symlink)
+
def writefile(dest, content, overwrite=True):
if not os.path.exists(dest):
- logger.info('Writing %s', dest)
- f = open(dest, 'wb')
- f.write(content.encode('utf-8'))
- f.close()
+ logger.info("Writing %s", dest)
+ with open(dest, "wb") as f:
+ f.write(content.encode("utf-8"))
return
else:
- f = open(dest, 'rb')
- c = f.read()
- f.close()
- if c != content:
+ with open(dest, "rb") as f:
+ c = f.read()
+ if c != content.encode("utf-8"):
if not overwrite:
- logger.notify('File %s exists with different content; not overwriting', dest)
+ logger.notify("File %s exists with different content; not overwriting", dest)
return
- logger.notify('Overwriting %s with new content', dest)
- f = open(dest, 'wb')
- f.write(content.encode('utf-8'))
- f.close()
+ logger.notify("Overwriting %s with new content", dest)
+ with open(dest, "wb") as f:
+ f.write(content.encode("utf-8"))
else:
- logger.info('Content %s already in place', dest)
+ logger.info("Content %s already in place", dest)
+
-def rmtree(dir):
- if os.path.exists(dir):
- logger.notify('Deleting tree %s', dir)
- shutil.rmtree(dir)
+def rm_tree(folder):
+ if os.path.exists(folder):
+ logger.notify("Deleting tree %s", folder)
+ shutil.rmtree(folder)
else:
- logger.info('Do not need to delete %s; already gone', dir)
+ logger.info("Do not need to delete %s; already gone", folder)
+
def make_exe(fn):
- if hasattr(os, 'chmod'):
- oldmode = os.stat(fn).st_mode & 0xFFF # 0o7777
- newmode = (oldmode | 0x16D) & 0xFFF # 0o555, 0o7777
- os.chmod(fn, newmode)
- logger.info('Changed mode of %s to %s', fn, oct(newmode))
+ if hasattr(os, "chmod"):
+ old_mode = os.stat(fn).st_mode & 0xFFF # 0o7777
+ new_mode = (old_mode | 0x16D) & 0xFFF # 0o555, 0o7777
+ os.chmod(fn, new_mode)
+ logger.info("Changed mode of %s to %s", fn, oct(new_mode))
-def _find_file(filename, dirs):
- for dir in reversed(dirs):
- if os.path.exists(join(dir, filename)):
- return join(dir, filename)
- return filename
-
-def _install_req(py_executable, unzip=False, distribute=False,
- search_dirs=None, never_download=False):
-
- if search_dirs is None:
- search_dirs = file_search_dirs()
- if not distribute:
- setup_fn = 'setuptools-0.6c11-py%s.egg' % sys.version[:3]
- project_name = 'setuptools'
- bootstrap_script = EZ_SETUP_PY
- source = None
- else:
- setup_fn = None
- source = 'distribute-0.6.24.tar.gz'
- project_name = 'distribute'
- bootstrap_script = DISTRIBUTE_SETUP_PY
-
- if setup_fn is not None:
- setup_fn = _find_file(setup_fn, search_dirs)
+def _find_file(filename, folders):
+ for folder in reversed(folders):
+ files = glob.glob(os.path.join(folder, filename))
+ if files and os.path.isfile(files[0]):
+ return True, files[0]
+ return False, filename
- if source is not None:
- source = _find_file(source, search_dirs)
-
- if is_jython and os._name == 'nt':
- # Jython's .bat sys.executable can't handle a command line
- # argument with newlines
- fd, ez_setup = tempfile.mkstemp('.py')
- os.write(fd, bootstrap_script)
- os.close(fd)
- cmd = [py_executable, ez_setup]
- else:
- cmd = [py_executable, '-c', bootstrap_script]
- if unzip:
- cmd.append('--always-unzip')
- env = {}
- remove_from_env = []
- if logger.stdout_level_matches(logger.DEBUG):
- cmd.append('-v')
- old_chdir = os.getcwd()
- if setup_fn is not None and os.path.exists(setup_fn):
- logger.info('Using existing %s egg: %s' % (project_name, setup_fn))
- cmd.append(setup_fn)
- if os.environ.get('PYTHONPATH'):
- env['PYTHONPATH'] = setup_fn + os.path.pathsep + os.environ['PYTHONPATH']
- else:
- env['PYTHONPATH'] = setup_fn
- else:
- # the source is found, let's chdir
- if source is not None and os.path.exists(source):
- logger.info('Using existing %s egg: %s' % (project_name, source))
- os.chdir(os.path.dirname(source))
- # in this case, we want to be sure that PYTHONPATH is unset (not
- # just empty, really unset), else CPython tries to import the
- # site.py that it's in virtualenv_support
- remove_from_env.append('PYTHONPATH')
- else:
- if never_download:
- logger.fatal("Can't find any local distributions of %s to install "
- "and --never-download is set. Either re-run virtualenv "
- "without the --never-download option, or place a %s "
- "distribution (%s) in one of these "
- "locations: %r" % (project_name, project_name,
- setup_fn or source,
- search_dirs))
- sys.exit(1)
+@contextlib.contextmanager
+def virtualenv_support_dirs():
+ """Context manager yielding either [virtualenv_support_dir] or []"""
- logger.info('No %s egg found; downloading' % project_name)
- cmd.extend(['--always-copy', '-U', project_name])
- logger.start_progress('Installing %s...' % project_name)
- logger.indent += 2
- cwd = None
- if project_name == 'distribute':
- env['DONT_PATCH_SETUPTOOLS'] = 'true'
-
- def _filter_ez_setup(line):
- return filter_ez_setup(line, project_name)
-
- if not os.access(os.getcwd(), os.W_OK):
- cwd = tempfile.mkdtemp()
- if source is not None and os.path.exists(source):
- # the current working dir is hostile, let's copy the
- # tarball to a temp dir
- target = os.path.join(cwd, os.path.split(source)[-1])
- shutil.copy(source, target)
- try:
- call_subprocess(cmd, show_stdout=False,
- filter_stdout=_filter_ez_setup,
- extra_env=env,
- remove_from_env=remove_from_env,
- cwd=cwd)
- finally:
- logger.indent -= 2
- logger.end_progress()
- if os.getcwd() != old_chdir:
- os.chdir(old_chdir)
- if is_jython and os._name == 'nt':
- os.remove(ez_setup)
-
-def file_search_dirs():
- here = os.path.dirname(os.path.abspath(__file__))
- dirs = ['.', here,
- join(here, 'virtualenv_support')]
- if os.path.splitext(os.path.dirname(__file__))[0] != 'virtualenv':
- # Probably some boot script; just in case virtualenv is installed...
+ # normal filesystem installation
+ if os.path.isdir(join(HERE, "virtualenv_support")):
+ yield [join(HERE, "virtualenv_support")]
+ elif IS_ZIPAPP:
+ tmpdir = tempfile.mkdtemp()
try:
+ with zipfile.ZipFile(HERE) as zipf:
+ for member in zipf.namelist():
+ if os.path.dirname(member) == "virtualenv_support":
+ zipf.extract(member, tmpdir)
+ yield [join(tmpdir, "virtualenv_support")]
+ finally:
+ shutil.rmtree(tmpdir)
+ # probably a bootstrap script
+ elif os.path.splitext(os.path.dirname(__file__))[0] != "virtualenv":
+ try:
+ # noinspection PyUnresolvedReferences
import virtualenv
except ImportError:
- pass
+ yield []
else:
- dirs.append(os.path.join(os.path.dirname(virtualenv.__file__), 'virtualenv_support'))
- return [d for d in dirs if os.path.isdir(d)]
-
-def install_setuptools(py_executable, unzip=False,
- search_dirs=None, never_download=False):
- _install_req(py_executable, unzip,
- search_dirs=search_dirs, never_download=never_download)
-
-def install_distribute(py_executable, unzip=False,
- search_dirs=None, never_download=False):
- _install_req(py_executable, unzip, distribute=True,
- search_dirs=search_dirs, never_download=never_download)
-
-_pip_re = re.compile(r'^pip-.*(zip|tar.gz|tar.bz2|tgz|tbz)$', re.I)
-def install_pip(py_executable, search_dirs=None, never_download=False):
- if search_dirs is None:
- search_dirs = file_search_dirs()
-
- filenames = []
- for dir in search_dirs:
- filenames.extend([join(dir, fn) for fn in os.listdir(dir)
- if _pip_re.search(fn)])
- filenames = [(os.path.basename(filename).lower(), i, filename) for i, filename in enumerate(filenames)]
- filenames.sort()
- filenames = [filename for basename, i, filename in filenames]
- if not filenames:
- filename = 'pip'
+ yield [join(os.path.dirname(virtualenv.__file__), "virtualenv_support")]
+ # we tried!
else:
- filename = filenames[-1]
- easy_install_script = 'easy_install'
- if sys.platform == 'win32':
- easy_install_script = 'easy_install-script.py'
- cmd = [join(os.path.dirname(py_executable), easy_install_script), filename]
- if sys.platform == 'win32':
- cmd.insert(0, py_executable)
- if filename == 'pip':
- if never_download:
- logger.fatal("Can't find any local distributions of pip to install "
- "and --never-download is set. Either re-run virtualenv "
- "without the --never-download option, or place a pip "
- "source distribution (zip/tar.gz/tar.bz2) in one of these "
- "locations: %r" % search_dirs)
- sys.exit(1)
- logger.info('Installing pip from network...')
- else:
- logger.info('Installing existing %s distribution: %s' % (
- os.path.basename(filename), filename))
- logger.start_progress('Installing pip...')
- logger.indent += 2
- def _filter_setup(line):
- return filter_ez_setup(line, 'pip')
- try:
- call_subprocess(cmd, show_stdout=False,
- filter_stdout=_filter_setup)
- finally:
- logger.indent -= 2
- logger.end_progress()
-
-def filter_ez_setup(line, project_name='setuptools'):
- if not line.strip():
- return Logger.DEBUG
- if project_name == 'distribute':
- for prefix in ('Extracting', 'Now working', 'Installing', 'Before',
- 'Scanning', 'Setuptools', 'Egg', 'Already',
- 'running', 'writing', 'reading', 'installing',
- 'creating', 'copying', 'byte-compiling', 'removing',
- 'Processing'):
- if line.startswith(prefix):
- return Logger.DEBUG
- return Logger.DEBUG
- for prefix in ['Reading ', 'Best match', 'Processing setuptools',
- 'Copying setuptools', 'Adding setuptools',
- 'Installing ', 'Installed ']:
- if line.startswith(prefix):
- return Logger.DEBUG
- return Logger.INFO
+ yield []
class UpdatingDefaultsHelpFormatter(optparse.IndentedHelpFormatter):
@@ -668,6 +507,7 @@
the defaults before expanding them, allowing them to show up correctly
in the help listing
"""
+
def expand_default(self, option):
if self.parser is not None:
self.parser.update_defaults(self.parser.defaults)
@@ -676,20 +516,22 @@
class ConfigOptionParser(optparse.OptionParser):
"""
- Custom option parser which updates its defaults by by checking the
+ Custom option parser which updates its defaults by checking the
configuration files and environmental variables
"""
+
def __init__(self, *args, **kwargs):
self.config = ConfigParser.RawConfigParser()
self.files = self.get_config_files()
self.config.read(self.files)
optparse.OptionParser.__init__(self, *args, **kwargs)
- def get_config_files(self):
- config_file = os.environ.get('VIRTUALENV_CONFIG_FILE', False)
+ @staticmethod
+ def get_config_files():
+ config_file = os.environ.get("VIRTUALENV_CONFIG_FILE", False)
if config_file and os.path.exists(config_file):
return [config_file]
- return [default_config_file]
+ return [DEFAULT_CONFIG_FILE]
def update_defaults(self, defaults):
"""
@@ -700,31 +542,33 @@
# Then go and look for the other sources of configuration:
config = {}
# 1. config files
- config.update(dict(self.get_config_section('virtualenv')))
+ config.update(dict(self.get_config_section("virtualenv")))
# 2. environmental variables
config.update(dict(self.get_environ_vars()))
# Then set the options with those values
for key, val in config.items():
- key = key.replace('_', '-')
- if not key.startswith('--'):
- key = '--%s' % key # only prefer long opts
+ key = key.replace("_", "-")
+ if not key.startswith("--"):
+ key = "--{}".format(key) # only prefer long opts
option = self.get_option(key)
if option is not None:
# ignore empty values
if not val:
continue
# handle multiline configs
- if option.action == 'append':
+ if option.action == "append":
val = val.split()
else:
option.nargs = 1
- if option.action in ('store_true', 'store_false', 'count'):
+ if option.action == "store_false":
+ val = not strtobool(val)
+ elif option.action in ("store_true", "count"):
val = strtobool(val)
try:
val = option.convert_value(key, val)
except optparse.OptionValueError:
e = sys.exc_info()[1]
- print("An error occured during configuration: %s" % e)
+ print("An error occurred during configuration: {!r}".format(e))
sys.exit(3)
defaults[option.dest] = val
return defaults
@@ -737,24 +581,24 @@
return self.config.items(name)
return []
- def get_environ_vars(self, prefix='VIRTUALENV_'):
+ def get_environ_vars(self, prefix="VIRTUALENV_"):
"""
Returns a generator with all environmental vars with prefix VIRTUALENV
"""
for key, val in os.environ.items():
if key.startswith(prefix):
- yield (key.replace(prefix, '').lower(), val)
+ yield (key.replace(prefix, "").lower(), val)
def get_default_values(self):
"""
- Overridding to make updating the defaults after instantiation of
+ Overriding to make updating the defaults after instantiation of
the option parser possible, update_defaults() does the dirty work.
"""
if not self.process_default_values:
# Old, pre-Optik 1.5 behaviour.
return optparse.Values(self.defaults)
- defaults = self.update_defaults(self.defaults.copy()) # ours
+ defaults = self.update_defaults(self.defaults.copy()) # ours
for option in self._get_all_options():
default = defaults.get(option.dest)
if isinstance(default, basestring):
@@ -765,254 +609,544 @@
def main():
parser = ConfigOptionParser(
- version=virtualenv_version,
- usage="%prog [OPTIONS] DEST_DIR",
- formatter=UpdatingDefaultsHelpFormatter())
+ version=virtualenv_version, usage="%prog [OPTIONS] DEST_DIR", formatter=UpdatingDefaultsHelpFormatter()
+ )
parser.add_option(
- '-v', '--verbose',
- action='count',
- dest='verbose',
- default=0,
- help="Increase verbosity")
+ "-v", "--verbose", action="count", dest="verbose", default=5 if DEBUG else 0, help="Increase verbosity."
+ )
+
+ parser.add_option("-q", "--quiet", action="count", dest="quiet", default=0, help="Decrease verbosity.")
parser.add_option(
- '-q', '--quiet',
- action='count',
- dest='quiet',
- default=0,
- help='Decrease verbosity')
+ "-p",
+ "--python",
+ dest="python",
+ metavar="PYTHON_EXE",
+ help="The Python interpreter to use, e.g., --python=python3.5 will use the python3.5 "
+ "interpreter to create the new environment. The default is the interpreter that "
+ "virtualenv was installed with ({})".format(sys.executable),
+ )
parser.add_option(
- '-p', '--python',
- dest='python',
- metavar='PYTHON_EXE',
- help='The Python interpreter to use, e.g., --python=python2.5 will use the python2.5 '
- 'interpreter to create the new environment. The default is the interpreter that '
- 'virtualenv was installed with (%s)' % sys.executable)
+ "--clear", dest="clear", action="store_true", help="Clear out the non-root install and start from scratch."
+ )
+
+ parser.set_defaults(system_site_packages=False)
+ parser.add_option(
+ "--no-site-packages",
+ dest="system_site_packages",
+ action="store_false",
+ help="DEPRECATED. Retained only for backward compatibility. "
+ "Not having access to global site-packages is now the default behavior.",
+ )
parser.add_option(
- '--clear',
- dest='clear',
- action='store_true',
- help="Clear out the non-root install and start from scratch")
+ "--system-site-packages",
+ dest="system_site_packages",
+ action="store_true",
+ help="Give the virtual environment access to the global site-packages.",
+ )
parser.add_option(
- '--no-site-packages',
- dest='no_site_packages',
- action='store_true',
- help="Don't give access to the global site-packages dir to the "
- "virtual environment")
+ "--always-copy",
+ dest="symlink",
+ action="store_false",
+ default=True,
+ help="Always copy files rather than symlinking.",
+ )
+
+ parser.add_option(
+ "--relocatable",
+ dest="relocatable",
+ action="store_true",
+ help="Make an EXISTING virtualenv environment relocatable. "
+ "This fixes up scripts and makes all .pth files relative.",
+ )
parser.add_option(
- '--system-site-packages',
- dest='system_site_packages',
- action='store_true',
- help="Give access to the global site-packages dir to the "
- "virtual environment")
+ "--no-setuptools",
+ dest="no_setuptools",
+ action="store_true",
+ help="Do not install setuptools in the new virtualenv.",
+ )
+
+ parser.add_option("--no-pip", dest="no_pip", action="store_true", help="Do not install pip in the new virtualenv.")
+
+ parser.add_option(
+ "--no-wheel", dest="no_wheel", action="store_true", help="Do not install wheel in the new virtualenv."
+ )
parser.add_option(
- '--unzip-setuptools',
- dest='unzip_setuptools',
- action='store_true',
- help="Unzip Setuptools or Distribute when installing it")
+ "--extra-search-dir",
+ dest="search_dirs",
+ action="append",
+ metavar="DIR",
+ default=[],
+ help="Directory to look for setuptools/pip distributions in. " "This option can be used multiple times.",
+ )
parser.add_option(
- '--relocatable',
- dest='relocatable',
- action='store_true',
- help='Make an EXISTING virtualenv environment relocatable. '
- 'This fixes up scripts and makes all .pth files relative')
+ "--download",
+ dest="download",
+ default=True,
+ action="store_true",
+ help="Download pre-installed packages from PyPI.",
+ )
parser.add_option(
- '--distribute',
- dest='use_distribute',
- action='store_true',
- help='Use Distribute instead of Setuptools. Set environ variable '
- 'VIRTUALENV_DISTRIBUTE to make it the default ')
+ "--no-download",
+ "--never-download",
+ dest="download",
+ action="store_false",
+ help="Do not download pre-installed packages from PyPI.",
+ )
- default_search_dirs = file_search_dirs()
- parser.add_option(
- '--extra-search-dir',
- dest="search_dirs",
- action="append",
- default=default_search_dirs,
- help="Directory to look for setuptools/distribute/pip distributions in. "
- "You can add any number of additional --extra-search-dir paths.")
+ parser.add_option("--prompt", dest="prompt", help="Provides an alternative prompt prefix for this environment.")
parser.add_option(
- '--never-download',
- dest="never_download",
+ "--setuptools",
+ dest="setuptools",
action="store_true",
- help="Never download anything from the network. Instead, virtualenv will fail "
- "if local distributions of setuptools/distribute/pip are not present.")
+ help="DEPRECATED. Retained only for backward compatibility. This option has no effect.",
+ )
parser.add_option(
- '--prompt=',
- dest='prompt',
- help='Provides an alternative prompt prefix for this environment')
+ "--distribute",
+ dest="distribute",
+ action="store_true",
+ help="DEPRECATED. Retained only for backward compatibility. This option has no effect.",
+ )
- if 'extend_parser' in globals():
- extend_parser(parser)
+ parser.add_option(
+ "--unzip-setuptools",
+ action="store_true",
+ help="DEPRECATED. Retained only for backward compatibility. This option has no effect.",
+ )
+
+ if "extend_parser" in globals():
+ # noinspection PyUnresolvedReferences
+ extend_parser(parser) # noqa: F821
options, args = parser.parse_args()
global logger
- if 'adjust_options' in globals():
- adjust_options(options, args)
+ if "adjust_options" in globals():
+ # noinspection PyUnresolvedReferences
+ adjust_options(options, args) # noqa: F821
verbosity = options.verbose - options.quiet
- logger = Logger([(Logger.level_for_integer(2-verbosity), sys.stdout)])
+ logger = Logger([(Logger.level_for_integer(2 - verbosity), sys.stdout)])
+
+ def should_reinvoke(options):
+ """Do we need to reinvoke ourself?"""
+ # Did the user specify the --python option?
+ if options.python and not os.environ.get("VIRTUALENV_INTERPRETER_RUNNING"):
+ interpreter = resolve_interpreter(options.python)
+ if interpreter != sys.executable:
+ # The user specified a different interpreter, so we have to reinvoke.
+ return interpreter
- if options.python and not os.environ.get('VIRTUALENV_INTERPRETER_RUNNING'):
+ # At this point, we know the user wants to use sys.executable to create the
+ # virtual environment. But on Windows, sys.executable may be a venv redirector,
+ # in which case we still need to locate the underlying actual interpreter, and
+ # reinvoke using that.
+ if IS_WIN:
+ # OK. Now things get really fun...
+ #
+ # If we are running from a venv, with a redirector, then what happens is as
+ # follows:
+ #
+ # 1. The redirector sets __PYVENV_LAUNCHER__ in the environment to point
+ # to the redirector executable.
+ # 2. The redirector launches the "base" Python (from the home value in
+ # pyvenv.cfg).
+ # 3. The base Python executable sees __PYVENV_LAUNCHER__ in the environment
+ # and sets sys.executable to that value.
+ # 4. If site.py gets run, it sees __PYVENV_LAUNCHER__, and sets
+ # sys._base_executable to _winapi.GetModuleFileName(0) and removes
+ # __PYVENV_LAUNCHER__.
+ #
+ # Unfortunately, that final step (site.py) may not happen. There are 2 key
+ # times when that is the case:
+ #
+ # 1. Python 3.7.2, which had the redirector but not the site.py code.
+ # 2. Running a venv from a virtualenv, which uses virtualenv's custom
+ # site.py.
+ #
+ # So, we check for sys._base_executable, but if it's not present and yet we
+ # have __PYVENV_LAUNCHER__, we do what site.py would have done and get our
+ # interpreter from GetModuleFileName(0). We also remove __PYVENV_LAUNCHER__
+ # from the environment, to avoid loops (actually, mainly because site.py
+ # does so, and my head hurts enough buy now that I just want to be safe!)
+
+ # In Python 3.7.4, the rules changed so that sys._base_executable is always
+ # set. So we now only return sys._base_executable if it's set *and does not
+ # match sys.executable* (we still have to check that it's set, as we need to
+ # support Python 3.7.3 and earlier).
+
+ # Phew.
+
+ if getattr(sys, "_base_executable", sys.executable) != sys.executable:
+ return sys._base_executable
+
+ if "__PYVENV_LAUNCHER__" in os.environ:
+ import _winapi
+
+ del os.environ["__PYVENV_LAUNCHER__"]
+ return _winapi.GetModuleFileName(0)
+
+ # We don't need to reinvoke
+ return None
+
+ interpreter = should_reinvoke(options)
+ if interpreter is None:
+ # We don't need to reinvoke - if the user asked us to, tell them why we
+ # aren't.
+ if options.python:
+ logger.warn("Already using interpreter {}".format(sys.executable))
+ else:
env = os.environ.copy()
- interpreter = resolve_interpreter(options.python)
- if interpreter == sys.executable:
- logger.warn('Already using interpreter %s' % interpreter)
- else:
- logger.notify('Running virtualenv with interpreter %s' % interpreter)
- env['VIRTUALENV_INTERPRETER_RUNNING'] = 'true'
- file = __file__
- if file.endswith('.pyc'):
- file = file[:-1]
- popen = subprocess.Popen([interpreter, file] + sys.argv[1:], env=env)
- raise SystemExit(popen.wait())
+ logger.notify("Running virtualenv with interpreter {}".format(interpreter))
+ env["VIRTUALENV_INTERPRETER_RUNNING"] = "true"
+ # Remove the variable __PYVENV_LAUNCHER__ if it's present, as it causes the
+ # interpreter to redirect back to the virtual environment.
+ if "__PYVENV_LAUNCHER__" in env:
+ del env["__PYVENV_LAUNCHER__"]
+ file = __file__
+ if file.endswith(".pyc"):
+ file = file[:-1]
+ elif IS_ZIPAPP:
+ file = HERE
+ sub_process_call = subprocess.Popen([interpreter, file] + sys.argv[1:], env=env)
+ raise SystemExit(sub_process_call.wait())
- # Force --distribute on Python 3, since setuptools is not available.
- if majver > 2:
- options.use_distribute = True
-
- if os.environ.get('PYTHONDONTWRITEBYTECODE') and not options.use_distribute:
- print(
- "The PYTHONDONTWRITEBYTECODE environment variable is "
- "not compatible with setuptools. Either use --distribute "
- "or unset PYTHONDONTWRITEBYTECODE.")
- sys.exit(2)
if not args:
- print('You must provide a DEST_DIR')
+ print("You must provide a DEST_DIR")
parser.print_help()
sys.exit(2)
if len(args) > 1:
- print('There must be only one argument: DEST_DIR (you gave %s)' % (
- ' '.join(args)))
+ print("There must be only one argument: DEST_DIR (you gave {})".format(" ".join(args)))
parser.print_help()
sys.exit(2)
home_dir = args[0]
- if os.environ.get('WORKING_ENV'):
- logger.fatal('ERROR: you cannot run virtualenv while in a workingenv')
- logger.fatal('Please deactivate your workingenv, then re-run this script')
+ if os.path.exists(home_dir) and os.path.isfile(home_dir):
+ logger.fatal("ERROR: File already exists and is not a directory.")
+ logger.fatal("Please provide a different path or delete the file.")
sys.exit(3)
- if 'PYTHONHOME' in os.environ:
- logger.warn('PYTHONHOME is set. You *must* activate the virtualenv before using it')
- del os.environ['PYTHONHOME']
+ if os.pathsep in home_dir:
+ logger.fatal("ERROR: target path contains the operating system path separator '{}'".format(os.pathsep))
+ logger.fatal("This is not allowed as would make the activation scripts unusable.".format(os.pathsep))
+ sys.exit(3)
+
+ if os.environ.get("WORKING_ENV"):
+ logger.fatal("ERROR: you cannot run virtualenv while in a working env")
+ logger.fatal("Please deactivate your working env, then re-run this script")
+ sys.exit(3)
+
+ if "PYTHONHOME" in os.environ:
+ logger.warn("PYTHONHOME is set. You *must* activate the virtualenv before using it")
+ del os.environ["PYTHONHOME"]
if options.relocatable:
make_environment_relocatable(home_dir)
return
- if options.no_site_packages:
- logger.warn('The --no-site-packages flag is deprecated; it is now '
- 'the default behavior.')
+ with virtualenv_support_dirs() as search_dirs:
+ create_environment(
+ home_dir,
+ site_packages=options.system_site_packages,
+ clear=options.clear,
+ prompt=options.prompt,
+ search_dirs=search_dirs + options.search_dirs,
+ download=options.download,
+ no_setuptools=options.no_setuptools,
+ no_pip=options.no_pip,
+ no_wheel=options.no_wheel,
+ symlink=options.symlink,
+ )
+ if "after_install" in globals():
+ # noinspection PyUnresolvedReferences
+ after_install(options, home_dir) # noqa: F821
- create_environment(home_dir,
- site_packages=options.system_site_packages,
- clear=options.clear,
- unzip_setuptools=options.unzip_setuptools,
- use_distribute=options.use_distribute,
- prompt=options.prompt,
- search_dirs=options.search_dirs,
- never_download=options.never_download)
- if 'after_install' in globals():
- after_install(options, home_dir)
-def call_subprocess(cmd, show_stdout=True,
- filter_stdout=None, cwd=None,
- raise_on_returncode=True, extra_env=None,
- remove_from_env=None):
+def call_subprocess(
+ cmd,
+ show_stdout=True,
+ filter_stdout=None,
+ cwd=None,
+ raise_on_return_code=True,
+ extra_env=None,
+ remove_from_env=None,
+ stdin=None,
+):
cmd_parts = []
for part in cmd:
if len(part) > 45:
- part = part[:20]+"..."+part[-20:]
- if ' ' in part or '\n' in part or '"' in part or "'" in part:
- part = '"%s"' % part.replace('"', '\\"')
- if hasattr(part, 'decode'):
+ part = part[:20] + "..." + part[-20:]
+ if " " in part or "\n" in part or '"' in part or "'" in part:
+ part = '"{}"'.format(part.replace('"', '\\"'))
+ if hasattr(part, "decode"):
try:
part = part.decode(sys.getdefaultencoding())
except UnicodeDecodeError:
part = part.decode(sys.getfilesystemencoding())
cmd_parts.append(part)
- cmd_desc = ' '.join(cmd_parts)
+ cmd_desc = " ".join(cmd_parts)
if show_stdout:
stdout = None
else:
stdout = subprocess.PIPE
- logger.debug("Running command %s" % cmd_desc)
+ logger.debug("Running command {}".format(cmd_desc))
if extra_env or remove_from_env:
env = os.environ.copy()
if extra_env:
env.update(extra_env)
if remove_from_env:
- for varname in remove_from_env:
- env.pop(varname, None)
+ for var_name in remove_from_env:
+ env.pop(var_name, None)
else:
env = None
try:
proc = subprocess.Popen(
- cmd, stderr=subprocess.STDOUT, stdin=None, stdout=stdout,
- cwd=cwd, env=env)
+ cmd,
+ stderr=subprocess.STDOUT,
+ stdin=None if stdin is None else subprocess.PIPE,
+ stdout=stdout,
+ cwd=cwd,
+ env=env,
+ )
except Exception:
e = sys.exc_info()[1]
- logger.fatal(
- "Error %s while executing command %s" % (e, cmd_desc))
+ logger.fatal("Error {} while executing command {}".format(e, cmd_desc))
raise
all_output = []
if stdout is not None:
- stdout = proc.stdout
+ if stdin is not None:
+ with proc.stdin:
+ proc.stdin.write(stdin)
+
encoding = sys.getdefaultencoding()
fs_encoding = sys.getfilesystemencoding()
- while 1:
- line = stdout.readline()
- try:
- line = line.decode(encoding)
- except UnicodeDecodeError:
- line = line.decode(fs_encoding)
- if not line:
- break
- line = line.rstrip()
- all_output.append(line)
- if filter_stdout:
- level = filter_stdout(line)
- if isinstance(level, tuple):
- level, line = level
- logger.log(level, line)
- if not logger.stdout_level_matches(level):
- logger.show_progress()
- else:
- logger.info(line)
+ with proc.stdout as stdout:
+ while 1:
+ line = stdout.readline()
+ try:
+ line = line.decode(encoding)
+ except UnicodeDecodeError:
+ line = line.decode(fs_encoding)
+ if not line:
+ break
+ line = line.rstrip()
+ all_output.append(line)
+ if filter_stdout:
+ level = filter_stdout(line)
+ if isinstance(level, tuple):
+ level, line = level
+ logger.log(level, line)
+ if not logger.stdout_level_matches(level):
+ logger.show_progress()
+ else:
+ logger.info(line)
else:
- proc.communicate()
+ proc.communicate(stdin)
proc.wait()
if proc.returncode:
- if raise_on_returncode:
+ if raise_on_return_code:
if all_output:
- logger.notify('Complete output from command %s:' % cmd_desc)
- logger.notify('\n'.join(all_output) + '\n----------------------------------------')
- raise OSError(
- "Command %s failed with error code %s"
- % (cmd_desc, proc.returncode))
+ logger.notify("Complete output from command {}:".format(cmd_desc))
+ logger.notify("\n".join(all_output) + "\n----------------------------------------")
+ raise OSError("Command {} failed with error code {}".format(cmd_desc, proc.returncode))
else:
- logger.warn(
- "Command %s had error code %s"
- % (cmd_desc, proc.returncode))
+ logger.warn("Command {} had error code {}".format(cmd_desc, proc.returncode))
+ return all_output
+
+
+def filter_install_output(line):
+ if line.strip().startswith("running"):
+ return Logger.INFO
+ return Logger.DEBUG
+
+
+def find_wheels(projects, search_dirs):
+ """Find wheels from which we can import PROJECTS.
+
+ Scan through SEARCH_DIRS for a wheel for each PROJECT in turn. Return
+ a list of the first wheel found for each PROJECT
+ """
+
+ wheels = []
+
+ # Look through SEARCH_DIRS for the first suitable wheel. Don't bother
+ # about version checking here, as this is simply to get something we can
+ # then use to install the correct version.
+ for project in projects:
+ for dirname in search_dirs:
+ # This relies on only having "universal" wheels available.
+ # The pattern could be tightened to require -py2.py3-none-any.whl.
+ files = glob.glob(os.path.join(dirname, "{}-*.whl".format(project)))
+ if files:
+ versions = list(
+ reversed(
+ sorted(
+ [(tuple(int(i) for i in os.path.basename(f).split("-")[1].split(".")), f) for f in files]
+ )
+ )
+ )
+ if project == "pip" and sys.version_info[0:2] == (3, 4):
+ wheel = next(p for v, p in versions if v <= (19, 1, 1))
+ else:
+ wheel = versions[0][1]
+ wheels.append(wheel)
+ break
+ else:
+ # We're out of luck, so quit with a suitable error
+ logger.fatal("Cannot find a wheel for {}".format(project))
+
+ return wheels
+
+
+def install_wheel(project_names, py_executable, search_dirs=None, download=False):
+ if search_dirs is None:
+ search_dirs_context = virtualenv_support_dirs
+ else:
+
+ @contextlib.contextmanager
+ def search_dirs_context():
+ yield search_dirs
+
+ with search_dirs_context() as search_dirs:
+ _install_wheel_with_search_dir(download, project_names, py_executable, search_dirs)
-def create_environment(home_dir, site_packages=False, clear=False,
- unzip_setuptools=False, use_distribute=False,
- prompt=None, search_dirs=None, never_download=False):
+def _install_wheel_with_search_dir(download, project_names, py_executable, search_dirs):
+ wheels = find_wheels(["setuptools", "pip"], search_dirs)
+ python_path = os.pathsep.join(wheels)
+
+ # PIP_FIND_LINKS uses space as the path separator and thus cannot have paths
+ # with spaces in them. Convert any of those to local file:// URL form.
+ try:
+ from urlparse import urljoin
+ from urllib import pathname2url
+ except ImportError:
+ from urllib.parse import urljoin
+ from urllib.request import pathname2url
+
+ def space_path2url(p):
+ if " " not in p:
+ return p
+ return urljoin("file:", pathname2url(os.path.abspath(p)))
+
+ find_links = " ".join(space_path2url(d) for d in search_dirs)
+
+ extra_args = ["--ignore-installed", "-v"]
+ if DEBUG:
+ extra_args.append("-v")
+
+ config = _pip_config(py_executable, python_path)
+ defined_cert = bool(config.get("install.cert") or config.get(":env:.cert") or config.get("global.cert"))
+
+ script = textwrap.dedent(
+ """
+ import sys
+ import pkgutil
+ import tempfile
+ import os
+
+ defined_cert = {defined_cert}
+
+ try:
+ from pip._internal import main as _main
+ if type(_main) is type(sys): # <type 'module'>
+ _main = _main.main # nested starting in Pip 19.3
+ cert_data = pkgutil.get_data("pip._vendor.certifi", "cacert.pem")
+ except ImportError:
+ from pip import main as _main
+ cert_data = pkgutil.get_data("pip._vendor.requests", "cacert.pem")
+ except IOError:
+ cert_data = None
+
+ if not defined_cert and cert_data is not None:
+ cert_file = tempfile.NamedTemporaryFile(delete=False)
+ cert_file.write(cert_data)
+ cert_file.close()
+ else:
+ cert_file = None
+
+ try:
+ args = ["install"] + [{extra_args}]
+ if cert_file is not None:
+ args += ["--cert", cert_file.name]
+ args += sys.argv[1:]
+
+ sys.exit(_main(args))
+ finally:
+ if cert_file is not None:
+ os.remove(cert_file.name)
+ """.format(
+ defined_cert=defined_cert, extra_args=", ".join(repr(i) for i in extra_args)
+ )
+ ).encode("utf8")
+
+ if sys.version_info[0:2] == (3, 4) and "pip" in project_names:
+ at = project_names.index("pip")
+ project_names[at] = "pip<19.2"
+
+ cmd = [py_executable, "-"] + project_names
+ logger.start_progress("Installing {}...".format(", ".join(project_names)))
+ logger.indent += 2
+
+ env = {
+ "PYTHONPATH": python_path,
+ "PIP_FIND_LINKS": find_links,
+ "PIP_USE_WHEEL": "1",
+ "PIP_ONLY_BINARY": ":all:",
+ "PIP_USER": "0",
+ "PIP_NO_INPUT": "1",
+ }
+
+ if not download:
+ env["PIP_NO_INDEX"] = "1"
+
+ try:
+ call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=script)
+ finally:
+ logger.indent -= 2
+ logger.end_progress()
+
+
+def _pip_config(py_executable, python_path):
+ cmd = [py_executable, "-m", "pip", "config", "list"]
+ config = {}
+ for line in call_subprocess(
+ cmd,
+ show_stdout=False,
+ extra_env={"PYTHONPATH": python_path},
+ remove_from_env=["PIP_VERBOSE", "PIP_QUIET"],
+ raise_on_return_code=False,
+ ):
+ key, _, value = line.partition("=")
+ if value:
+ config[key] = ast.literal_eval(value)
+ return config
+
+
+def create_environment(
+ home_dir,
+ site_packages=False,
+ clear=False,
+ prompt=None,
+ search_dirs=None,
+ download=False,
+ no_setuptools=False,
+ no_pip=False,
+ no_wheel=False,
+ symlink=True,
+):
"""
Creates a new environment in ``home_dir``.
@@ -1024,464 +1158,642 @@
"""
home_dir, lib_dir, inc_dir, bin_dir = path_locations(home_dir)
- py_executable = os.path.abspath(install_python(
- home_dir, lib_dir, inc_dir, bin_dir,
- site_packages=site_packages, clear=clear))
+ py_executable = os.path.abspath(
+ install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages=site_packages, clear=clear, symlink=symlink)
+ )
install_distutils(home_dir)
- # use_distribute also is True if VIRTUALENV_DISTRIBUTE env var is set
- # we also check VIRTUALENV_USE_DISTRIBUTE for backwards compatibility
- if use_distribute or os.environ.get('VIRTUALENV_USE_DISTRIBUTE'):
- install_distribute(py_executable, unzip=unzip_setuptools,
- search_dirs=search_dirs, never_download=never_download)
- else:
- install_setuptools(py_executable, unzip=unzip_setuptools,
- search_dirs=search_dirs, never_download=never_download)
+ to_install = []
+
+ if not no_setuptools:
+ to_install.append("setuptools")
- install_pip(py_executable, search_dirs=search_dirs, never_download=never_download)
+ if not no_pip:
+ to_install.append("pip")
+
+ if not no_wheel:
+ to_install.append("wheel")
+
+ if to_install:
+ install_wheel(to_install, py_executable, search_dirs, download=download)
install_activate(home_dir, bin_dir, prompt)
-def path_locations(home_dir):
+ install_python_config(home_dir, bin_dir, prompt)
+
+
+def is_executable_file(fpath):
+ return os.path.isfile(fpath) and is_executable(fpath)
+
+
+def path_locations(home_dir, dry_run=False):
"""Return the path locations for the environment (where libraries are,
where scripts go, etc)"""
+ home_dir = os.path.abspath(home_dir)
+ lib_dir, inc_dir, bin_dir = None, None, None
# XXX: We'd use distutils.sysconfig.get_python_inc/lib but its
# prefix arg is broken: http://bugs.python.org/issue3386
- if sys.platform == 'win32':
+ if IS_WIN:
# Windows has lots of problems with executables with spaces in
# the name; this function will remove them (using the ~1
# format):
- mkdir(home_dir)
- if ' ' in home_dir:
+ if not dry_run:
+ mkdir(home_dir)
+ if " " in home_dir:
+ import ctypes
+
+ get_short_path_name = ctypes.windll.kernel32.GetShortPathNameW
+ size = max(len(home_dir) + 1, 256)
+ buf = ctypes.create_unicode_buffer(size)
try:
- import win32api
- except ImportError:
- print('Error: the path "%s" has a space in it' % home_dir)
- print('To handle these kinds of paths, the win32api module must be installed:')
- print(' http://sourceforge.net/projects/pywin32/')
+ # noinspection PyUnresolvedReferences
+ u = unicode
+ except NameError:
+ u = str
+ ret = get_short_path_name(u(home_dir), buf, size)
+ if not ret:
+ print('Error: the path "{}" has a space in it'.format(home_dir))
+ print("We could not determine the short pathname for it.")
+ print("Exiting.")
sys.exit(3)
- home_dir = win32api.GetShortPathName(home_dir)
- lib_dir = join(home_dir, 'Lib')
- inc_dir = join(home_dir, 'Include')
- bin_dir = join(home_dir, 'Scripts')
- elif is_jython:
- lib_dir = join(home_dir, 'Lib')
- inc_dir = join(home_dir, 'Include')
- bin_dir = join(home_dir, 'bin')
- elif is_pypy:
+ home_dir = str(buf.value)
+ lib_dir = join(home_dir, "Lib")
+ inc_dir = join(home_dir, "Include")
+ bin_dir = join(home_dir, "Scripts")
+ if IS_PYPY:
lib_dir = home_dir
- inc_dir = join(home_dir, 'include')
- bin_dir = join(home_dir, 'bin')
- else:
- lib_dir = join(home_dir, 'lib', py_version)
- inc_dir = join(home_dir, 'include', py_version + abiflags)
- bin_dir = join(home_dir, 'bin')
+ inc_dir = join(home_dir, "include")
+ bin_dir = join(home_dir, "bin")
+ elif not IS_WIN:
+ lib_dir = join(home_dir, "lib", PY_VERSION)
+ inc_dir = join(home_dir, "include", PY_VERSION + ABI_FLAGS)
+ bin_dir = join(home_dir, "bin")
return home_dir, lib_dir, inc_dir, bin_dir
def change_prefix(filename, dst_prefix):
prefixes = [sys.prefix]
- if sys.platform == "darwin":
- prefixes.extend((
- os.path.join("/Library/Python", sys.version[:3], "site-packages"),
- os.path.join(sys.prefix, "Extras", "lib", "python"),
- os.path.join("~", "Library", "Python", sys.version[:3], "site-packages")))
+ if IS_DARWIN:
+ prefixes.extend(
+ (
+ os.path.join("/Library/Python", VERSION, "site-packages"),
+ os.path.join(sys.prefix, "Extras", "lib", "python"),
+ os.path.join("~", "Library", "Python", VERSION, "site-packages"),
+ # Python 2.6 no-frameworks
+ os.path.join("~", ".local", "lib", "python", VERSION, "site-packages"),
+ # System Python 2.7 on OSX Mountain Lion
+ os.path.join("~", "Library", "Python", VERSION, "lib", "python", "site-packages"),
+ )
+ )
- if hasattr(sys, 'real_prefix'):
+ if hasattr(sys, "real_prefix"):
prefixes.append(sys.real_prefix)
+ if hasattr(sys, "base_prefix"):
+ prefixes.append(sys.base_prefix)
+ prefixes = list(map(os.path.expanduser, prefixes))
prefixes = list(map(os.path.abspath, prefixes))
+ # Check longer prefixes first so we don't split in the middle of a filename
+ prefixes = sorted(prefixes, key=len, reverse=True)
filename = os.path.abspath(filename)
+ # On Windows, make sure drive letter is uppercase
+ if IS_WIN and filename[0] in "abcdefghijklmnopqrstuvwxyz":
+ filename = filename[0].upper() + filename[1:]
+ for i, prefix in enumerate(prefixes):
+ if IS_WIN and prefix[0] in "abcdefghijklmnopqrstuvwxyz":
+ prefixes[i] = prefix[0].upper() + prefix[1:]
for src_prefix in prefixes:
if filename.startswith(src_prefix):
- _, relpath = filename.split(src_prefix, 1)
- assert relpath[0] == os.sep
- relpath = relpath[1:]
- return join(dst_prefix, relpath)
- assert False, "Filename %s does not start with any of these prefixes: %s" % \
- (filename, prefixes)
+ _, relative_path = filename.split(src_prefix, 1)
+ if src_prefix != os.sep: # sys.prefix == "/"
+ assert relative_path[0] == os.sep
+ relative_path = relative_path[1:]
+ return join(dst_prefix, relative_path)
+ raise AssertionError("Filename {} does not start with any of these prefixes: {}".format(filename, prefixes))
+
+
+def find_module_filename(modname):
+
+ if sys.version_info < (3, 4):
+ # noinspection PyDeprecation
+ import imp
+
+ try:
+ file_handler, filepath, _ = imp.find_module(modname)
+ except ImportError:
+ return None
+ else:
+ if file_handler is not None:
+ file_handler.close()
+ return filepath
+ else:
+ import importlib.util
+
+ if sys.version_info < (3, 5):
+
+ def find_spec(modname):
+ # noinspection PyDeprecation
+ loader = importlib.find_loader(modname)
+ if loader is None:
+ return None
+ else:
+ return importlib.util.spec_from_loader(modname, loader)
+
+ else:
+ find_spec = importlib.util.find_spec
+
+ spec = find_spec(modname)
+ if spec is None:
+ return None
+ if not os.path.exists(spec.origin):
+ # https://bitbucket.org/pypy/pypy/issues/2944/origin-for-several-builtin-modules
+ # on pypy3, some builtin modules have a bogus build-time file path, ignore them
+ return None
+ filepath = spec.origin
+ # https://www.python.org/dev/peps/pep-3147/#file guarantee to be non-cached
+ if os.path.basename(filepath) == "__init__.py":
+ filepath = os.path.dirname(filepath)
+ return filepath
+
-def copy_required_modules(dst_prefix):
- import imp
- # If we are running under -p, we need to remove the current
- # directory from sys.path temporarily here, so that we
- # definitely get the modules from the site directory of
- # the interpreter we are running under, not the one
- # virtualenv.py is installed under (which might lead to py2/py3
- # incompatibility issues)
- _prev_sys_path = sys.path
- if os.environ.get('VIRTUALENV_INTERPRETER_RUNNING'):
- sys.path = sys.path[1:]
- try:
- for modname in REQUIRED_MODULES:
- if modname in sys.builtin_module_names:
- logger.info("Ignoring built-in bootstrap module: %s" % modname)
- continue
- try:
- f, filename, _ = imp.find_module(modname)
- except ImportError:
- logger.info("Cannot import bootstrap module: %s" % modname)
+def copy_required_modules(dst_prefix, symlink):
+ for modname in REQUIRED_MODULES:
+ if modname in sys.builtin_module_names:
+ logger.info("Ignoring built-in bootstrap module: %s" % modname)
+ continue
+ filename = find_module_filename(modname)
+ if filename is None:
+ logger.info("Cannot import bootstrap module: %s" % modname)
+ else:
+ # special-case custom readline.so on OS X, but not for pypy:
+ if (
+ modname == "readline"
+ and IS_DARWIN
+ and not (IS_PYPY or filename.endswith(join("lib-dynload", "readline.so")))
+ ):
+ dst_filename = join(dst_prefix, "lib", PY_VERSION, "readline.so")
+ elif modname == "readline" and IS_WIN:
+ # special-case for Windows, where readline is not a standard module, though it may have been installed
+ # in site-packages by a third-party package
+ dst_filename = None
else:
- if f is not None:
- f.close()
dst_filename = change_prefix(filename, dst_prefix)
- copyfile(filename, dst_filename)
- if filename.endswith('.pyc'):
- pyfile = filename[:-1]
- if os.path.exists(pyfile):
- copyfile(pyfile, dst_filename[:-1])
- finally:
- sys.path = _prev_sys_path
+ if dst_filename is not None:
+ copyfile(filename, dst_filename, symlink)
+ if filename.endswith(".pyc"):
+ py_file = filename[:-1]
+ if os.path.exists(py_file):
+ copyfile(py_file, dst_filename[:-1], symlink)
+
+
+def copy_required_files(src_dir, lib_dir, symlink):
+ if not os.path.isdir(src_dir):
+ return
+ for fn in os.listdir(src_dir):
+ bn = os.path.splitext(fn)[0]
+ if fn != "site-packages" and bn in REQUIRED_FILES:
+ copyfile(join(src_dir, fn), join(lib_dir, fn), symlink)
+
+
+def copy_license(prefix, dst_prefix, lib_dir, symlink):
+ """Copy the license file so `license()` builtin works"""
+ lib64_dir = lib_dir.replace("lib", "lib64")
+ for license_path in (
+ # posix cpython
+ os.path.join(prefix, os.path.relpath(lib_dir, dst_prefix), "LICENSE.txt"),
+ # posix cpython installed in /usr/lib64
+ os.path.join(prefix, os.path.relpath(lib64_dir, dst_prefix), "LICENSE.txt"),
+ # windows cpython
+ os.path.join(prefix, "LICENSE.txt"),
+ # pypy
+ os.path.join(prefix, "LICENSE"),
+ ):
+ if os.path.exists(license_path):
+ dest = subst_path(license_path, prefix, dst_prefix)
+ copyfile(license_path, dest, symlink)
+ return
+ logger.warn("No LICENSE.txt / LICENSE found in source")
-def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear):
+
+def copy_include_dir(include_src, include_dest, symlink):
+ """Copy headers from *include_src* to *include_dest* symlinking if required"""
+ if not os.path.isdir(include_src):
+ return
+ # PyPy headers are located in ``pypy-dir/include`` and following code
+ # avoids making ``venv-dir/include`` symlink to it
+ if IS_PYPY:
+ for fn in os.listdir(include_src):
+ copyfile(join(include_src, fn), join(include_dest, fn), symlink)
+ else:
+ copyfile(include_src, include_dest, symlink)
+
+
+def copy_tcltk(src, dest, symlink):
+ """ copy tcl/tk libraries on Windows (issue #93) """
+ for lib_version in "8.5", "8.6":
+ for libname in "tcl", "tk":
+ src_dir = join(src, "tcl", libname + lib_version)
+ dest_dir = join(dest, "tcl", libname + lib_version)
+ # Only copy the dirs from the above combinations that exist
+ if os.path.exists(src_dir) and not os.path.exists(dest_dir):
+ copy_file_or_folder(src_dir, dest_dir, symlink)
+
+
+def subst_path(prefix_path, prefix, home_dir):
+ prefix_path = os.path.normpath(prefix_path)
+ prefix = os.path.normpath(prefix)
+ home_dir = os.path.normpath(home_dir)
+ if not prefix_path.startswith(prefix):
+ logger.warn("Path not in prefix %r %r", prefix_path, prefix)
+ return
+ return prefix_path.replace(prefix, home_dir, 1)
+
+
+def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear, symlink=True):
"""Install just the base environment, no distutils patches etc"""
if sys.executable.startswith(bin_dir):
- print('Please use the *system* python to run this script')
+ print("Please use the *system* python to run this script")
return
if clear:
- rmtree(lib_dir)
- ## FIXME: why not delete it?
- ## Maybe it should delete everything with #!/path/to/venv/python in it
- logger.notify('Not deleting %s', bin_dir)
+ rm_tree(lib_dir)
+ # FIXME: why not delete it?
+ # Maybe it should delete everything with #!/path/to/venv/python in it
+ logger.notify("Not deleting %s", bin_dir)
- if hasattr(sys, 'real_prefix'):
- logger.notify('Using real prefix %r' % sys.real_prefix)
+ if hasattr(sys, "real_prefix"):
+ logger.notify("Using real prefix %r", sys.real_prefix)
prefix = sys.real_prefix
+ elif hasattr(sys, "base_prefix"):
+ logger.notify("Using base prefix %r", sys.base_prefix)
+ prefix = sys.base_prefix
else:
prefix = sys.prefix
+ prefix = os.path.abspath(prefix)
mkdir(lib_dir)
- fix_lib64(lib_dir)
+ fix_lib64(lib_dir, symlink)
stdlib_dirs = [os.path.dirname(os.__file__)]
- if sys.platform == 'win32':
- stdlib_dirs.append(join(os.path.dirname(stdlib_dirs[0]), 'DLLs'))
- elif sys.platform == 'darwin':
- stdlib_dirs.append(join(stdlib_dirs[0], 'site-packages'))
- if hasattr(os, 'symlink'):
- logger.info('Symlinking Python bootstrap modules')
+ if IS_WIN:
+ stdlib_dirs.append(join(os.path.dirname(stdlib_dirs[0]), "DLLs"))
+ elif IS_DARWIN:
+ stdlib_dirs.append(join(stdlib_dirs[0], "site-packages"))
+ if hasattr(os, "symlink"):
+ logger.info("Symlinking Python bootstrap modules")
else:
- logger.info('Copying Python bootstrap modules')
+ logger.info("Copying Python bootstrap modules")
logger.indent += 2
try:
# copy required files...
for stdlib_dir in stdlib_dirs:
- if not os.path.isdir(stdlib_dir):
- continue
- for fn in os.listdir(stdlib_dir):
- bn = os.path.splitext(fn)[0]
- if fn != 'site-packages' and bn in REQUIRED_FILES:
- copyfile(join(stdlib_dir, fn), join(lib_dir, fn))
+ copy_required_files(stdlib_dir, lib_dir, symlink)
# ...and modules
- copy_required_modules(home_dir)
+ copy_required_modules(home_dir, symlink)
+ copy_license(prefix, home_dir, lib_dir, symlink)
finally:
logger.indent -= 2
- mkdir(join(lib_dir, 'site-packages'))
+ # ...copy tcl/tk
+ if IS_WIN:
+ copy_tcltk(prefix, home_dir, symlink)
+ mkdir(join(lib_dir, "site-packages"))
import site
+
site_filename = site.__file__
- if site_filename.endswith('.pyc'):
+ if site_filename.endswith(".pyc") or site_filename.endswith(".pyo"):
site_filename = site_filename[:-1]
- elif site_filename.endswith('$py.class'):
- site_filename = site_filename.replace('$py.class', '.py')
+ elif site_filename.endswith("$py.class"):
+ site_filename = site_filename.replace("$py.class", ".py")
site_filename_dst = change_prefix(site_filename, home_dir)
site_dir = os.path.dirname(site_filename_dst)
writefile(site_filename_dst, SITE_PY)
- writefile(join(site_dir, 'orig-prefix.txt'), prefix)
- site_packages_filename = join(site_dir, 'no-global-site-packages.txt')
+ writefile(join(site_dir, "orig-prefix.txt"), prefix)
+ site_packages_filename = join(site_dir, "no-global-site-packages.txt")
if not site_packages:
- writefile(site_packages_filename, '')
+ writefile(site_packages_filename, "")
+
+ if IS_PYPY or IS_WIN:
+ standard_lib_include_dir = join(prefix, "include")
else:
- if os.path.exists(site_packages_filename):
- logger.info('Deleting %s' % site_packages_filename)
- os.unlink(site_packages_filename)
+ standard_lib_include_dir = join(prefix, "include", PY_VERSION + ABI_FLAGS)
+ if os.path.exists(standard_lib_include_dir):
+ copy_include_dir(standard_lib_include_dir, inc_dir, symlink)
+ else:
+ logger.debug("No include dir %s", standard_lib_include_dir)
- if is_pypy or is_win:
- stdinc_dir = join(prefix, 'include')
- else:
- stdinc_dir = join(prefix, 'include', py_version + abiflags)
- if os.path.exists(stdinc_dir):
- copyfile(stdinc_dir, inc_dir)
- else:
- logger.debug('No include dir %s' % stdinc_dir)
+ platform_include_dir = distutils.sysconfig.get_python_inc(plat_specific=1)
+ if platform_include_dir != standard_lib_include_dir:
+ platform_include_dest = distutils.sysconfig.get_python_inc(plat_specific=1, prefix=home_dir)
+ if platform_include_dir == platform_include_dest:
+ # Do platinc_dest manually due to a CPython bug;
+ # not http://bugs.python.org/issue3386 but a close cousin
+ platform_include_dest = subst_path(platform_include_dir, prefix, home_dir)
+ if platform_include_dest:
+ # PyPy's stdinc_dir and prefix are relative to the original binary
+ # (traversing virtualenvs), whereas the platinc_dir is relative to
+ # the inner virtualenv and ignores the prefix argument.
+ # This seems more evolved than designed.
+ copy_include_dir(platform_include_dir, platform_include_dest, symlink)
# pypy never uses exec_prefix, just ignore it
- if sys.exec_prefix != prefix and not is_pypy:
- if sys.platform == 'win32':
- exec_dir = join(sys.exec_prefix, 'lib')
- elif is_jython:
- exec_dir = join(sys.exec_prefix, 'Lib')
+ if os.path.realpath(sys.exec_prefix) != os.path.realpath(prefix) and not IS_PYPY:
+ if IS_WIN:
+ exec_dir = join(sys.exec_prefix, "lib")
else:
- exec_dir = join(sys.exec_prefix, 'lib', py_version)
- for fn in os.listdir(exec_dir):
- copyfile(join(exec_dir, fn), join(lib_dir, fn))
-
- if is_jython:
- # Jython has either jython-dev.jar and javalib/ dir, or just
- # jython.jar
- for name in 'jython-dev.jar', 'javalib', 'jython.jar':
- src = join(prefix, name)
- if os.path.exists(src):
- copyfile(src, join(home_dir, name))
- # XXX: registry should always exist after Jython 2.5rc1
- src = join(prefix, 'registry')
- if os.path.exists(src):
- copyfile(src, join(home_dir, 'registry'), symlink=False)
- copyfile(join(prefix, 'cachedir'), join(home_dir, 'cachedir'),
- symlink=False)
+ exec_dir = join(sys.exec_prefix, "lib", PY_VERSION)
+ copy_required_files(exec_dir, lib_dir, symlink)
mkdir(bin_dir)
py_executable = join(bin_dir, os.path.basename(sys.executable))
- if 'Python.framework' in prefix:
- if re.search(r'/Python(?:-32|-64)*$', py_executable):
+ if "Python.framework" in prefix or "Python3.framework" in prefix:
+ # OS X framework builds cause validation to break
+ # https://github.com/pypa/virtualenv/issues/322
+ if os.environ.get("__PYVENV_LAUNCHER__"):
+ del os.environ["__PYVENV_LAUNCHER__"]
+ if re.search(r"/Python(?:-32|-64)*$", py_executable):
# The name of the python executable is not quite what
# we want, rename it.
- py_executable = os.path.join(
- os.path.dirname(py_executable), 'python')
+ py_executable = os.path.join(os.path.dirname(py_executable), "python")
- logger.notify('New %s executable in %s', expected_exe, py_executable)
- pcbuild_dir = os.path.dirname(sys.executable)
- pyd_pth = os.path.join(lib_dir, 'site-packages', 'virtualenv_builddir_pyd.pth')
- if is_win and os.path.exists(os.path.join(pcbuild_dir, 'build.bat')):
- logger.notify('Detected python running from build directory %s', pcbuild_dir)
- logger.notify('Writing .pth file linking to build directory for *.pyd files')
- writefile(pyd_pth, pcbuild_dir)
+ logger.notify("New %s executable in %s", EXPECTED_EXE, py_executable)
+ pc_build_dir = os.path.dirname(sys.executable)
+ pyd_pth = os.path.join(lib_dir, "site-packages", "virtualenv_builddir_pyd.pth")
+ if IS_WIN and os.path.exists(os.path.join(pc_build_dir, "build.bat")):
+ logger.notify("Detected python running from build directory %s", pc_build_dir)
+ logger.notify("Writing .pth file linking to build directory for *.pyd files")
+ writefile(pyd_pth, pc_build_dir)
else:
- pcbuild_dir = None
if os.path.exists(pyd_pth):
- logger.info('Deleting %s (not Windows env or not build directory python)' % pyd_pth)
+ logger.info("Deleting %s (not Windows env or not build directory python)", pyd_pth)
os.unlink(pyd_pth)
-
+
if sys.executable != py_executable:
- ## FIXME: could I just hard link?
+ # FIXME: could I just hard link?
executable = sys.executable
- if sys.platform == 'cygwin' and os.path.exists(executable + '.exe'):
- # Cygwin misreports sys.executable sometimes
- executable += '.exe'
- py_executable += '.exe'
- logger.info('Executable actually exists in %s' % executable)
shutil.copyfile(executable, py_executable)
make_exe(py_executable)
- if sys.platform == 'win32' or sys.platform == 'cygwin':
- pythonw = os.path.join(os.path.dirname(sys.executable), 'pythonw.exe')
- if os.path.exists(pythonw):
- logger.info('Also created pythonw.exe')
- shutil.copyfile(pythonw, os.path.join(os.path.dirname(py_executable), 'pythonw.exe'))
- python_d = os.path.join(os.path.dirname(sys.executable), 'python_d.exe')
- python_d_dest = os.path.join(os.path.dirname(py_executable), 'python_d.exe')
+ if IS_WIN or IS_CYGWIN:
+ python_w = os.path.join(os.path.dirname(sys.executable), "pythonw.exe")
+ if os.path.exists(python_w):
+ logger.info("Also created pythonw.exe")
+ shutil.copyfile(python_w, os.path.join(os.path.dirname(py_executable), "pythonw.exe"))
+ python_d = os.path.join(os.path.dirname(sys.executable), "python_d.exe")
+ python_d_dest = os.path.join(os.path.dirname(py_executable), "python_d.exe")
if os.path.exists(python_d):
- logger.info('Also created python_d.exe')
+ logger.info("Also created python_d.exe")
shutil.copyfile(python_d, python_d_dest)
elif os.path.exists(python_d_dest):
- logger.info('Removed python_d.exe as it is no longer at the source')
+ logger.info("Removed python_d.exe as it is no longer at the source")
os.unlink(python_d_dest)
+
# we need to copy the DLL to enforce that windows will load the correct one.
# may not exist if we are cygwin.
- py_executable_dll = 'python%s%s.dll' % (
- sys.version_info[0], sys.version_info[1])
- py_executable_dll_d = 'python%s%s_d.dll' % (
- sys.version_info[0], sys.version_info[1])
- pythondll = os.path.join(os.path.dirname(sys.executable), py_executable_dll)
- pythondll_d = os.path.join(os.path.dirname(sys.executable), py_executable_dll_d)
- pythondll_d_dest = os.path.join(os.path.dirname(py_executable), py_executable_dll_d)
- if os.path.exists(pythondll):
- logger.info('Also created %s' % py_executable_dll)
- shutil.copyfile(pythondll, os.path.join(os.path.dirname(py_executable), py_executable_dll))
- if os.path.exists(pythondll_d):
- logger.info('Also created %s' % py_executable_dll_d)
- shutil.copyfile(pythondll_d, pythondll_d_dest)
- elif os.path.exists(pythondll_d_dest):
- logger.info('Removed %s as the source does not exist' % pythondll_d_dest)
- os.unlink(pythondll_d_dest)
- if is_pypy:
+ if IS_PYPY:
+ py_executable_dll_s = [("libpypy-c.dll", "libpypy_d-c.dll")]
+ else:
+ py_executable_dll_s = [
+ ("python{}.dll".format(sys.version_info[0]), "python{}_d.dll".format(sys.version_info[0])),
+ (
+ "python{}{}.dll".format(sys.version_info[0], sys.version_info[1]),
+ "python{}{}_d.dll".format(sys.version_info[0], sys.version_info[1]),
+ ),
+ ]
+
+ for py_executable_dll, py_executable_dll_d in py_executable_dll_s:
+ python_dll = os.path.join(os.path.dirname(sys.executable), py_executable_dll)
+ python_dll_d = os.path.join(os.path.dirname(sys.executable), py_executable_dll_d)
+ python_dll_d_dest = os.path.join(os.path.dirname(py_executable), py_executable_dll_d)
+ if os.path.exists(python_dll):
+ logger.info("Also created %s", py_executable_dll)
+ shutil.copyfile(python_dll, os.path.join(os.path.dirname(py_executable), py_executable_dll))
+ if os.path.exists(python_dll_d):
+ logger.info("Also created %s", py_executable_dll_d)
+ shutil.copyfile(python_dll_d, python_dll_d_dest)
+ elif os.path.exists(python_dll_d_dest):
+ logger.info("Removed %s as the source does not exist", python_dll_d_dest)
+ os.unlink(python_dll_d_dest)
+ if IS_PYPY:
# make a symlink python --> pypy-c
- python_executable = os.path.join(os.path.dirname(py_executable), 'python')
- logger.info('Also created executable %s' % python_executable)
- copyfile(py_executable, python_executable)
+ python_executable = os.path.join(os.path.dirname(py_executable), "python")
+ if IS_WIN or IS_CYGWIN:
+ python_executable += ".exe"
+ logger.info("Also created executable %s", python_executable)
+ copyfile(py_executable, python_executable, symlink)
+
+ if IS_WIN:
+ for name in ["libexpat.dll", "libeay32.dll", "ssleay32.dll", "sqlite3.dll", "tcl85.dll", "tk85.dll"]:
+ src = join(prefix, name)
+ if os.path.exists(src):
+ copyfile(src, join(bin_dir, name), symlink)
- if os.path.splitext(os.path.basename(py_executable))[0] != expected_exe:
- secondary_exe = os.path.join(os.path.dirname(py_executable),
- expected_exe)
+ for d in sys.path:
+ if d.endswith("lib_pypy"):
+ break
+ else:
+ logger.fatal("Could not find lib_pypy in sys.path")
+ raise SystemExit(3)
+ logger.info("Copying lib_pypy")
+ copyfile(d, os.path.join(home_dir, "lib_pypy"), symlink)
+
+ if os.path.splitext(os.path.basename(py_executable))[0] != EXPECTED_EXE:
+ secondary_exe = os.path.join(os.path.dirname(py_executable), EXPECTED_EXE)
py_executable_ext = os.path.splitext(py_executable)[1]
- if py_executable_ext == '.exe':
+ if py_executable_ext.lower() == ".exe":
# python2.4 gives an extension of '.4' :P
secondary_exe += py_executable_ext
if os.path.exists(secondary_exe):
- logger.warn('Not overwriting existing %s script %s (you must use %s)'
- % (expected_exe, secondary_exe, py_executable))
+ logger.warn(
+ "Not overwriting existing {} script {} (you must use {})".format(
+ EXPECTED_EXE, secondary_exe, py_executable
+ )
+ )
else:
- logger.notify('Also creating executable in %s' % secondary_exe)
+ logger.notify("Also creating executable in %s", secondary_exe)
shutil.copyfile(sys.executable, secondary_exe)
make_exe(secondary_exe)
- if '.framework' in prefix:
- if 'Python.framework' in prefix:
- logger.debug('MacOSX Python framework detected')
- # Make sure we use the the embedded interpreter inside
+ if ".framework" in prefix:
+ original_python = None
+ if "Python.framework" in prefix or "Python3.framework" in prefix:
+ logger.debug("MacOSX Python framework detected")
+ # Make sure we use the embedded interpreter inside
# the framework, even if sys.executable points to
# the stub executable in ${sys.prefix}/bin
# See http://groups.google.com/group/python-virtualenv/
# browse_thread/thread/17cab2f85da75951
- original_python = os.path.join(
- prefix, 'Resources/Python.app/Contents/MacOS/Python')
- if 'EPD' in prefix:
- logger.debug('EPD framework detected')
- original_python = os.path.join(prefix, 'bin/python')
+ original_python = os.path.join(prefix, "Resources/Python.app/Contents/MacOS/Python")
+ if "EPD" in prefix:
+ logger.debug("EPD framework detected")
+ original_python = os.path.join(prefix, "bin/python")
shutil.copy(original_python, py_executable)
# Copy the framework's dylib into the virtual
# environment
- virtual_lib = os.path.join(home_dir, '.Python')
+ virtual_lib = os.path.join(home_dir, ".Python")
if os.path.exists(virtual_lib):
os.unlink(virtual_lib)
- copyfile(
- os.path.join(prefix, 'Python'),
- virtual_lib)
+ lib_name = "Python3" if "Python3.framework" in prefix else "Python"
+ copyfile(os.path.join(prefix, lib_name), virtual_lib, symlink)
# And then change the install_name of the copied python executable
+ search = (
+ "@executable_path/../../../../Python3" if "Python3.framework" in prefix else os.path.join(prefix, lib_name)
+ )
+ # noinspection PyBroadException
try:
- call_subprocess(
- ["install_name_tool", "-change",
- os.path.join(prefix, 'Python'),
- '@executable_path/../.Python',
- py_executable])
- except:
- logger.fatal(
- "Could not call install_name_tool -- you must have Apple's development tools installed")
- raise
+ mach_o_change(py_executable, search, "@executable_path/../.Python")
+ except Exception:
+ e = sys.exc_info()[1]
+ logger.warn("Could not call mach_o_change: %s. " "Trying to call install_name_tool instead.", e)
+ try:
+ call_subprocess(["install_name_tool", "-change", search, "@executable_path/../.Python", py_executable])
+ except Exception:
+ logger.fatal("Could not call install_name_tool -- you must " "have Apple's development tools installed")
+ raise
+
+ if not IS_WIN:
+ # Ensure that 'python', 'pythonX' and 'pythonX.Y' all exist
+ py_exe_version_major = "python{}".format(sys.version_info[0])
+ py_exe_version_major_minor = "python{}.{}".format(sys.version_info[0], sys.version_info[1])
+ py_exe_no_version = "python"
+ required_symlinks = [py_exe_no_version, py_exe_version_major, py_exe_version_major_minor]
- # Some tools depend on pythonX.Y being present
- py_executable_version = '%s.%s' % (
- sys.version_info[0], sys.version_info[1])
- if not py_executable.endswith(py_executable_version):
- # symlinking pythonX.Y > python
- pth = py_executable + '%s.%s' % (
- sys.version_info[0], sys.version_info[1])
- if os.path.exists(pth):
- os.unlink(pth)
- os.symlink('python', pth)
- else:
- # reverse symlinking python -> pythonX.Y (with --python)
- pth = join(bin_dir, 'python')
- if os.path.exists(pth):
- os.unlink(pth)
- os.symlink(os.path.basename(py_executable), pth)
+ py_executable_base = os.path.basename(py_executable)
+
+ if py_executable_base in required_symlinks:
+ # Don't try to symlink to yourself.
+ required_symlinks.remove(py_executable_base)
- if sys.platform == 'win32' and ' ' in py_executable:
- # There's a bug with subprocess on Windows when using a first
- # argument that has a space in it. Instead we have to quote
- # the value:
- py_executable = '"%s"' % py_executable
- cmd = [py_executable, '-c', """
-import sys
-prefix = sys.prefix
-if sys.version_info[0] == 3:
- prefix = prefix.encode('utf8')
-if hasattr(sys.stdout, 'detach'):
- sys.stdout = sys.stdout.detach()
-elif hasattr(sys.stdout, 'buffer'):
- sys.stdout = sys.stdout.buffer
-sys.stdout.write(prefix)
-"""]
- logger.info('Testing executable with %s %s "%s"' % tuple(cmd))
+ for pth in required_symlinks:
+ full_pth = join(bin_dir, pth)
+ if os.path.exists(full_pth):
+ os.unlink(full_pth)
+ if symlink:
+ os.symlink(py_executable_base, full_pth)
+ else:
+ copyfile(py_executable, full_pth, symlink)
+
+ cmd = [
+ py_executable,
+ "-c",
+ "import sys;out=sys.stdout;" 'getattr(out, "buffer", out).write(sys.prefix.encode("utf-8"))',
+ ]
+ logger.info('Testing executable with %s %s "%s"', *cmd)
try:
- proc = subprocess.Popen(cmd,
- stdout=subprocess.PIPE)
+ proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
proc_stdout, proc_stderr = proc.communicate()
except OSError:
e = sys.exc_info()[1]
if e.errno == errno.EACCES:
- logger.fatal('ERROR: The executable %s could not be run: %s' % (py_executable, e))
+ logger.fatal("ERROR: The executable {} could not be run: {}".format(py_executable, e))
sys.exit(100)
else:
- raise e
+ raise e
proc_stdout = proc_stdout.strip().decode("utf-8")
- proc_stdout = os.path.normcase(os.path.abspath(proc_stdout))
- norm_home_dir = os.path.normcase(os.path.abspath(home_dir))
- if hasattr(norm_home_dir, 'decode'):
+ # normalize paths using realpath to ensure that a virtualenv correctly identifies itself even
+ # when addressed over a symlink
+ proc_stdout = os.path.normcase(os.path.realpath(proc_stdout))
+ norm_home_dir = os.path.normcase(os.path.realpath(home_dir))
+ if hasattr(norm_home_dir, "decode"):
norm_home_dir = norm_home_dir.decode(sys.getfilesystemencoding())
if proc_stdout != norm_home_dir:
- logger.fatal(
- 'ERROR: The executable %s is not functioning' % py_executable)
- logger.fatal(
- 'ERROR: It thinks sys.prefix is %r (should be %r)'
- % (proc_stdout, norm_home_dir))
- logger.fatal(
- 'ERROR: virtualenv is not compatible with this system or executable')
- if sys.platform == 'win32':
+ logger.fatal("ERROR: The executable %s is not functioning", py_executable)
+ logger.fatal("ERROR: It thinks sys.prefix is {!r} (should be {!r})".format(proc_stdout, norm_home_dir))
+ logger.fatal("ERROR: virtualenv is not compatible with this system or executable")
+ if IS_WIN:
logger.fatal(
- 'Note: some Windows users have reported this error when they '
+ "Note: some Windows users have reported this error when they "
'installed Python for "Only this user" or have multiple '
- 'versions of Python installed. Copying the appropriate '
- 'PythonXX.dll to the virtualenv Scripts/ directory may fix '
- 'this problem.')
+ "versions of Python installed. Copying the appropriate "
+ "PythonXX.dll to the virtualenv Scripts/ directory may fix "
+ "this problem."
+ )
sys.exit(100)
else:
- logger.info('Got sys.prefix result: %r' % proc_stdout)
+ logger.info("Got sys.prefix result: %r", proc_stdout)
- pydistutils = os.path.expanduser('~/.pydistutils.cfg')
+ pydistutils = os.path.expanduser("~/.pydistutils.cfg")
if os.path.exists(pydistutils):
- logger.notify('Please make sure you remove any previous custom paths from '
- 'your %s file.' % pydistutils)
- ## FIXME: really this should be calculated earlier
+ logger.notify("Please make sure you remove any previous custom paths from " "your %s file.", pydistutils)
+ # FIXME: really this should be calculated earlier
+
+ fix_local_scheme(home_dir, symlink)
- fix_local_scheme(home_dir)
+ if site_packages:
+ if os.path.exists(site_packages_filename):
+ logger.info("Deleting %s", site_packages_filename)
+ os.unlink(site_packages_filename)
return py_executable
+
def install_activate(home_dir, bin_dir, prompt=None):
- home_dir = os.path.abspath(home_dir)
- if sys.platform == 'win32' or is_jython and os._name == 'nt':
- files = {
- 'activate.bat': ACTIVATE_BAT,
- 'deactivate.bat': DEACTIVATE_BAT,
- 'activate.ps1': ACTIVATE_PS,
- }
+ if IS_WIN:
+ files = {"activate.bat": ACTIVATE_BAT, "deactivate.bat": DEACTIVATE_BAT, "activate.ps1": ACTIVATE_PS}
# MSYS needs paths of the form /c/path/to/file
- drive, tail = os.path.splitdrive(home_dir.replace(os.sep, '/'))
- home_dir_msys = (drive and "/%s%s" or "%s%s") % (drive[:1], tail)
+ drive, tail = os.path.splitdrive(home_dir.replace(os.sep, "/"))
+ home_dir_msys = (drive and "/{}{}" or "{}{}").format(drive[:1], tail)
# Run-time conditional enables (basic) Cygwin compatibility
- home_dir_sh = ("""$(if [ "$OSTYPE" "==" "cygwin" ]; then cygpath -u '%s'; else echo '%s'; fi;)""" %
- (home_dir, home_dir_msys))
- files['activate'] = ACTIVATE_SH.replace('__VIRTUAL_ENV__', home_dir_sh)
+ home_dir_sh = """$(if [ "$OSTYPE" "==" "cygwin" ]; then cygpath -u '{}'; else echo '{}'; fi;)""".format(
+ home_dir, home_dir_msys
+ )
+ files["activate"] = ACTIVATE_SH.replace("__VIRTUAL_ENV__", home_dir_sh)
else:
- files = {'activate': ACTIVATE_SH}
+ files = {
+ "activate": ACTIVATE_SH,
+ "activate.fish": ACTIVATE_FISH,
+ "activate.csh": ACTIVATE_CSH,
+ "activate.ps1": ACTIVATE_PS,
+ }
+ files["activate_this.py"] = ACTIVATE_THIS
- # suppling activate.fish in addition to, not instead of, the
- # bash script support.
- files['activate.fish'] = ACTIVATE_FISH
+ if sys.version_info >= (3, 4):
+ # Add xonsh support
+ files["activate.xsh"] = ACTIVATE_XSH
- # same for csh/tcsh support...
- files['activate.csh'] = ACTIVATE_CSH
+ install_files(home_dir, bin_dir, prompt, files)
+
- files['activate_this.py'] = ACTIVATE_THIS
- if hasattr(home_dir, 'decode'):
+def install_files(home_dir, bin_dir, prompt, files):
+ if hasattr(home_dir, "decode"):
home_dir = home_dir.decode(sys.getfilesystemencoding())
- vname = os.path.basename(home_dir)
+ virtualenv_name = os.path.basename(home_dir)
for name, content in files.items():
- content = content.replace('__VIRTUAL_PROMPT__', prompt or '')
- content = content.replace('__VIRTUAL_WINPROMPT__', prompt or '(%s)' % vname)
- content = content.replace('__VIRTUAL_ENV__', home_dir)
- content = content.replace('__VIRTUAL_NAME__', vname)
- content = content.replace('__BIN_NAME__', os.path.basename(bin_dir))
+ content = content.replace("__VIRTUAL_PROMPT__", prompt or "")
+ content = content.replace("__VIRTUAL_WINPROMPT__", prompt or "({}) ".format(virtualenv_name))
+ content = content.replace("__VIRTUAL_ENV__", home_dir)
+ content = content.replace("__VIRTUAL_NAME__", virtualenv_name)
+ content = content.replace("__BIN_NAME__", os.path.basename(bin_dir))
+ content = content.replace("__PATH_SEP__", os.pathsep)
writefile(os.path.join(bin_dir, name), content)
+
+def install_python_config(home_dir, bin_dir, prompt=None):
+ if IS_WIN:
+ files = {}
+ else:
+ files = {"python-config": PYTHON_CONFIG}
+ install_files(home_dir, bin_dir, prompt, files)
+ for name, _ in files.items():
+ make_exe(os.path.join(bin_dir, name))
+
+
def install_distutils(home_dir):
distutils_path = change_prefix(distutils.__path__[0], home_dir)
mkdir(distutils_path)
- ## FIXME: maybe this prefix setting should only be put in place if
- ## there's a local distutils.cfg with a prefix setting?
- home_dir = os.path.abspath(home_dir)
- ## FIXME: this is breaking things, removing for now:
- #distutils_cfg = DISTUTILS_CFG + "\n[install]\nprefix=%s\n" % home_dir
- writefile(os.path.join(distutils_path, '__init__.py'), DISTUTILS_INIT)
- writefile(os.path.join(distutils_path, 'distutils.cfg'), DISTUTILS_CFG, overwrite=False)
+ # FIXME: maybe this prefix setting should only be put in place if
+ # there's a local distutils.cfg with a prefix setting?
+ # FIXME: this is breaking things, removing for now:
+ # distutils_cfg = DISTUTILS_CFG + "\n[install]\nprefix=%s\n" home_dir
+ writefile(os.path.join(distutils_path, "__init__.py"), DISTUTILS_INIT)
+ writefile(os.path.join(distutils_path, "distutils.cfg"), DISTUTILS_CFG, overwrite=False)
-def fix_local_scheme(home_dir):
+
+def fix_local_scheme(home_dir, symlink=True):
"""
Platforms that use the "posix_local" install scheme (like Ubuntu with
Python 2.7) need to be given an additional "local" location, sigh.
@@ -1491,183 +1803,240 @@
except ImportError:
pass
else:
- if sysconfig._get_default_scheme() == 'posix_local':
- local_path = os.path.join(home_dir, 'local')
+ # noinspection PyProtectedMember
+ if sysconfig._get_default_scheme() == "posix_local":
+ local_path = os.path.join(home_dir, "local")
if not os.path.exists(local_path):
os.mkdir(local_path)
for subdir_name in os.listdir(home_dir):
- if subdir_name == 'local':
+ if subdir_name == "local":
continue
- os.symlink(os.path.abspath(os.path.join(home_dir, subdir_name)), \
- os.path.join(local_path, subdir_name))
+ copyfile(
+ os.path.abspath(os.path.join(home_dir, subdir_name)),
+ os.path.join(local_path, subdir_name),
+ symlink,
+ )
-def fix_lib64(lib_dir):
+
+def fix_lib64(lib_dir, symlink=True):
"""
Some platforms (particularly Gentoo on x64) put things in lib64/pythonX.Y
instead of lib/pythonX.Y. If this is such a platform we'll just create a
symlink so lib64 points to lib
"""
- if [p for p in distutils.sysconfig.get_config_vars().values()
- if isinstance(p, basestring) and 'lib64' in p]:
- logger.debug('This system uses lib64; symlinking lib64 to lib')
- assert os.path.basename(lib_dir) == 'python%s' % sys.version[:3], (
- "Unexpected python lib dir: %r" % lib_dir)
- lib_parent = os.path.dirname(lib_dir)
- assert os.path.basename(lib_parent) == 'lib', (
- "Unexpected parent dir: %r" % lib_parent)
- copyfile(lib_parent, os.path.join(os.path.dirname(lib_parent), 'lib64'))
+ # PyPy's library path scheme is not affected by this.
+ # Return early or we will die on the following assert.
+ if IS_PYPY:
+ logger.debug("PyPy detected, skipping lib64 symlinking")
+ return
+ # Check we have a lib64 library path
+ if not [p for p in distutils.sysconfig.get_config_vars().values() if isinstance(p, basestring) and "lib64" in p]:
+ return
+
+ logger.debug("This system uses lib64; symlinking lib64 to lib")
+
+ assert os.path.basename(lib_dir) == PY_VERSION, "Unexpected python lib dir: {!r}".format(lib_dir)
+ lib_parent = os.path.dirname(lib_dir)
+ top_level = os.path.dirname(lib_parent)
+ lib_dir = os.path.join(top_level, "lib")
+ lib64_link = os.path.join(top_level, "lib64")
+ assert os.path.basename(lib_parent) == "lib", "Unexpected parent dir: {!r}".format(lib_parent)
+ if os.path.lexists(lib64_link):
+ return
+ if symlink:
+ os.symlink("lib", lib64_link)
+ else:
+ copyfile(lib_dir, lib64_link, symlink=False)
+
def resolve_interpreter(exe):
"""
If the executable given isn't an absolute path, search $PATH for the interpreter
"""
+ # If the "executable" is a version number, get the installed executable for
+ # that version
+ orig_exe = exe
+ python_versions = get_installed_pythons()
+ if exe in python_versions:
+ exe = python_versions[exe]
+
if os.path.abspath(exe) != exe:
- paths = os.environ.get('PATH', '').split(os.pathsep)
- for path in paths:
- if os.path.exists(os.path.join(path, exe)):
- exe = os.path.join(path, exe)
- break
+ exe = distutils.spawn.find_executable(exe) or exe
if not os.path.exists(exe):
- logger.fatal('The executable %s (from --python=%s) does not exist' % (exe, exe))
+ logger.fatal("The path {} (from --python={}) does not exist".format(exe, orig_exe))
raise SystemExit(3)
if not is_executable(exe):
- logger.fatal('The executable %s (from --python=%s) is not executable' % (exe, exe))
+ logger.fatal("The path {} (from --python={}) is not an executable file".format(exe, orig_exe))
raise SystemExit(3)
return exe
+
def is_executable(exe):
"""Checks a file is executable"""
- return os.access(exe, os.X_OK)
+ return os.path.isfile(exe) and os.access(exe, os.X_OK)
-############################################################
-## Relocating the environment:
+# Relocating the environment:
def make_environment_relocatable(home_dir):
"""
Makes the already-existing environment use relative paths, and takes out
the #!-based environment selection in scripts.
"""
home_dir, lib_dir, inc_dir, bin_dir = path_locations(home_dir)
- activate_this = os.path.join(bin_dir, 'activate_this.py')
+ activate_this = os.path.join(bin_dir, "activate_this.py")
if not os.path.exists(activate_this):
logger.fatal(
- 'The environment doesn\'t have a file %s -- please re-run virtualenv '
- 'on this environment to update it' % activate_this)
- fixup_scripts(home_dir)
+ "The environment doesn't have a file %s -- please re-run virtualenv " "on this environment to update it",
+ activate_this,
+ )
+ fixup_scripts(home_dir, bin_dir)
fixup_pth_and_egg_link(home_dir)
- ## FIXME: need to fix up distutils.cfg
+ # FIXME: need to fix up distutils.cfg
+
-OK_ABS_SCRIPTS = ['python', 'python%s' % sys.version[:3],
- 'activate', 'activate.bat', 'activate_this.py']
+OK_ABS_SCRIPTS = [
+ "python",
+ PY_VERSION,
+ "activate",
+ "activate.bat",
+ "activate_this.py",
+ "activate.fish",
+ "activate.csh",
+ "activate.xsh",
+]
-def fixup_scripts(home_dir):
+
+def fixup_scripts(_, bin_dir):
+ if IS_WIN:
+ new_shebang_args = ("{} /c".format(os.path.normcase(os.environ.get("COMSPEC", "cmd.exe"))), "", ".exe")
+ else:
+ new_shebang_args = ("/usr/bin/env", VERSION, "")
+
# This is what we expect at the top of scripts:
- shebang = '#!%s/bin/python' % os.path.normcase(os.path.abspath(home_dir))
+ shebang = "#!{}".format(
+ os.path.normcase(os.path.join(os.path.abspath(bin_dir), "python{}".format(new_shebang_args[2])))
+ )
# This is what we'll put:
- new_shebang = '#!/usr/bin/env python%s' % sys.version[:3]
- activate = "import os; activate_this=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'activate_this.py'); execfile(activate_this, dict(__file__=activate_this)); del os, activate_this"
- if sys.platform == 'win32':
- bin_suffix = 'Scripts'
- else:
- bin_suffix = 'bin'
- bin_dir = os.path.join(home_dir, bin_suffix)
- home_dir, lib_dir, inc_dir, bin_dir = path_locations(home_dir)
+ new_shebang = "#!{} python{}{}".format(*new_shebang_args)
+
for filename in os.listdir(bin_dir):
filename = os.path.join(bin_dir, filename)
if not os.path.isfile(filename):
- # ignore subdirs, e.g. .svn ones.
+ # ignore child directories, e.g. .svn ones.
continue
- f = open(filename, 'rb')
- try:
+ with open(filename, "rb") as f:
try:
- lines = f.read().decode('utf-8').splitlines()
+ lines = f.read().decode("utf-8").splitlines()
except UnicodeDecodeError:
# This is probably a binary program instead
# of a script, so just ignore it.
continue
- finally:
- f.close()
if not lines:
- logger.warn('Script %s is an empty file' % filename)
+ logger.warn("Script %s is an empty file", filename)
continue
- if not lines[0].strip().startswith(shebang):
+
+ old_shebang = lines[0].strip()
+ old_shebang = old_shebang[0:2] + os.path.normcase(old_shebang[2:])
+
+ if not old_shebang.startswith(shebang):
if os.path.basename(filename) in OK_ABS_SCRIPTS:
- logger.debug('Cannot make script %s relative' % filename)
+ logger.debug("Cannot make script %s relative", filename)
elif lines[0].strip() == new_shebang:
- logger.info('Script %s has already been made relative' % filename)
+ logger.info("Script %s has already been made relative", filename)
else:
- logger.warn('Script %s cannot be made relative (it\'s not a normal script that starts with %s)'
- % (filename, shebang))
+ logger.warn(
+ "Script %s cannot be made relative (it's not a normal script that starts with %s)",
+ filename,
+ shebang,
+ )
continue
- logger.notify('Making script %s relative' % filename)
- lines = [new_shebang+'\n', activate+'\n'] + lines[1:]
- f = open(filename, 'wb')
- f.write('\n'.join(lines).encode('utf-8'))
- f.close()
+ logger.notify("Making script %s relative", filename)
+ script = relative_script([new_shebang] + lines[1:])
+ with open(filename, "wb") as f:
+ f.write("\n".join(script).encode("utf-8"))
+
+
+def relative_script(lines):
+ """Return a script that'll work in a relocatable environment."""
+ activate = (
+ "import os; "
+ "activate_this=os.path.join(os.path.dirname(os.path.realpath(__file__)), 'activate_this.py'); "
+ "exec(compile(open(activate_this).read(), activate_this, 'exec'), { '__file__': activate_this}); "
+ "del os, activate_this"
+ )
+ # Find the last future statement in the script. If we insert the activation
+ # line before a future statement, Python will raise a SyntaxError.
+ activate_at = None
+ for idx, line in reversed(list(enumerate(lines))):
+ if line.split()[:3] == ["from", "__future__", "import"]:
+ activate_at = idx + 1
+ break
+ if activate_at is None:
+ # Activate after the shebang.
+ activate_at = 1
+ return lines[:activate_at] + ["", activate, ""] + lines[activate_at:]
+
def fixup_pth_and_egg_link(home_dir, sys_path=None):
"""Makes .pth and .egg-link files use relative paths"""
home_dir = os.path.normcase(os.path.abspath(home_dir))
if sys_path is None:
sys_path = sys.path
- for path in sys_path:
- if not path:
- path = '.'
- if not os.path.isdir(path):
+ for a_path in sys_path:
+ if not a_path:
+ a_path = "."
+ if not os.path.isdir(a_path):
continue
- path = os.path.normcase(os.path.abspath(path))
- if not path.startswith(home_dir):
- logger.debug('Skipping system (non-environment) directory %s' % path)
+ a_path = os.path.normcase(os.path.abspath(a_path))
+ if not a_path.startswith(home_dir):
+ logger.debug("Skipping system (non-environment) directory %s", a_path)
continue
- for filename in os.listdir(path):
- filename = os.path.join(path, filename)
- if filename.endswith('.pth'):
+ for filename in os.listdir(a_path):
+ filename = os.path.join(a_path, filename)
+ if filename.endswith(".pth"):
if not os.access(filename, os.W_OK):
- logger.warn('Cannot write .pth file %s, skipping' % filename)
+ logger.warn("Cannot write .pth file %s, skipping", filename)
else:
fixup_pth_file(filename)
- if filename.endswith('.egg-link'):
+ if filename.endswith(".egg-link"):
if not os.access(filename, os.W_OK):
- logger.warn('Cannot write .egg-link file %s, skipping' % filename)
+ logger.warn("Cannot write .egg-link file %s, skipping", filename)
else:
fixup_egg_link(filename)
+
def fixup_pth_file(filename):
lines = []
- prev_lines = []
- f = open(filename)
- prev_lines = f.readlines()
- f.close()
+ with open(filename) as f:
+ prev_lines = f.readlines()
for line in prev_lines:
line = line.strip()
- if (not line or line.startswith('#') or line.startswith('import ')
- or os.path.abspath(line) != line):
+ if not line or line.startswith("#") or line.startswith("import ") or os.path.abspath(line) != line:
lines.append(line)
else:
new_value = make_relative_path(filename, line)
if line != new_value:
- logger.debug('Rewriting path %s as %s (in %s)' % (line, new_value, filename))
+ logger.debug("Rewriting path {} as {} (in {})".format(line, new_value, filename))
lines.append(new_value)
if lines == prev_lines:
- logger.info('No changes to .pth file %s' % filename)
+ logger.info("No changes to .pth file %s", filename)
return
- logger.notify('Making paths in .pth file %s relative' % filename)
- f = open(filename, 'w')
- f.write('\n'.join(lines) + '\n')
- f.close()
+ logger.notify("Making paths in .pth file %s relative", filename)
+ with open(filename, "w") as f:
+ f.write("\n".join(lines) + "\n")
+
def fixup_egg_link(filename):
- f = open(filename)
- link = f.read().strip()
- f.close()
+ with open(filename) as f:
+ link = f.readline().strip()
if os.path.abspath(link) != link:
- logger.debug('Link in %s already relative' % filename)
+ logger.debug("Link in %s already relative", filename)
return
new_link = make_relative_path(filename, link)
- logger.notify('Rewriting link %s in %s as %s' % (link, filename, new_link))
- f = open(filename, 'w')
- f.write(new_link)
- f.close()
+ logger.notify("Rewriting link {} in {} as {}".format(link, filename, new_link))
+ with open(filename, "w") as f:
+ f.write(new_link)
+
def make_relative_path(source, dest, dest_is_directory=True):
"""
@@ -1687,6 +2056,8 @@
if not dest_is_directory:
dest_filename = os.path.basename(dest)
dest = os.path.dirname(dest)
+ else:
+ dest_filename = None
dest = os.path.normpath(os.path.abspath(dest))
source = os.path.normpath(os.path.abspath(source))
dest_parts = dest.strip(os.path.sep).split(os.path.sep)
@@ -1694,20 +2065,20 @@
while dest_parts and source_parts and dest_parts[0] == source_parts[0]:
dest_parts.pop(0)
source_parts.pop(0)
- full_parts = ['..']*len(source_parts) + dest_parts
- if not dest_is_directory:
+ full_parts = [".."] * len(source_parts) + dest_parts
+ if not dest_is_directory and dest_filename is not None:
full_parts.append(dest_filename)
if not full_parts:
# Special case for the current directory (otherwise it'd be '')
- return './'
+ return "./"
return os.path.sep.join(full_parts)
+FILE_PATH = __file__ if os.path.isabs(__file__) else os.path.join(os.getcwd(), __file__)
-############################################################
-## Bootstrap script creation:
-def create_bootstrap_script(extra_text, python_version=''):
+# Bootstrap script creation:
+def create_bootstrap_script(extra_text, python_version=""):
"""
Creates a bootstrap script, which is like this script but with
extend_parser, adjust_options, and after_install hooks.
@@ -1742,533 +2113,522 @@
This example immediately installs a package, and runs a setup
script from that package.
- If you provide something like ``python_version='2.4'`` then the
- script will start with ``#!/usr/bin/env python2.4`` instead of
+ If you provide something like ``python_version='2.5'`` then the
+ script will start with ``#!/usr/bin/env python2.5`` instead of
``#!/usr/bin/env python``. You can use this when the script must
be run with a particular Python version.
"""
- filename = __file__
- if filename.endswith('.pyc'):
+ filename = FILE_PATH
+ if filename.endswith(".pyc"):
filename = filename[:-1]
- f = open(filename, 'rb')
- content = f.read()
- f.close()
- py_exe = 'python%s' % python_version
- content = (('#!/usr/bin/env %s\n' % py_exe)
- + '## WARNING: This file is generated\n'
- + content)
- return content.replace('##EXT' 'END##', extra_text)
+ with codecs.open(filename, "r", encoding="utf-8") as f:
+ content = f.read()
+ py_exe = "python{}".format(python_version)
+ content = "#!/usr/bin/env {}\n# WARNING: This file is generated\n{}".format(py_exe, content)
+ # we build the string as two, to avoid replacing here, but yes further done
+ return content.replace("# EXTEND - " "bootstrap here", extra_text)
-##EXTEND##
+
+# EXTEND - bootstrap here
+
def convert(s):
- b = base64.b64decode(s.encode('ascii'))
- return zlib.decompress(b).decode('utf-8')
+ b = base64.b64decode(s.encode("ascii"))
+ return zlib.decompress(b).decode("utf-8")
-##file site.py
-SITE_PY = convert("""
-eJzFPf1z2zaWv/OvwMqTIZXKdD66nR2n7o2TOK333MTbpLO5dT1aSoIs1hTJEqRl7c3d337vAwAB
-kvLHpp3TdGKJBB4eHt43HtDRaHRcljJfiHWxaDIplEyq+UqUSb1SYllUol6l1WK/TKp6C0/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di/AYN1UZY=
+"""
+)
+
+# file activate.bat
+ACTIVATE_BAT = convert(
+ """
+eJyVk1FLhEAUhd8X/A8XWSkf28dCyMUpBR3FzAiCS+WYwq4TOdXfb0Z3dTJdyCfveO85n8frNXut
+OPCyNFbGqmUCzDxIs3s3REJzB1GrEE3VVJdQsLJuWAEYh97QkaRxlGRwbqxAXp1Uf+RYM32W1LKB
+7Vp2nJC6DReD9m+5qeQ6Wd+a/SN7dlzn9oI7dxsSXJCcoXOskfLgYXdv/j8LnXiM8iGg/RmiZmOr
+bFMSgcebMwGfKhgbBIfnL14X8P7BX3Zs38J3LSoQFdtD3YCVuJlvnfgmj5kfUz+OCLxxqUWoF9zk
+qtYAFyZkBsO9ArzUh/td0ZqP9IskElTFMsnwb4/GqeoLPUlZT5dJvf8Id5hQIONynUSa2G0Wc+m8
+Z+w2w4/Tt2hbYT0hbgOK1I0I4tUw/QOTZfLE
+"""
+)
+
+# file deactivate.bat
+DEACTIVATE_BAT = convert(
+ """
+eJyFkN0KgkAUhO8F32EQpHqFQEjQUPAPMaErqVxzId3IrV6/3ST/UDp3c86c4WN25FIysKJQFVVp
+CEfqxsnB9DI7SA25i20fFqtXHM+GYL0BZzi9GM1xf7DzjVQN3pSX4CWpQGvokZk4uqrQAjXjyElB
+a5IjCz0r+2VHcehHCa5MZNmB5e7TdqMqECMptHZh6DN/utb7Zs6CejsO/QNzTJwwcELfHgJJPcTp
+TFOk7rCM1f92aG38HzBR5KgjoYdIQk5hZPWLGNLfd/MN+wANyJE5
+"""
+)
-##file distutils-init.py
-DISTUTILS_INIT = convert("""
-eJytV92L4zYQf/dfMU0ottuse7RvC6FQrg8Lxz2Ugz4si9HacqKuIxlJ2ST313dG8odkO9d7aGBB
-luZLv/nNjFacOqUtKJMIvzK3cXlhWgp5MDBsqK5SNYftsBAGpLLA4F1oe2Ytl+9wUvW55TswCi4c
-KibhbFDSglXQCFmDPXIwtm7FawLRbwtPzg2T9gf4gupKv4GS0N262w7V0NvpbCy8c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kcbWEQ36F5V4Gq9N7icNNw+JHwRE
+LTgxRXACpvnQv/PuT0xCCAywY/K4hE6Now2qDwaSE5FB+1agsoUveYDepS83qFcF1NufvULD3fTl
+g6Hgf7WBt6lzMeiyyWVn3P1WVbwaczHmTzE9A5SyItTVgFYyvs/L/fXlaNgbw8v3azT+0eikVlWD
+/vBHbzQumP23uBCjsYdrL9OWARwxs/nuLOzeXbPJTa/Xv6sUmQir5pC1YRLz3eA+CD8Z0XpcW8v9
+MZWF36ryyXXf3yBIz6nzqz8Muyz0m5Qj7OexfYo/Ph3LqvkHUg7AuA==
+"""
+)
+
+MH_MAGIC = 0xFEEDFACE
+MH_CIGAM = 0xCEFAEDFE
+MH_MAGIC_64 = 0xFEEDFACF
+MH_CIGAM_64 = 0xCFFAEDFE
+FAT_MAGIC = 0xCAFEBABE
+BIG_ENDIAN = ">"
+LITTLE_ENDIAN = "<"
+LC_LOAD_DYLIB = 0xC
+maxint = getattr(sys, "maxsize", getattr(sys, "maxint", None))
+
+
+class FileView(object):
+ """
+ A proxy for file-like objects that exposes a given view of a file.
+ Modified from macholib.
+ """
+
+ def __init__(self, file_obj, start=0, size=maxint):
+ if isinstance(file_obj, FileView):
+ self._file_obj = file_obj._file_obj
+ else:
+ self._file_obj = file_obj
+ self._start = start
+ self._end = start + size
+ self._pos = 0
+
+ def __repr__(self):
+ return "<fileview [{:d}, {:d}] {!r}>".format(self._start, self._end, self._file_obj)
+
+ def tell(self):
+ return self._pos
+
+ def _checkwindow(self, seek_to, op):
+ if not (self._start <= seek_to <= self._end):
+ raise IOError(
+ "{} to offset {:d} is outside window [{:d}, {:d}]".format(op, seek_to, self._start, self._end)
+ )
-##file activate_this.py
-ACTIVATE_THIS = convert("""
-eJyNU01v2zAMvetXEB4K21jmDOstQA4dMGCHbeihlyEIDMWmG62yJEiKE//7kXKdpN2KzYBt8euR
-fKSyLPs8wiEo8wh4wqZTGou4V6Hm0wJa1cSiTkJdr8+GsoTRHuCotBayiWqQEYGtMCgfD1KjGYBe
-5a3p0cRKiAe2NtLADikftnDco0ko/SFEVgEZ8aRC5GLux7i3BpSJ6J1H+i7A2CjiHq9z7JRZuuQq
-siwTIvpxJYCeuWaBpwZdhB+yxy/eWz+ZvVSU8C4E9FFZkyxFsvCT/ZzL8gcz9aXVE14Yyp2M+2W0
-y7n5mp0qN+avKXvbsyyzUqjeWR8hjGE+2iCE1W1tQ82hsCZN9UzlJr+/e/iab8WfqsmPI6pWeUPd
-FrMsd4H/55poeO9n54COhUs+sZNEzNtg/wanpjpuqHJaxs76HtZryI/K3H7KJ/KDIhqcbJ7kI4ar
-XL+sMgXnX0D+Te2Iy5xdP8yueSlQB/x/ED2BTAtyE3K4SYUN6AMNfbO63f4lBW3bUJPbTL+mjSxS
-PyRfJkZRgj+VbFv+EzHFi5pKwUEepa4JslMnwkowSRCXI+m5XvEOvtuBrxHdhLalG0JofYBok6qj
-YdN2dEngUlbC4PG60M1WEN0piu7Nq7on0mgyyUw3iV1etLo6r/81biWdQ9MWHFaePWZYaq+nmp+t
-s3az+sj7eA0jfgPfeoN1
-""")
+ def seek(self, offset, whence=0):
+ seek_to = offset
+ if whence == os.SEEK_SET:
+ seek_to += self._start
+ elif whence == os.SEEK_CUR:
+ seek_to += self._start + self._pos
+ elif whence == os.SEEK_END:
+ seek_to += self._end
+ else:
+ raise IOError("Invalid whence argument to seek: {!r}".format(whence))
+ self._checkwindow(seek_to, "seek")
+ self._file_obj.seek(seek_to)
+ self._pos = seek_to - self._start
+
+ def write(self, content):
+ here = self._start + self._pos
+ self._checkwindow(here, "write")
+ self._checkwindow(here + len(content), "write")
+ self._file_obj.seek(here, os.SEEK_SET)
+ self._file_obj.write(content)
+ self._pos += len(content)
+
+ def read(self, size=maxint):
+ assert size >= 0
+ here = self._start + self._pos
+ self._checkwindow(here, "read")
+ size = min(size, self._end - here)
+ self._file_obj.seek(here, os.SEEK_SET)
+ read_bytes = self._file_obj.read(size)
+ self._pos += len(read_bytes)
+ return read_bytes
+
+
+def read_data(file, endian, num=1):
+ """
+ Read a given number of 32-bits unsigned integers from the given file
+ with the given endianness.
+ """
+ res = struct.unpack(endian + "L" * num, file.read(num * 4))
+ if len(res) == 1:
+ return res[0]
+ return res
+
+
+def mach_o_change(at_path, what, value):
+ """
+ Replace a given name (what) in any LC_LOAD_DYLIB command found in
+ the given binary with a new name (value), provided it's shorter.
+ """
-if __name__ == '__main__':
- main()
+ def do_macho(file, bits, endian):
+ # Read Mach-O header (the magic number is assumed read by the caller)
+ cpu_type, cpu_sub_type, file_type, n_commands, size_of_commands, flags = read_data(file, endian, 6)
+ # 64-bits header has one more field.
+ if bits == 64:
+ read_data(file, endian)
+ # The header is followed by n commands
+ for _ in range(n_commands):
+ where = file.tell()
+ # Read command header
+ cmd, cmd_size = read_data(file, endian, 2)
+ if cmd == LC_LOAD_DYLIB:
+ # The first data field in LC_LOAD_DYLIB commands is the
+ # offset of the name, starting from the beginning of the
+ # command.
+ name_offset = read_data(file, endian)
+ file.seek(where + name_offset, os.SEEK_SET)
+ # Read the NUL terminated string
+ load = file.read(cmd_size - name_offset).decode()
+ load = load[: load.index("\0")]
+ # If the string is what is being replaced, overwrite it.
+ if load == what:
+ file.seek(where + name_offset, os.SEEK_SET)
+ file.write(value.encode() + b"\0")
+ # Seek to the next command
+ file.seek(where + cmd_size, os.SEEK_SET)
-## TODO:
-## Copy python.exe.manifest
-## Monkeypatch distutils.sysconfig
+ def do_file(file, offset=0, size=maxint):
+ file = FileView(file, offset, size)
+ # Read magic number
+ magic = read_data(file, BIG_ENDIAN)
+ if magic == FAT_MAGIC:
+ # Fat binaries contain nfat_arch Mach-O binaries
+ n_fat_arch = read_data(file, BIG_ENDIAN)
+ for _ in range(n_fat_arch):
+ # Read arch header
+ cpu_type, cpu_sub_type, offset, size, align = read_data(file, BIG_ENDIAN, 5)
+ do_file(file, offset, size)
+ elif magic == MH_MAGIC:
+ do_macho(file, 32, BIG_ENDIAN)
+ elif magic == MH_CIGAM:
+ do_macho(file, 32, LITTLE_ENDIAN)
+ elif magic == MH_MAGIC_64:
+ do_macho(file, 64, BIG_ENDIAN)
+ elif magic == MH_CIGAM_64:
+ do_macho(file, 64, LITTLE_ENDIAN)
+
+ assert len(what) >= len(value)
+
+ with open(at_path, "r+b") as f:
+ do_file(f)
+
+
+if __name__ == "__main__":
+ main()