diff options
Diffstat (limited to 'helperscripts/windows-virtualenv/virtualenv.py')
-rwxr-xr-x | helperscripts/windows-virtualenv/virtualenv.py | 438 |
1 files changed, 240 insertions, 198 deletions
diff --git a/helperscripts/windows-virtualenv/virtualenv.py b/helperscripts/windows-virtualenv/virtualenv.py index 9cff773..66f3e3d 100755 --- a/helperscripts/windows-virtualenv/virtualenv.py +++ b/helperscripts/windows-virtualenv/virtualenv.py @@ -2,10 +2,6 @@ """Create a "virtual" Python installation """ -# If you change the version here, change it in setup.py -# and docs/conf.py as well. -virtualenv_version = "1.7.1.2" - import base64 import sys import os @@ -43,12 +39,16 @@ try: except ImportError: import configparser as ConfigParser +# If you change the version here, change it in setup.py +# and docs/conf.py as well. +virtualenv_version = "1.7.1.2" + join = os.path.join py_version = 'python%s.%s' % (sys.version_info[0], sys.version_info[1]) is_jython = sys.platform.startswith('java') is_pypy = hasattr(sys, 'pypy_version_info') -is_win = (sys.platform == 'win32') +is_win = (sys.platform == 'win32') abiflags = getattr(sys, 'abiflags', '') user_dir = os.path.expanduser('~') @@ -97,151 +97,151 @@ elif majver == 3: # 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", + # "aifc", + # "antigravity", + # "argparse", + # "ast", + # "asynchat", + # "asyncore", "base64", - #"bdb", - #"binhex", + # "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", + # "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", + # "email", + # "filecmp", + # "fileinput", + # "formatter", + # "fractions", + # "ftplib", + # "functools", + # "getopt", + # "getpass", + # "gettext", + # "glob", + # "gzip", "hashlib", "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", + # "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", "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", + # "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", + # "webbrowser", + # "wsgiref", + # "xdrlib", + # "xml", + # "xmlrpc", + # "zipfile", ]) if is_pypy: @@ -249,6 +249,7 @@ if is_pypy: # during the bootstrap REQUIRED_MODULES.extend(['traceback', 'linecache']) + class Logger(object): """ @@ -273,16 +274,22 @@ class Logger(object): 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) + def fatal(self, msg, *args, **kw): self.log(self.FATAL, msg, *args, **kw) + def log(self, level, msg, *args, **kw): if args: if kw: @@ -292,8 +299,8 @@ class Logger(object): 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') sys.stdout.flush() @@ -378,7 +385,7 @@ class Logger(object): else: return level >= consumer_level - #@classmethod + # @classmethod def level_for_integer(cls, level): levels = cls.LEVELS if level < 0: @@ -393,6 +400,7 @@ class Logger(object): # 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) @@ -400,12 +408,14 @@ def mkdir(path): else: logger.info('Directory %s already exists', path) + def copyfileordir(src, dest): if os.path.isdir(src): shutil.copytree(src, dest, True) else: shutil.copy2(src, dest) + def copyfile(src, dest, symlink=True): if not os.path.exists(src): # Some bad symlink in the src @@ -415,7 +425,8 @@ def copyfile(src, dest, symlink=True): 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) @@ -432,6 +443,7 @@ def copyfile(src, dest, symlink=True): logger.info('Copying to %s', dest) copyfileordir(src, dest) + def writefile(dest, content, overwrite=True): if not os.path.exists(dest): logger.info('Writing %s', dest) @@ -445,7 +457,9 @@ def writefile(dest, content, overwrite=True): f.close() if c != content: 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') @@ -454,6 +468,7 @@ def writefile(dest, content, overwrite=True): else: logger.info('Content %s already in place', dest) + def rmtree(dir): if os.path.exists(dir): logger.notify('Deleting tree %s', dir) @@ -461,19 +476,22 @@ def rmtree(dir): else: logger.info('Do not need to delete %s; already gone', dir) + def make_exe(fn): if hasattr(os, 'chmod'): - oldmode = os.stat(fn).st_mode & 0xFFF # 0o7777 - newmode = (oldmode | 0x16D) & 0xFFF # 0o555, 0o7777 + 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)) + 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): @@ -533,7 +551,7 @@ def _install_req(py_executable, unzip=False, distribute=False, 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 " + "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, @@ -573,6 +591,7 @@ def _install_req(py_executable, unzip=False, distribute=False, 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, @@ -584,20 +603,25 @@ def file_search_dirs(): except ImportError: pass else: - dirs.append(os.path.join(os.path.dirname(virtualenv.__file__), 'virtualenv_support')) + 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() @@ -606,7 +630,8 @@ def install_pip(py_executable, search_dirs=None, never_download=False): 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 = [(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: @@ -622,7 +647,7 @@ def install_pip(py_executable, search_dirs=None, never_download=False): 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 " + "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) @@ -630,9 +655,10 @@ def install_pip(py_executable, search_dirs=None, never_download=False): logger.info('Installing pip from network...') else: logger.info('Installing existing %s distribution: %s' % ( - os.path.basename(filename), filename)) + os.path.basename(filename), filename)) logger.start_progress('Installing pip...') logger.indent += 2 + def _filter_setup(line): return filter_ez_setup(line, 'pip') try: @@ -642,6 +668,7 @@ def install_pip(py_executable, search_dirs=None, never_download=False): logger.indent -= 2 logger.end_progress() + def filter_ez_setup(line, project_name='setuptools'): if not line.strip(): return Logger.DEBUG @@ -754,7 +781,7 @@ class ConfigOptionParser(optparse.OptionParser): # 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): @@ -929,6 +956,7 @@ def main(): 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, @@ -1043,6 +1071,7 @@ def create_environment(home_dir, site_packages=False, clear=False, install_activate(home_dir, bin_dir, prompt) + def path_locations(home_dir): """Return the path locations for the environment (where libraries are, where scripts go, etc)""" @@ -1102,6 +1131,7 @@ def change_prefix(filename, dst_prefix): assert False, "Filename %s does not start with any of these prefixes: %s" % \ (filename, prefixes) + def copy_required_modules(dst_prefix): import imp # If we are running under -p, we need to remove the current @@ -1134,6 +1164,7 @@ def copy_required_modules(dst_prefix): finally: sys.path = _prev_sys_path + def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear): """Install just the base environment, no distutils patches etc""" if sys.executable.startswith(bin_dir): @@ -1142,8 +1173,8 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear): if clear: rmtree(lib_dir) - ## FIXME: why not delete it? - ## Maybe it should delete everything with #!/path/to/venv/python in it + # 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'): @@ -1236,7 +1267,7 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear): # 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') + os.path.dirname(py_executable), 'python') logger.notify('New %s executable in %s', expected_exe, py_executable) pcbuild_dir = os.path.dirname(sys.executable) @@ -1250,9 +1281,9 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear): if os.path.exists(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 @@ -1285,7 +1316,8 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear): 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)) + 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) @@ -1356,7 +1388,7 @@ def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear): 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]) + sys.version_info[0], sys.version_info[1]) if os.path.exists(pth): os.unlink(pth) os.symlink('python', pth) @@ -1386,7 +1418,7 @@ sys.stdout.write(prefix) logger.info('Testing executable with %s %s "%s"' % tuple(cmd)) try: proc = subprocess.Popen(cmd, - stdout=subprocess.PIPE) + stdout=subprocess.PIPE) proc_stdout, proc_stderr = proc.communicate() except OSError: e = sys.exc_info()[1] @@ -1394,7 +1426,7 @@ sys.stdout.write(prefix) logger.fatal('ERROR: The executable %s could not be run: %s' % (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)) @@ -1424,12 +1456,13 @@ sys.stdout.write(prefix) 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 + # FIXME: really this should be calculated earlier fix_local_scheme(home_dir) 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': @@ -1444,7 +1477,7 @@ def install_activate(home_dir, bin_dir, prompt=None): home_dir_msys = (drive and "/%s%s" or "%s%s") % (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_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) @@ -1470,17 +1503,19 @@ def install_activate(home_dir, bin_dir, prompt=None): content = content.replace('__BIN_NAME__', os.path.basename(bin_dir)) writefile(os.path.join(bin_dir, name), content) + 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? + # 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 + # 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): """ Platforms that use the "posix_local" install scheme (like Ubuntu with @@ -1498,8 +1533,9 @@ def fix_local_scheme(home_dir): for subdir_name in os.listdir(home_dir): if subdir_name == 'local': continue - os.symlink(os.path.abspath(os.path.join(home_dir, subdir_name)), \ - os.path.join(local_path, subdir_name)) + os.symlink(os.path.abspath(os.path.join(home_dir, subdir_name)), + os.path.join(local_path, subdir_name)) + def fix_lib64(lib_dir): """ @@ -1508,7 +1544,7 @@ def fix_lib64(lib_dir): 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]: + 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) @@ -1517,6 +1553,7 @@ def fix_lib64(lib_dir): "Unexpected parent dir: %r" % lib_parent) copyfile(lib_parent, os.path.join(os.path.dirname(lib_parent), 'lib64')) + def resolve_interpreter(exe): """ If the executable given isn't an absolute path, search $PATH for the interpreter @@ -1535,12 +1572,14 @@ def resolve_interpreter(exe): raise SystemExit(3) return exe + def is_executable(exe): """Checks a file is executable""" return os.access(exe, os.X_OK) ############################################################ -## Relocating the environment: +# Relocating the environment: + def make_environment_relocatable(home_dir): """ @@ -1555,11 +1594,12 @@ def make_environment_relocatable(home_dir): 'on this environment to update it' % activate_this) fixup_scripts(home_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'] + def fixup_scripts(home_dir): # This is what we expect at the top of scripts: shebang = '#!%s/bin/python' % os.path.normcase(os.path.abspath(home_dir)) @@ -1605,6 +1645,7 @@ def fixup_scripts(home_dir): f.write('\n'.join(lines).encode('utf-8')) f.close() + 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)) @@ -1632,6 +1673,7 @@ def fixup_pth_and_egg_link(home_dir, sys_path=None): else: fixup_egg_link(filename) + def fixup_pth_file(filename): lines = [] prev_lines = [] @@ -1640,8 +1682,8 @@ def fixup_pth_file(filename): f.close() 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) @@ -1656,6 +1698,7 @@ def fixup_pth_file(filename): f.write('\n'.join(lines) + '\n') f.close() + def fixup_egg_link(filename): f = open(filename) link = f.read().strip() @@ -1669,6 +1712,7 @@ def fixup_egg_link(filename): f.write(new_link) f.close() + def make_relative_path(source, dest, dest_is_directory=True): """ Make a filename relative, where the filename is dest, and it is @@ -1703,10 +1747,8 @@ def make_relative_path(source, dest, dest_is_directory=True): return os.path.sep.join(full_parts) - ############################################################ -## Bootstrap script creation: - +# Bootstrap script creation: def create_bootstrap_script(extra_text, python_version=''): """ Creates a bootstrap script, which is like this script but with @@ -1754,18 +1796,18 @@ def create_bootstrap_script(extra_text, python_version=''): 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) + content = (('#!/usr/bin/env %s\n' % py_exe) + + '## WARNING: This file is generated\n' + + content) return content.replace('##EXT' 'END##', extra_text) -##EXTEND## +# EXTEND## def convert(s): b = base64.b64decode(s.encode('ascii')) return zlib.decompress(b).decode('utf-8') -##file site.py +# file site.py SITE_PY = convert(""" eJzFPf1z2zaWv/OvwMqTIZXKdD66nR2n7o2TOK333MTbpLO5dT1aSoIs1hTJEqRl7c3d337vAwAB kvLHpp3TdGKJBB4eHt43HtDRaHRcljJfiHWxaDIplEyq+UqUSb1SYllUol6l1WK/TKp6C0/n18mV @@ -1905,7 +1947,7 @@ M+6hIxVUReNzBPcwvl+LX7c7nbB8UHdG0fTnBl0O1EsOws2+A7caeymR3SahO/WWD3a4AHxYdbj/ Q7wQmAIMcman2gOwRiH4P2ts6wE= """) -##file ez_setup.py +# file ez_setup.py EZ_SETUP_PY = convert(""" eJzNWmtv49a1/a5fwSgwJGE0NN8PDzRFmkyBAYrcIo8CFx5XPk+LHYpUSWoctch/v+ucQ1KkZDrt RT6UwcQ2ebjPfq6195G+/upwanZlMZvP538sy6ZuKnKwatEcD01Z5rWVFXVD8pw0GRbNPkrrVB6t @@ -1976,7 +2018,7 @@ dX85nKW3umfYbtu8713Sylhb2i3v2qaoc8C7S2P3pME8uIGedi1IxXbL+adi+P2fT8Xy/m+/PrxZ BDaonX65d/fwEjNqlDjLVIvM9X+XVxF7 """) -##file distribute_setup.py +# file distribute_setup.py DISTRIBUTE_SETUP_PY = convert(""" eJztG2tz2zbyu34FTh4PqYSi7TT3GM+pM2nj9DzNJZnYaT8kHhoiIYk1X+XDsvrrb3cBkCAJyc61 dzM3c7qrIxGLxWLfuwCP/lTs6k2eTabT6Xd5Xld1yQsWxfBvvGxqweKsqnmS8DoGoMnliu3yhm15 @@ -2059,7 +2101,7 @@ lSqKkxPgfgJV8Nm4AqYbxYPq2nZPgZAF0XLtghJOlWvBN9nwwpPQ4SDlMdXc9x7bc8mvCwSXh153 JRW44NVOQWnnd/j6v4rxw5fbgLiY7r9g8hRQRR4ESGoQqHcpie42ap6d38wm/wIwBuVg """) -##file activate.sh +# file activate.sh ACTIVATE_SH = convert(""" eJytVVFvokAQfudXTLEP2pw1fW3jg01NNGm1KV4vd22zrDDIJrhrYJHay/33m0VEKGpyufIg7s63 M9/OfDO0YBaKBAIRISzTRMMcIU3Qh0zoEOxEpbGHMBeyxz0t1lyjDRdBrJYw50l4YbVgo1LwuJRK @@ -2077,7 +2119,7 @@ x60HKiWc9eH9SBc04XuPGCVYce1SXlDyJcJrjfKr7ebSNpEaQVpg+l3wiAYOJZ9GCAxoR9JMWAiv Exft7A8WX4/iVRkZprZfNK2/YFL/55T+9wm9m86Uhr8A0Hwt """) -##file activate.fish +# file activate.fish ACTIVATE_FISH = convert(""" eJydVm1v4jgQ/s6vmA1wBxUE7X2stJVYlVWR2lK13d6d9laRk0yIr8HmbIe0++tvnIQQB9pbXT5A Ys/LM55nZtyHx5RrSHiGsMm1gRAh1xhDwU0Kng8hFzMWGb5jBv2E69SDs0TJDdj3MxilxmzPZzP7 @@ -2100,7 +2142,7 @@ mWmZmIIpnDFrbXakvKWeZhLwhvrbUH8fahhqD0YUcBDJjEBMQwiznE4y5QbHrbhHBOnUAYzb2tVN jJa65e+eE2Ya30E2GurxUP8ssA6e/wOnvo3V78d3vTcvMB3n7l3iX1JXWqk= """) -##file activate.csh +# file activate.csh ACTIVATE_CSH = convert(""" eJx9U11vmzAUffevOCVRu+UB9pws29Kl0iq1aVWllaZlcgxciiViItsQdb9+xiQp+dh4QOB7Pu49 XHqY59IgkwVhVRmLmFAZSrGRNkdgykonhFiqSCRW1sJSmJg8wCDT5QrucRCyHn6WFRKhVGmhKwVp @@ -2113,7 +2155,7 @@ lXiVyXa9Sy3JdClEyK1dD6Nos9mEf8iKlOpmqSNTZnYjNEWiUYn2pKNB3ttcLJ3HmYYXy6Un76f7 r8rRsC1TpTJj7f19m5sUf/V3Ir+x/yjtLu8KjLX/CmN/AcVGUUo= """) -##file activate.bat +# file activate.bat ACTIVATE_BAT = convert(""" eJyFUkEKgzAQvAfyhz0YaL9QEWpRqlSjWGspFPZQTevFHOr/adQaU1GaUzI7Mzu7ZF89XhKkEJS8 qxaKMMsvboQ+LxxE44VICSW1gEa2UFaibqoS0iyJ0xw2lIA6nX5AHCu1jpRsv5KRjknkac9VLVug @@ -2121,14 +2163,14 @@ sX9mtzxIeJDE/mg4OGp47qoLo3NHX2jsMB3AiDht5hryAUOEifoTdCXbSh7V0My2NMq/Xbh5MEjU ZT63gpgNT9lKOJ/CtHsvT99re3pX303kydn4HeyOeAg5cjf2EW1D6HOPkg9NGKhu """) -##file deactivate.bat +# file deactivate.bat DEACTIVATE_BAT = convert(""" eJxzSE3OyFfIT0vj4spMU0hJTcvMS01RiPf3cYkP8wwKCXX0iQ8I8vcNCFHQ4FIAguLUEgWIgK0q FlWqXJpcICVYpGzx2BAZ4uHv5+Hv6wq1BWINXBTdKriEKkI1DhW2QAfhttcxxANiFZCBbglQSJUL i2dASrm4rFz9XLgAwJNbyQ== """) -##file activate.ps1 +# file activate.ps1 ACTIVATE_PS = convert(""" eJylWdmS40Z2fVeE/oHT6rCloNUEAXDThB6wAyQAEjsB29GBjdgXYiWgmC/zgz/Jv+AEWNVd3S2N xuOKYEUxM+/Jmzfvcm7W//zXf/+wUMOoXtyi1F9kbd0sHH/hFc2iLtrK9b3FrSqyxaVQwr8uhqJd @@ -2219,7 +2261,7 @@ m5beZzfQUelEXnhzb/pIROKx3F7qCttYIFGh5dXNzFzID7u8vKykA8Uejf7XXz//S4nKvW//ofS/ QastYw== """) -##file distutils-init.py +# file distutils-init.py DISTUTILS_INIT = convert(""" eJytV92L4zYQf/dfMU0ottuse7RvC6FQrg8Lxz2Ugz4si9HacqKuIxlJ2ST313dG8odkO9d7aGBB luZLv/nNjFacOqUtKJMIvzK3cXlhWgp5MDBsqK5SNYftsBAGpLLA4F1oe2Ytl+9wUvW55TswCi4c @@ -2245,14 +2287,14 @@ gtEMcW1xKr/he4/6IQ6FUXP+0gkioHY5iwC9Eyx3HKO7af0zPPe+XyLn7fAY78k4aiR387bCr5XT 5C4rFgwLGfMvJuAMew== """) -##file distutils.cfg +# file distutils.cfg DISTUTILS_CFG = convert(""" eJxNj00KwkAMhfc9xYNuxe4Ft57AjYiUtDO1wXSmNJnK3N5pdSEEAu8nH6lxHVlRhtDHMPATA4uH xJ4EFmGbvfJiicSHFRzUSISMY6hq3GLCRLnIvSTnEefN0FIjw5tF0Hkk9Q5dRunBsVoyFi24aaLg 9FDOlL0FPGluf4QjcInLlxd6f6rqkgPu/5nHLg0cXCscXoozRrP51DRT3j9QNl99AP53T2Q= """) -##file activate_this.py +# file activate_this.py ACTIVATE_THIS = convert(""" eJyNU01v2zAMvetXEB4K21jmDOstQA4dMGCHbeihlyEIDMWmG62yJEiKE//7kXKdpN2KzYBt8euR fKSyLPs8wiEo8wh4wqZTGou4V6Hm0wJa1cSiTkJdr8+GsoTRHuCotBayiWqQEYGtMCgfD1KjGYBe @@ -2269,6 +2311,6 @@ s3az+sj7eA0jfgPfeoN1 if __name__ == '__main__': main() -## TODO: -## Copy python.exe.manifest -## Monkeypatch distutils.sysconfig +# TODO: +# Copy python.exe.manifest +# Monkeypatch distutils.sysconfig |