virtualenv/web/virtualenv.py
author ymh <ymh.work@gmail.com>
Sun, 09 Sep 2012 21:35:10 +0200
changeset 243 1f2840354865
child 272 1c774f7a0341
permissions -rw-r--r--
correct filter on tag completion to avoid tags that are not translated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
243
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/env python
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
"""Create a "virtual" Python installation
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
     3
"""
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
     5
# If you change the version here, change it in setup.py
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
# and docs/conf.py as well.
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
virtualenv_version = "1.7.1.2"
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
     8
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
     9
import base64
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
import sys
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
import os
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    12
import optparse
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    13
import re
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    14
import shutil
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    15
import logging
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    16
import tempfile
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    17
import zlib
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    18
import errno
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    19
import distutils.sysconfig
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    20
from distutils.util import strtobool
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    21
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    22
try:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    23
    import subprocess
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    24
except ImportError:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    25
    if sys.version_info <= (2, 3):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    26
        print('ERROR: %s' % sys.exc_info()[1])
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    27
        print('ERROR: this script requires Python 2.4 or greater; or at least the subprocess module.')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    28
        print('If you copy subprocess.py from a newer version of Python this script will probably work')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    29
        sys.exit(101)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    30
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    31
        raise
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    32
try:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    33
    set
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    34
except NameError:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    35
    from sets import Set as set
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    36
try:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    37
    basestring
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    38
except NameError:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    39
    basestring = str
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    40
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    41
try:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    42
    import ConfigParser
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    43
except ImportError:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    44
    import configparser as ConfigParser
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    45
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    46
join = os.path.join
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    47
py_version = 'python%s.%s' % (sys.version_info[0], sys.version_info[1])
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    48
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    49
is_jython = sys.platform.startswith('java')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    50
is_pypy = hasattr(sys, 'pypy_version_info')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    51
is_win  = (sys.platform == 'win32')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    52
abiflags = getattr(sys, 'abiflags', '')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
user_dir = os.path.expanduser('~')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    55
if sys.platform == 'win32':
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    56
    user_dir = os.environ.get('APPDATA', user_dir)  # Use %APPDATA% for roaming
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    57
    default_storage_dir = os.path.join(user_dir, 'virtualenv')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    58
else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    59
    default_storage_dir = os.path.join(user_dir, '.virtualenv')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    60
default_config_file = os.path.join(default_storage_dir, 'virtualenv.ini')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    61
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    62
if is_pypy:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    63
    expected_exe = 'pypy'
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    64
elif is_jython:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    65
    expected_exe = 'jython'
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    66
else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
    expected_exe = 'python'
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    69
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    70
REQUIRED_MODULES = ['os', 'posix', 'posixpath', 'nt', 'ntpath', 'genericpath',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    71
                    'fnmatch', 'locale', 'encodings', 'codecs',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    72
                    'stat', 'UserDict', 'readline', 'copy_reg', 'types',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    73
                    're', 'sre', 'sre_parse', 'sre_constants', 'sre_compile',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    74
                    'zlib']
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    75
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    76
REQUIRED_FILES = ['lib-dynload', 'config']
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    77
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    78
majver, minver = sys.version_info[:2]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    79
if majver == 2:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    80
    if minver >= 6:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    81
        REQUIRED_MODULES.extend(['warnings', 'linecache', '_abcoll', 'abc'])
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    82
    if minver >= 7:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    83
        REQUIRED_MODULES.extend(['_weakrefset'])
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    84
    if minver <= 3:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    85
        REQUIRED_MODULES.extend(['sets', '__future__'])
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    86
elif majver == 3:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    87
    # Some extra modules are needed for Python 3, but different ones
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    88
    # for different versions.
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    89
    REQUIRED_MODULES.extend(['_abcoll', 'warnings', 'linecache', 'abc', 'io',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    90
                             '_weakrefset', 'copyreg', 'tempfile', 'random',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    91
                             '__future__', 'collections', 'keyword', 'tarfile',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    92
                             'shutil', 'struct', 'copy'])
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    93
    if minver >= 2:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    94
        REQUIRED_FILES[-1] = 'config-%s' % majver
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    95
    if minver == 3:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    96
        # The whole list of 3.3 modules is reproduced below - the current
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    97
        # uncommented ones are required for 3.3 as of now, but more may be
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    98
        # added as 3.3 development continues.
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
    99
        REQUIRED_MODULES.extend([
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   100
            #"aifc",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   101
            #"antigravity",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   102
            #"argparse",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   103
            #"ast",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   104
            #"asynchat",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   105
            #"asyncore",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   106
            "base64",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   107
            #"bdb",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   108
            #"binhex",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   109
            "bisect",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   110
            #"calendar",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   111
            #"cgi",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   112
            #"cgitb",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   113
            #"chunk",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   114
            #"cmd",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   115
            #"codeop",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   116
            #"code",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   117
            #"colorsys",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   118
            #"_compat_pickle",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   119
            #"compileall",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   120
            #"concurrent",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   121
            #"configparser",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   122
            #"contextlib",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   123
            #"cProfile",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   124
            #"crypt",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   125
            #"csv",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   126
            #"ctypes",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   127
            #"curses",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   128
            #"datetime",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   129
            #"dbm",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   130
            #"decimal",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   131
            #"difflib",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   132
            #"dis",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   133
            #"doctest",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   134
            #"dummy_threading",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   135
            "_dummy_thread",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   136
            #"email",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   137
            #"filecmp",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   138
            #"fileinput",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   139
            #"formatter",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   140
            #"fractions",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   141
            #"ftplib",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   142
            #"functools",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   143
            #"getopt",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   144
            #"getpass",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   145
            #"gettext",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   146
            #"glob",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   147
            #"gzip",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   148
            "hashlib",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   149
            "heapq",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   150
            "hmac",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   151
            #"html",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   152
            #"http",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   153
            #"idlelib",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   154
            #"imaplib",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   155
            #"imghdr",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   156
            #"importlib",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   157
            #"inspect",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   158
            #"json",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   159
            #"lib2to3",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   160
            #"logging",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   161
            #"macpath",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   162
            #"macurl2path",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   163
            #"mailbox",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   164
            #"mailcap",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   165
            #"_markupbase",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   166
            #"mimetypes",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   167
            #"modulefinder",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   168
            #"multiprocessing",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   169
            #"netrc",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   170
            #"nntplib",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   171
            #"nturl2path",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   172
            #"numbers",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   173
            #"opcode",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   174
            #"optparse",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   175
            #"os2emxpath",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   176
            #"pdb",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   177
            #"pickle",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   178
            #"pickletools",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   179
            #"pipes",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   180
            #"pkgutil",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   181
            #"platform",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   182
            #"plat-linux2",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   183
            #"plistlib",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   184
            #"poplib",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   185
            #"pprint",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   186
            #"profile",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   187
            #"pstats",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   188
            #"pty",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   189
            #"pyclbr",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   190
            #"py_compile",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   191
            #"pydoc_data",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   192
            #"pydoc",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   193
            #"_pyio",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   194
            #"queue",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   195
            #"quopri",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   196
            "reprlib",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   197
            "rlcompleter",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   198
            #"runpy",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   199
            #"sched",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   200
            #"shelve",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   201
            #"shlex",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   202
            #"smtpd",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   203
            #"smtplib",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   204
            #"sndhdr",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   205
            #"socket",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   206
            #"socketserver",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   207
            #"sqlite3",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   208
            #"ssl",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   209
            #"stringprep",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   210
            #"string",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   211
            #"_strptime",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   212
            #"subprocess",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   213
            #"sunau",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   214
            #"symbol",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   215
            #"symtable",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   216
            #"sysconfig",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   217
            #"tabnanny",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   218
            #"telnetlib",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   219
            #"test",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   220
            #"textwrap",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   221
            #"this",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   222
            #"_threading_local",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   223
            #"threading",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   224
            #"timeit",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   225
            #"tkinter",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   226
            #"tokenize",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   227
            #"token",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   228
            #"traceback",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   229
            #"trace",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   230
            #"tty",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   231
            #"turtledemo",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   232
            #"turtle",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   233
            #"unittest",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   234
            #"urllib",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   235
            #"uuid",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   236
            #"uu",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   237
            #"wave",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   238
            "weakref",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   239
            #"webbrowser",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   240
            #"wsgiref",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   241
            #"xdrlib",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   242
            #"xml",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   243
            #"xmlrpc",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   244
            #"zipfile",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   245
        ])
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   246
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   247
if is_pypy:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   248
    # these are needed to correctly display the exceptions that may happen
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   249
    # during the bootstrap
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   250
    REQUIRED_MODULES.extend(['traceback', 'linecache'])
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   251
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   252
class Logger(object):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   253
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   254
    """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   255
    Logging object for use in command-line script.  Allows ranges of
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   256
    levels, to avoid some redundancy of displayed information.
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   257
    """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   258
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   259
    DEBUG = logging.DEBUG
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   260
    INFO = logging.INFO
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   261
    NOTIFY = (logging.INFO+logging.WARN)/2
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   262
    WARN = WARNING = logging.WARN
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   263
    ERROR = logging.ERROR
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   264
    FATAL = logging.FATAL
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   265
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   266
    LEVELS = [DEBUG, INFO, NOTIFY, WARN, ERROR, FATAL]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   267
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   268
    def __init__(self, consumers):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   269
        self.consumers = consumers
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   270
        self.indent = 0
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   271
        self.in_progress = None
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   272
        self.in_progress_hanging = False
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   273
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   274
    def debug(self, msg, *args, **kw):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   275
        self.log(self.DEBUG, msg, *args, **kw)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   276
    def info(self, msg, *args, **kw):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   277
        self.log(self.INFO, msg, *args, **kw)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   278
    def notify(self, msg, *args, **kw):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   279
        self.log(self.NOTIFY, msg, *args, **kw)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   280
    def warn(self, msg, *args, **kw):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   281
        self.log(self.WARN, msg, *args, **kw)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   282
    def error(self, msg, *args, **kw):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   283
        self.log(self.WARN, msg, *args, **kw)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   284
    def fatal(self, msg, *args, **kw):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   285
        self.log(self.FATAL, msg, *args, **kw)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   286
    def log(self, level, msg, *args, **kw):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   287
        if args:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   288
            if kw:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   289
                raise TypeError(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   290
                    "You may give positional or keyword arguments, not both")
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   291
        args = args or kw
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   292
        rendered = None
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   293
        for consumer_level, consumer in self.consumers:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   294
            if self.level_matches(level, consumer_level):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   295
                if (self.in_progress_hanging
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   296
                    and consumer in (sys.stdout, sys.stderr)):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   297
                    self.in_progress_hanging = False
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   298
                    sys.stdout.write('\n')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   299
                    sys.stdout.flush()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   300
                if rendered is None:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   301
                    if args:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   302
                        rendered = msg % args
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   303
                    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   304
                        rendered = msg
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   305
                    rendered = ' '*self.indent + rendered
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   306
                if hasattr(consumer, 'write'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   307
                    consumer.write(rendered+'\n')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   308
                else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   309
                    consumer(rendered)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   310
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   311
    def start_progress(self, msg):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   312
        assert not self.in_progress, (
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   313
            "Tried to start_progress(%r) while in_progress %r"
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   314
            % (msg, self.in_progress))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   315
        if self.level_matches(self.NOTIFY, self._stdout_level()):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   316
            sys.stdout.write(msg)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   317
            sys.stdout.flush()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   318
            self.in_progress_hanging = True
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   319
        else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   320
            self.in_progress_hanging = False
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   321
        self.in_progress = msg
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   322
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   323
    def end_progress(self, msg='done.'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   324
        assert self.in_progress, (
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   325
            "Tried to end_progress without start_progress")
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   326
        if self.stdout_level_matches(self.NOTIFY):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   327
            if not self.in_progress_hanging:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   328
                # Some message has been printed out since start_progress
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   329
                sys.stdout.write('...' + self.in_progress + msg + '\n')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   330
                sys.stdout.flush()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   331
            else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   332
                sys.stdout.write(msg + '\n')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   333
                sys.stdout.flush()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   334
        self.in_progress = None
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   335
        self.in_progress_hanging = False
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   336
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   337
    def show_progress(self):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   338
        """If we are in a progress scope, and no log messages have been
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   339
        shown, write out another '.'"""
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   340
        if self.in_progress_hanging:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   341
            sys.stdout.write('.')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   342
            sys.stdout.flush()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   343
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   344
    def stdout_level_matches(self, level):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   345
        """Returns true if a message at this level will go to stdout"""
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   346
        return self.level_matches(level, self._stdout_level())
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   347
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   348
    def _stdout_level(self):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   349
        """Returns the level that stdout runs at"""
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   350
        for level, consumer in self.consumers:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   351
            if consumer is sys.stdout:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   352
                return level
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   353
        return self.FATAL
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   354
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   355
    def level_matches(self, level, consumer_level):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   356
        """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   357
        >>> l = Logger([])
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   358
        >>> l.level_matches(3, 4)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   359
        False
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   360
        >>> l.level_matches(3, 2)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   361
        True
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   362
        >>> l.level_matches(slice(None, 3), 3)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   363
        False
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   364
        >>> l.level_matches(slice(None, 3), 2)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   365
        True
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   366
        >>> l.level_matches(slice(1, 3), 1)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   367
        True
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   368
        >>> l.level_matches(slice(2, 3), 1)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   369
        False
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   370
        """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   371
        if isinstance(level, slice):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   372
            start, stop = level.start, level.stop
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   373
            if start is not None and start > consumer_level:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   374
                return False
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   375
            if stop is not None and stop <= consumer_level:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   376
                return False
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   377
            return True
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   378
        else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   379
            return level >= consumer_level
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   380
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   381
    #@classmethod
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   382
    def level_for_integer(cls, level):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   383
        levels = cls.LEVELS
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   384
        if level < 0:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   385
            return levels[0]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   386
        if level >= len(levels):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   387
            return levels[-1]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   388
        return levels[level]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   389
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   390
    level_for_integer = classmethod(level_for_integer)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   391
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   392
# create a silent logger just to prevent this from being undefined
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   393
# will be overridden with requested verbosity main() is called.
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   394
logger = Logger([(Logger.LEVELS[-1], sys.stdout)])
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   395
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   396
def mkdir(path):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   397
    if not os.path.exists(path):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   398
        logger.info('Creating %s', path)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   399
        os.makedirs(path)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   400
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   401
        logger.info('Directory %s already exists', path)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   402
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   403
def copyfileordir(src, dest):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   404
    if os.path.isdir(src):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   405
        shutil.copytree(src, dest, True)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   406
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   407
        shutil.copy2(src, dest)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   408
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   409
def copyfile(src, dest, symlink=True):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   410
    if not os.path.exists(src):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   411
        # Some bad symlink in the src
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   412
        logger.warn('Cannot find file %s (bad symlink)', src)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   413
        return
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   414
    if os.path.exists(dest):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   415
        logger.debug('File %s already exists', dest)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   416
        return
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   417
    if not os.path.exists(os.path.dirname(dest)):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   418
        logger.info('Creating parent directories for %s' % os.path.dirname(dest))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   419
        os.makedirs(os.path.dirname(dest))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   420
    if not os.path.islink(src):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   421
        srcpath = os.path.abspath(src)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   422
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   423
        srcpath = os.readlink(src)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   424
    if symlink and hasattr(os, 'symlink') and not is_win:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   425
        logger.info('Symlinking %s', dest)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   426
        try:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   427
            os.symlink(srcpath, dest)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   428
        except (OSError, NotImplementedError):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   429
            logger.info('Symlinking failed, copying to %s', dest)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   430
            copyfileordir(src, dest)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   431
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   432
        logger.info('Copying to %s', dest)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   433
        copyfileordir(src, dest)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   434
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   435
def writefile(dest, content, overwrite=True):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   436
    if not os.path.exists(dest):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   437
        logger.info('Writing %s', dest)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   438
        f = open(dest, 'wb')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   439
        f.write(content.encode('utf-8'))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   440
        f.close()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   441
        return
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   442
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   443
        f = open(dest, 'rb')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   444
        c = f.read()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   445
        f.close()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   446
        if c != content:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   447
            if not overwrite:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   448
                logger.notify('File %s exists with different content; not overwriting', dest)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   449
                return
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   450
            logger.notify('Overwriting %s with new content', dest)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   451
            f = open(dest, 'wb')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   452
            f.write(content.encode('utf-8'))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   453
            f.close()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   454
        else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   455
            logger.info('Content %s already in place', dest)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   456
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   457
def rmtree(dir):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   458
    if os.path.exists(dir):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   459
        logger.notify('Deleting tree %s', dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   460
        shutil.rmtree(dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   461
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   462
        logger.info('Do not need to delete %s; already gone', dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   463
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   464
def make_exe(fn):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   465
    if hasattr(os, 'chmod'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   466
        oldmode = os.stat(fn).st_mode & 0xFFF # 0o7777
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   467
        newmode = (oldmode | 0x16D) & 0xFFF # 0o555, 0o7777
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   468
        os.chmod(fn, newmode)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   469
        logger.info('Changed mode of %s to %s', fn, oct(newmode))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   470
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   471
def _find_file(filename, dirs):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   472
    for dir in reversed(dirs):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   473
        if os.path.exists(join(dir, filename)):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   474
            return join(dir, filename)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   475
    return filename
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   476
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   477
def _install_req(py_executable, unzip=False, distribute=False,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   478
                 search_dirs=None, never_download=False):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   479
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   480
    if search_dirs is None:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   481
        search_dirs = file_search_dirs()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   482
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   483
    if not distribute:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   484
        setup_fn = 'setuptools-0.6c11-py%s.egg' % sys.version[:3]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   485
        project_name = 'setuptools'
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   486
        bootstrap_script = EZ_SETUP_PY
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   487
        source = None
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   488
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   489
        setup_fn = None
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   490
        source = 'distribute-0.6.24.tar.gz'
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   491
        project_name = 'distribute'
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   492
        bootstrap_script = DISTRIBUTE_SETUP_PY
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   493
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   494
    if setup_fn is not None:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   495
        setup_fn = _find_file(setup_fn, search_dirs)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   496
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   497
    if source is not None:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   498
        source = _find_file(source, search_dirs)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   499
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   500
    if is_jython and os._name == 'nt':
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   501
        # Jython's .bat sys.executable can't handle a command line
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   502
        # argument with newlines
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   503
        fd, ez_setup = tempfile.mkstemp('.py')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   504
        os.write(fd, bootstrap_script)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   505
        os.close(fd)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   506
        cmd = [py_executable, ez_setup]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   507
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   508
        cmd = [py_executable, '-c', bootstrap_script]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   509
    if unzip:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   510
        cmd.append('--always-unzip')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   511
    env = {}
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   512
    remove_from_env = []
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   513
    if logger.stdout_level_matches(logger.DEBUG):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   514
        cmd.append('-v')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   515
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   516
    old_chdir = os.getcwd()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   517
    if setup_fn is not None and os.path.exists(setup_fn):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   518
        logger.info('Using existing %s egg: %s' % (project_name, setup_fn))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   519
        cmd.append(setup_fn)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   520
        if os.environ.get('PYTHONPATH'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   521
            env['PYTHONPATH'] = setup_fn + os.path.pathsep + os.environ['PYTHONPATH']
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   522
        else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   523
            env['PYTHONPATH'] = setup_fn
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   524
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   525
        # the source is found, let's chdir
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   526
        if source is not None and os.path.exists(source):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   527
            logger.info('Using existing %s egg: %s' % (project_name, source))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   528
            os.chdir(os.path.dirname(source))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   529
            # in this case, we want to be sure that PYTHONPATH is unset (not
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   530
            # just empty, really unset), else CPython tries to import the
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   531
            # site.py that it's in virtualenv_support
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   532
            remove_from_env.append('PYTHONPATH')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   533
        else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   534
            if never_download:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   535
                logger.fatal("Can't find any local distributions of %s to install "
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   536
                             "and --never-download is set.  Either re-run virtualenv "
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   537
                             "without the --never-download option, or place a %s "
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   538
                             "distribution (%s) in one of these "
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   539
                             "locations: %r" % (project_name, project_name,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   540
                                                setup_fn or source,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   541
                                                search_dirs))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   542
                sys.exit(1)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   543
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   544
            logger.info('No %s egg found; downloading' % project_name)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   545
        cmd.extend(['--always-copy', '-U', project_name])
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   546
    logger.start_progress('Installing %s...' % project_name)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   547
    logger.indent += 2
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   548
    cwd = None
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   549
    if project_name == 'distribute':
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   550
        env['DONT_PATCH_SETUPTOOLS'] = 'true'
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   551
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   552
    def _filter_ez_setup(line):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   553
        return filter_ez_setup(line, project_name)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   554
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   555
    if not os.access(os.getcwd(), os.W_OK):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   556
        cwd = tempfile.mkdtemp()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   557
        if source is not None and os.path.exists(source):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   558
            # the current working dir is hostile, let's copy the
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   559
            # tarball to a temp dir
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   560
            target = os.path.join(cwd, os.path.split(source)[-1])
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   561
            shutil.copy(source, target)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   562
    try:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   563
        call_subprocess(cmd, show_stdout=False,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   564
                        filter_stdout=_filter_ez_setup,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   565
                        extra_env=env,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   566
                        remove_from_env=remove_from_env,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   567
                        cwd=cwd)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   568
    finally:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   569
        logger.indent -= 2
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   570
        logger.end_progress()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   571
        if os.getcwd() != old_chdir:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   572
            os.chdir(old_chdir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   573
        if is_jython and os._name == 'nt':
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   574
            os.remove(ez_setup)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   575
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   576
def file_search_dirs():
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   577
    here = os.path.dirname(os.path.abspath(__file__))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   578
    dirs = ['.', here,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   579
            join(here, 'virtualenv_support')]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   580
    if os.path.splitext(os.path.dirname(__file__))[0] != 'virtualenv':
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   581
        # Probably some boot script; just in case virtualenv is installed...
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   582
        try:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   583
            import virtualenv
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   584
        except ImportError:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   585
            pass
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   586
        else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   587
            dirs.append(os.path.join(os.path.dirname(virtualenv.__file__), 'virtualenv_support'))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   588
    return [d for d in dirs if os.path.isdir(d)]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   589
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   590
def install_setuptools(py_executable, unzip=False,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   591
                       search_dirs=None, never_download=False):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   592
    _install_req(py_executable, unzip,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   593
                 search_dirs=search_dirs, never_download=never_download)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   594
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   595
def install_distribute(py_executable, unzip=False,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   596
                       search_dirs=None, never_download=False):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   597
    _install_req(py_executable, unzip, distribute=True,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   598
                 search_dirs=search_dirs, never_download=never_download)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   599
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   600
_pip_re = re.compile(r'^pip-.*(zip|tar.gz|tar.bz2|tgz|tbz)$', re.I)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   601
def install_pip(py_executable, search_dirs=None, never_download=False):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   602
    if search_dirs is None:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   603
        search_dirs = file_search_dirs()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   604
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   605
    filenames = []
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   606
    for dir in search_dirs:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   607
        filenames.extend([join(dir, fn) for fn in os.listdir(dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   608
                          if _pip_re.search(fn)])
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   609
    filenames = [(os.path.basename(filename).lower(), i, filename) for i, filename in enumerate(filenames)]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   610
    filenames.sort()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   611
    filenames = [filename for basename, i, filename in filenames]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   612
    if not filenames:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   613
        filename = 'pip'
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   614
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   615
        filename = filenames[-1]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   616
    easy_install_script = 'easy_install'
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   617
    if sys.platform == 'win32':
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   618
        easy_install_script = 'easy_install-script.py'
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   619
    cmd = [join(os.path.dirname(py_executable), easy_install_script), filename]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   620
    if sys.platform == 'win32':
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   621
        cmd.insert(0, py_executable)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   622
    if filename == 'pip':
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   623
        if never_download:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   624
            logger.fatal("Can't find any local distributions of pip to install "
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   625
                         "and --never-download is set.  Either re-run virtualenv "
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   626
                         "without the --never-download option, or place a pip "
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   627
                         "source distribution (zip/tar.gz/tar.bz2) in one of these "
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   628
                         "locations: %r" % search_dirs)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   629
            sys.exit(1)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   630
        logger.info('Installing pip from network...')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   631
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   632
        logger.info('Installing existing %s distribution: %s' % (
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   633
                os.path.basename(filename), filename))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   634
    logger.start_progress('Installing pip...')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   635
    logger.indent += 2
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   636
    def _filter_setup(line):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   637
        return filter_ez_setup(line, 'pip')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   638
    try:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   639
        call_subprocess(cmd, show_stdout=False,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   640
                        filter_stdout=_filter_setup)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   641
    finally:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   642
        logger.indent -= 2
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   643
        logger.end_progress()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   644
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   645
def filter_ez_setup(line, project_name='setuptools'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   646
    if not line.strip():
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   647
        return Logger.DEBUG
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   648
    if project_name == 'distribute':
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   649
        for prefix in ('Extracting', 'Now working', 'Installing', 'Before',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   650
                       'Scanning', 'Setuptools', 'Egg', 'Already',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   651
                       'running', 'writing', 'reading', 'installing',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   652
                       'creating', 'copying', 'byte-compiling', 'removing',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   653
                       'Processing'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   654
            if line.startswith(prefix):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   655
                return Logger.DEBUG
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   656
        return Logger.DEBUG
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   657
    for prefix in ['Reading ', 'Best match', 'Processing setuptools',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   658
                   'Copying setuptools', 'Adding setuptools',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   659
                   'Installing ', 'Installed ']:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   660
        if line.startswith(prefix):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   661
            return Logger.DEBUG
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   662
    return Logger.INFO
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   663
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   664
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   665
class UpdatingDefaultsHelpFormatter(optparse.IndentedHelpFormatter):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   666
    """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   667
    Custom help formatter for use in ConfigOptionParser that updates
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   668
    the defaults before expanding them, allowing them to show up correctly
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   669
    in the help listing
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   670
    """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   671
    def expand_default(self, option):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   672
        if self.parser is not None:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   673
            self.parser.update_defaults(self.parser.defaults)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   674
        return optparse.IndentedHelpFormatter.expand_default(self, option)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   675
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   676
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   677
class ConfigOptionParser(optparse.OptionParser):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   678
    """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   679
    Custom option parser which updates its defaults by by checking the
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   680
    configuration files and environmental variables
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   681
    """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   682
    def __init__(self, *args, **kwargs):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   683
        self.config = ConfigParser.RawConfigParser()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   684
        self.files = self.get_config_files()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   685
        self.config.read(self.files)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   686
        optparse.OptionParser.__init__(self, *args, **kwargs)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   687
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   688
    def get_config_files(self):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   689
        config_file = os.environ.get('VIRTUALENV_CONFIG_FILE', False)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   690
        if config_file and os.path.exists(config_file):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   691
            return [config_file]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   692
        return [default_config_file]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   693
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   694
    def update_defaults(self, defaults):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   695
        """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   696
        Updates the given defaults with values from the config files and
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   697
        the environ. Does a little special handling for certain types of
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   698
        options (lists).
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   699
        """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   700
        # Then go and look for the other sources of configuration:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   701
        config = {}
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   702
        # 1. config files
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   703
        config.update(dict(self.get_config_section('virtualenv')))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   704
        # 2. environmental variables
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   705
        config.update(dict(self.get_environ_vars()))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   706
        # Then set the options with those values
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   707
        for key, val in config.items():
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   708
            key = key.replace('_', '-')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   709
            if not key.startswith('--'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   710
                key = '--%s' % key  # only prefer long opts
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   711
            option = self.get_option(key)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   712
            if option is not None:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   713
                # ignore empty values
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   714
                if not val:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   715
                    continue
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   716
                # handle multiline configs
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   717
                if option.action == 'append':
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   718
                    val = val.split()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   719
                else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   720
                    option.nargs = 1
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   721
                if option.action in ('store_true', 'store_false', 'count'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   722
                    val = strtobool(val)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   723
                try:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   724
                    val = option.convert_value(key, val)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   725
                except optparse.OptionValueError:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   726
                    e = sys.exc_info()[1]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   727
                    print("An error occured during configuration: %s" % e)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   728
                    sys.exit(3)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   729
                defaults[option.dest] = val
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   730
        return defaults
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   731
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   732
    def get_config_section(self, name):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   733
        """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   734
        Get a section of a configuration
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   735
        """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   736
        if self.config.has_section(name):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   737
            return self.config.items(name)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   738
        return []
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   739
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   740
    def get_environ_vars(self, prefix='VIRTUALENV_'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   741
        """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   742
        Returns a generator with all environmental vars with prefix VIRTUALENV
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   743
        """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   744
        for key, val in os.environ.items():
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   745
            if key.startswith(prefix):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   746
                yield (key.replace(prefix, '').lower(), val)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   747
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   748
    def get_default_values(self):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   749
        """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   750
        Overridding to make updating the defaults after instantiation of
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   751
        the option parser possible, update_defaults() does the dirty work.
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   752
        """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   753
        if not self.process_default_values:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   754
            # Old, pre-Optik 1.5 behaviour.
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   755
            return optparse.Values(self.defaults)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   756
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   757
        defaults = self.update_defaults(self.defaults.copy()) # ours
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   758
        for option in self._get_all_options():
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   759
            default = defaults.get(option.dest)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   760
            if isinstance(default, basestring):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   761
                opt_str = option.get_opt_string()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   762
                defaults[option.dest] = option.check_value(opt_str, default)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   763
        return optparse.Values(defaults)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   764
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   765
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   766
def main():
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   767
    parser = ConfigOptionParser(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   768
        version=virtualenv_version,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   769
        usage="%prog [OPTIONS] DEST_DIR",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   770
        formatter=UpdatingDefaultsHelpFormatter())
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   771
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   772
    parser.add_option(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   773
        '-v', '--verbose',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   774
        action='count',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   775
        dest='verbose',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   776
        default=0,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   777
        help="Increase verbosity")
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   778
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   779
    parser.add_option(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   780
        '-q', '--quiet',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   781
        action='count',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   782
        dest='quiet',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   783
        default=0,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   784
        help='Decrease verbosity')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   785
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   786
    parser.add_option(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   787
        '-p', '--python',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   788
        dest='python',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   789
        metavar='PYTHON_EXE',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   790
        help='The Python interpreter to use, e.g., --python=python2.5 will use the python2.5 '
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   791
        'interpreter to create the new environment.  The default is the interpreter that '
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   792
        'virtualenv was installed with (%s)' % sys.executable)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   793
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   794
    parser.add_option(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   795
        '--clear',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   796
        dest='clear',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   797
        action='store_true',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   798
        help="Clear out the non-root install and start from scratch")
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   799
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   800
    parser.add_option(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   801
        '--no-site-packages',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   802
        dest='no_site_packages',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   803
        action='store_true',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   804
        help="Don't give access to the global site-packages dir to the "
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   805
             "virtual environment")
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   806
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   807
    parser.add_option(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   808
        '--system-site-packages',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   809
        dest='system_site_packages',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   810
        action='store_true',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   811
        help="Give access to the global site-packages dir to the "
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   812
             "virtual environment")
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   813
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   814
    parser.add_option(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   815
        '--unzip-setuptools',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   816
        dest='unzip_setuptools',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   817
        action='store_true',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   818
        help="Unzip Setuptools or Distribute when installing it")
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   819
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   820
    parser.add_option(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   821
        '--relocatable',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   822
        dest='relocatable',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   823
        action='store_true',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   824
        help='Make an EXISTING virtualenv environment relocatable.  '
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   825
        'This fixes up scripts and makes all .pth files relative')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   826
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   827
    parser.add_option(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   828
        '--distribute',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   829
        dest='use_distribute',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   830
        action='store_true',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   831
        help='Use Distribute instead of Setuptools. Set environ variable '
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   832
        'VIRTUALENV_DISTRIBUTE to make it the default ')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   833
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   834
    default_search_dirs = file_search_dirs()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   835
    parser.add_option(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   836
        '--extra-search-dir',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   837
        dest="search_dirs",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   838
        action="append",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   839
        default=default_search_dirs,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   840
        help="Directory to look for setuptools/distribute/pip distributions in. "
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   841
        "You can add any number of additional --extra-search-dir paths.")
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   842
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   843
    parser.add_option(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   844
        '--never-download',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   845
        dest="never_download",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   846
        action="store_true",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   847
        help="Never download anything from the network.  Instead, virtualenv will fail "
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   848
        "if local distributions of setuptools/distribute/pip are not present.")
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   849
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   850
    parser.add_option(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   851
        '--prompt=',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   852
        dest='prompt',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   853
        help='Provides an alternative prompt prefix for this environment')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   854
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   855
    if 'extend_parser' in globals():
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   856
        extend_parser(parser)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   857
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   858
    options, args = parser.parse_args()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   859
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   860
    global logger
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   861
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   862
    if 'adjust_options' in globals():
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   863
        adjust_options(options, args)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   864
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   865
    verbosity = options.verbose - options.quiet
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   866
    logger = Logger([(Logger.level_for_integer(2-verbosity), sys.stdout)])
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   867
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   868
    if options.python and not os.environ.get('VIRTUALENV_INTERPRETER_RUNNING'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   869
        env = os.environ.copy()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   870
        interpreter = resolve_interpreter(options.python)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   871
        if interpreter == sys.executable:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   872
            logger.warn('Already using interpreter %s' % interpreter)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   873
        else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   874
            logger.notify('Running virtualenv with interpreter %s' % interpreter)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   875
            env['VIRTUALENV_INTERPRETER_RUNNING'] = 'true'
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   876
            file = __file__
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   877
            if file.endswith('.pyc'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   878
                file = file[:-1]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   879
            popen = subprocess.Popen([interpreter, file] + sys.argv[1:], env=env)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   880
            raise SystemExit(popen.wait())
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   881
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   882
    # Force --distribute on Python 3, since setuptools is not available.
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   883
    if majver > 2:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   884
        options.use_distribute = True
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   885
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   886
    if os.environ.get('PYTHONDONTWRITEBYTECODE') and not options.use_distribute:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   887
        print(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   888
            "The PYTHONDONTWRITEBYTECODE environment variable is "
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   889
            "not compatible with setuptools. Either use --distribute "
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   890
            "or unset PYTHONDONTWRITEBYTECODE.")
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   891
        sys.exit(2)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   892
    if not args:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   893
        print('You must provide a DEST_DIR')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   894
        parser.print_help()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   895
        sys.exit(2)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   896
    if len(args) > 1:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   897
        print('There must be only one argument: DEST_DIR (you gave %s)' % (
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   898
            ' '.join(args)))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   899
        parser.print_help()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   900
        sys.exit(2)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   901
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   902
    home_dir = args[0]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   903
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   904
    if os.environ.get('WORKING_ENV'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   905
        logger.fatal('ERROR: you cannot run virtualenv while in a workingenv')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   906
        logger.fatal('Please deactivate your workingenv, then re-run this script')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   907
        sys.exit(3)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   908
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   909
    if 'PYTHONHOME' in os.environ:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   910
        logger.warn('PYTHONHOME is set.  You *must* activate the virtualenv before using it')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   911
        del os.environ['PYTHONHOME']
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   912
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   913
    if options.relocatable:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   914
        make_environment_relocatable(home_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   915
        return
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   916
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   917
    if options.no_site_packages:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   918
        logger.warn('The --no-site-packages flag is deprecated; it is now '
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   919
                    'the default behavior.')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   920
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   921
    create_environment(home_dir,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   922
                       site_packages=options.system_site_packages,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   923
                       clear=options.clear,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   924
                       unzip_setuptools=options.unzip_setuptools,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   925
                       use_distribute=options.use_distribute,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   926
                       prompt=options.prompt,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   927
                       search_dirs=options.search_dirs,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   928
                       never_download=options.never_download)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   929
    if 'after_install' in globals():
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   930
        after_install(options, home_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   931
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   932
def call_subprocess(cmd, show_stdout=True,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   933
                    filter_stdout=None, cwd=None,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   934
                    raise_on_returncode=True, extra_env=None,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   935
                    remove_from_env=None):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   936
    cmd_parts = []
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   937
    for part in cmd:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   938
        if len(part) > 45:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   939
            part = part[:20]+"..."+part[-20:]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   940
        if ' ' in part or '\n' in part or '"' in part or "'" in part:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   941
            part = '"%s"' % part.replace('"', '\\"')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   942
        if hasattr(part, 'decode'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   943
            try:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   944
                part = part.decode(sys.getdefaultencoding())
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   945
            except UnicodeDecodeError:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   946
                part = part.decode(sys.getfilesystemencoding())
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   947
        cmd_parts.append(part)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   948
    cmd_desc = ' '.join(cmd_parts)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   949
    if show_stdout:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   950
        stdout = None
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   951
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   952
        stdout = subprocess.PIPE
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   953
    logger.debug("Running command %s" % cmd_desc)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   954
    if extra_env or remove_from_env:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   955
        env = os.environ.copy()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   956
        if extra_env:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   957
            env.update(extra_env)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   958
        if remove_from_env:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   959
            for varname in remove_from_env:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   960
                env.pop(varname, None)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   961
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   962
        env = None
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   963
    try:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   964
        proc = subprocess.Popen(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   965
            cmd, stderr=subprocess.STDOUT, stdin=None, stdout=stdout,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   966
            cwd=cwd, env=env)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   967
    except Exception:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   968
        e = sys.exc_info()[1]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   969
        logger.fatal(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   970
            "Error %s while executing command %s" % (e, cmd_desc))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   971
        raise
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   972
    all_output = []
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   973
    if stdout is not None:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   974
        stdout = proc.stdout
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   975
        encoding = sys.getdefaultencoding()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   976
        fs_encoding = sys.getfilesystemencoding()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   977
        while 1:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   978
            line = stdout.readline()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   979
            try:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   980
                line = line.decode(encoding)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   981
            except UnicodeDecodeError:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   982
                line = line.decode(fs_encoding)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   983
            if not line:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   984
                break
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   985
            line = line.rstrip()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   986
            all_output.append(line)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   987
            if filter_stdout:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   988
                level = filter_stdout(line)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   989
                if isinstance(level, tuple):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   990
                    level, line = level
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   991
                logger.log(level, line)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   992
                if not logger.stdout_level_matches(level):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   993
                    logger.show_progress()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   994
            else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   995
                logger.info(line)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   996
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   997
        proc.communicate()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   998
    proc.wait()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
   999
    if proc.returncode:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1000
        if raise_on_returncode:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1001
            if all_output:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1002
                logger.notify('Complete output from command %s:' % cmd_desc)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1003
                logger.notify('\n'.join(all_output) + '\n----------------------------------------')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1004
            raise OSError(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1005
                "Command %s failed with error code %s"
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1006
                % (cmd_desc, proc.returncode))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1007
        else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1008
            logger.warn(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1009
                "Command %s had error code %s"
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1010
                % (cmd_desc, proc.returncode))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1011
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1012
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1013
def create_environment(home_dir, site_packages=False, clear=False,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1014
                       unzip_setuptools=False, use_distribute=False,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1015
                       prompt=None, search_dirs=None, never_download=False):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1016
    """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1017
    Creates a new environment in ``home_dir``.
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1018
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1019
    If ``site_packages`` is true, then the global ``site-packages/``
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1020
    directory will be on the path.
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1021
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1022
    If ``clear`` is true (default False) then the environment will
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1023
    first be cleared.
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1024
    """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1025
    home_dir, lib_dir, inc_dir, bin_dir = path_locations(home_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1026
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1027
    py_executable = os.path.abspath(install_python(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1028
        home_dir, lib_dir, inc_dir, bin_dir,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1029
        site_packages=site_packages, clear=clear))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1030
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1031
    install_distutils(home_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1032
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1033
    # use_distribute also is True if VIRTUALENV_DISTRIBUTE env var is set
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1034
    # we also check VIRTUALENV_USE_DISTRIBUTE for backwards compatibility
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1035
    if use_distribute or os.environ.get('VIRTUALENV_USE_DISTRIBUTE'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1036
        install_distribute(py_executable, unzip=unzip_setuptools,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1037
                           search_dirs=search_dirs, never_download=never_download)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1038
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1039
        install_setuptools(py_executable, unzip=unzip_setuptools,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1040
                           search_dirs=search_dirs, never_download=never_download)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1041
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1042
    install_pip(py_executable, search_dirs=search_dirs, never_download=never_download)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1043
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1044
    install_activate(home_dir, bin_dir, prompt)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1045
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1046
def path_locations(home_dir):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1047
    """Return the path locations for the environment (where libraries are,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1048
    where scripts go, etc)"""
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1049
    # XXX: We'd use distutils.sysconfig.get_python_inc/lib but its
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1050
    # prefix arg is broken: http://bugs.python.org/issue3386
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1051
    if sys.platform == 'win32':
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1052
        # Windows has lots of problems with executables with spaces in
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1053
        # the name; this function will remove them (using the ~1
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1054
        # format):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1055
        mkdir(home_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1056
        if ' ' in home_dir:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1057
            try:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1058
                import win32api
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1059
            except ImportError:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1060
                print('Error: the path "%s" has a space in it' % home_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1061
                print('To handle these kinds of paths, the win32api module must be installed:')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1062
                print('  http://sourceforge.net/projects/pywin32/')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1063
                sys.exit(3)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1064
            home_dir = win32api.GetShortPathName(home_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1065
        lib_dir = join(home_dir, 'Lib')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1066
        inc_dir = join(home_dir, 'Include')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1067
        bin_dir = join(home_dir, 'Scripts')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1068
    elif is_jython:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1069
        lib_dir = join(home_dir, 'Lib')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1070
        inc_dir = join(home_dir, 'Include')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1071
        bin_dir = join(home_dir, 'bin')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1072
    elif is_pypy:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1073
        lib_dir = home_dir
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1074
        inc_dir = join(home_dir, 'include')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1075
        bin_dir = join(home_dir, 'bin')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1076
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1077
        lib_dir = join(home_dir, 'lib', py_version)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1078
        inc_dir = join(home_dir, 'include', py_version + abiflags)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1079
        bin_dir = join(home_dir, 'bin')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1080
    return home_dir, lib_dir, inc_dir, bin_dir
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1081
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1082
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1083
def change_prefix(filename, dst_prefix):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1084
    prefixes = [sys.prefix]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1085
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1086
    if sys.platform == "darwin":
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1087
        prefixes.extend((
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1088
            os.path.join("/Library/Python", sys.version[:3], "site-packages"),
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1089
            os.path.join(sys.prefix, "Extras", "lib", "python"),
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1090
            os.path.join("~", "Library", "Python", sys.version[:3], "site-packages")))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1091
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1092
    if hasattr(sys, 'real_prefix'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1093
        prefixes.append(sys.real_prefix)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1094
    prefixes = list(map(os.path.abspath, prefixes))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1095
    filename = os.path.abspath(filename)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1096
    for src_prefix in prefixes:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1097
        if filename.startswith(src_prefix):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1098
            _, relpath = filename.split(src_prefix, 1)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1099
            assert relpath[0] == os.sep
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1100
            relpath = relpath[1:]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1101
            return join(dst_prefix, relpath)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1102
    assert False, "Filename %s does not start with any of these prefixes: %s" % \
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1103
        (filename, prefixes)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1104
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1105
def copy_required_modules(dst_prefix):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1106
    import imp
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1107
    # If we are running under -p, we need to remove the current
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1108
    # directory from sys.path temporarily here, so that we
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1109
    # definitely get the modules from the site directory of
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1110
    # the interpreter we are running under, not the one
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1111
    # virtualenv.py is installed under (which might lead to py2/py3
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1112
    # incompatibility issues)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1113
    _prev_sys_path = sys.path
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1114
    if os.environ.get('VIRTUALENV_INTERPRETER_RUNNING'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1115
        sys.path = sys.path[1:]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1116
    try:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1117
        for modname in REQUIRED_MODULES:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1118
            if modname in sys.builtin_module_names:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1119
                logger.info("Ignoring built-in bootstrap module: %s" % modname)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1120
                continue
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1121
            try:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1122
                f, filename, _ = imp.find_module(modname)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1123
            except ImportError:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1124
                logger.info("Cannot import bootstrap module: %s" % modname)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1125
            else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1126
                if f is not None:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1127
                    f.close()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1128
                dst_filename = change_prefix(filename, dst_prefix)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1129
                copyfile(filename, dst_filename)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1130
                if filename.endswith('.pyc'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1131
                    pyfile = filename[:-1]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1132
                    if os.path.exists(pyfile):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1133
                        copyfile(pyfile, dst_filename[:-1])
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1134
    finally:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1135
        sys.path = _prev_sys_path
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1136
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1137
def install_python(home_dir, lib_dir, inc_dir, bin_dir, site_packages, clear):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1138
    """Install just the base environment, no distutils patches etc"""
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1139
    if sys.executable.startswith(bin_dir):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1140
        print('Please use the *system* python to run this script')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1141
        return
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1142
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1143
    if clear:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1144
        rmtree(lib_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1145
        ## FIXME: why not delete it?
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1146
        ## Maybe it should delete everything with #!/path/to/venv/python in it
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1147
        logger.notify('Not deleting %s', bin_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1148
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1149
    if hasattr(sys, 'real_prefix'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1150
        logger.notify('Using real prefix %r' % sys.real_prefix)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1151
        prefix = sys.real_prefix
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1152
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1153
        prefix = sys.prefix
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1154
    mkdir(lib_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1155
    fix_lib64(lib_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1156
    stdlib_dirs = [os.path.dirname(os.__file__)]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1157
    if sys.platform == 'win32':
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1158
        stdlib_dirs.append(join(os.path.dirname(stdlib_dirs[0]), 'DLLs'))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1159
    elif sys.platform == 'darwin':
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1160
        stdlib_dirs.append(join(stdlib_dirs[0], 'site-packages'))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1161
    if hasattr(os, 'symlink'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1162
        logger.info('Symlinking Python bootstrap modules')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1163
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1164
        logger.info('Copying Python bootstrap modules')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1165
    logger.indent += 2
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1166
    try:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1167
        # copy required files...
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1168
        for stdlib_dir in stdlib_dirs:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1169
            if not os.path.isdir(stdlib_dir):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1170
                continue
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1171
            for fn in os.listdir(stdlib_dir):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1172
                bn = os.path.splitext(fn)[0]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1173
                if fn != 'site-packages' and bn in REQUIRED_FILES:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1174
                    copyfile(join(stdlib_dir, fn), join(lib_dir, fn))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1175
        # ...and modules
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1176
        copy_required_modules(home_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1177
    finally:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1178
        logger.indent -= 2
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1179
    mkdir(join(lib_dir, 'site-packages'))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1180
    import site
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1181
    site_filename = site.__file__
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1182
    if site_filename.endswith('.pyc'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1183
        site_filename = site_filename[:-1]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1184
    elif site_filename.endswith('$py.class'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1185
        site_filename = site_filename.replace('$py.class', '.py')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1186
    site_filename_dst = change_prefix(site_filename, home_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1187
    site_dir = os.path.dirname(site_filename_dst)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1188
    writefile(site_filename_dst, SITE_PY)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1189
    writefile(join(site_dir, 'orig-prefix.txt'), prefix)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1190
    site_packages_filename = join(site_dir, 'no-global-site-packages.txt')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1191
    if not site_packages:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1192
        writefile(site_packages_filename, '')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1193
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1194
        if os.path.exists(site_packages_filename):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1195
            logger.info('Deleting %s' % site_packages_filename)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1196
            os.unlink(site_packages_filename)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1197
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1198
    if is_pypy or is_win:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1199
        stdinc_dir = join(prefix, 'include')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1200
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1201
        stdinc_dir = join(prefix, 'include', py_version + abiflags)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1202
    if os.path.exists(stdinc_dir):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1203
        copyfile(stdinc_dir, inc_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1204
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1205
        logger.debug('No include dir %s' % stdinc_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1206
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1207
    # pypy never uses exec_prefix, just ignore it
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1208
    if sys.exec_prefix != prefix and not is_pypy:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1209
        if sys.platform == 'win32':
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1210
            exec_dir = join(sys.exec_prefix, 'lib')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1211
        elif is_jython:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1212
            exec_dir = join(sys.exec_prefix, 'Lib')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1213
        else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1214
            exec_dir = join(sys.exec_prefix, 'lib', py_version)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1215
        for fn in os.listdir(exec_dir):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1216
            copyfile(join(exec_dir, fn), join(lib_dir, fn))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1217
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1218
    if is_jython:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1219
        # Jython has either jython-dev.jar and javalib/ dir, or just
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1220
        # jython.jar
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1221
        for name in 'jython-dev.jar', 'javalib', 'jython.jar':
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1222
            src = join(prefix, name)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1223
            if os.path.exists(src):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1224
                copyfile(src, join(home_dir, name))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1225
        # XXX: registry should always exist after Jython 2.5rc1
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1226
        src = join(prefix, 'registry')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1227
        if os.path.exists(src):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1228
            copyfile(src, join(home_dir, 'registry'), symlink=False)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1229
        copyfile(join(prefix, 'cachedir'), join(home_dir, 'cachedir'),
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1230
                 symlink=False)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1231
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1232
    mkdir(bin_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1233
    py_executable = join(bin_dir, os.path.basename(sys.executable))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1234
    if 'Python.framework' in prefix:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1235
        if re.search(r'/Python(?:-32|-64)*$', py_executable):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1236
            # The name of the python executable is not quite what
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1237
            # we want, rename it.
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1238
            py_executable = os.path.join(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1239
                    os.path.dirname(py_executable), 'python')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1240
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1241
    logger.notify('New %s executable in %s', expected_exe, py_executable)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1242
    pcbuild_dir = os.path.dirname(sys.executable)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1243
    pyd_pth = os.path.join(lib_dir, 'site-packages', 'virtualenv_builddir_pyd.pth')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1244
    if is_win and os.path.exists(os.path.join(pcbuild_dir, 'build.bat')):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1245
        logger.notify('Detected python running from build directory %s', pcbuild_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1246
        logger.notify('Writing .pth file linking to build directory for *.pyd files')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1247
        writefile(pyd_pth, pcbuild_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1248
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1249
        pcbuild_dir = None
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1250
        if os.path.exists(pyd_pth):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1251
            logger.info('Deleting %s (not Windows env or not build directory python)' % pyd_pth)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1252
            os.unlink(pyd_pth)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1253
        
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1254
    if sys.executable != py_executable:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1255
        ## FIXME: could I just hard link?
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1256
        executable = sys.executable
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1257
        if sys.platform == 'cygwin' and os.path.exists(executable + '.exe'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1258
            # Cygwin misreports sys.executable sometimes
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1259
            executable += '.exe'
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1260
            py_executable += '.exe'
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1261
            logger.info('Executable actually exists in %s' % executable)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1262
        shutil.copyfile(executable, py_executable)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1263
        make_exe(py_executable)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1264
        if sys.platform == 'win32' or sys.platform == 'cygwin':
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1265
            pythonw = os.path.join(os.path.dirname(sys.executable), 'pythonw.exe')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1266
            if os.path.exists(pythonw):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1267
                logger.info('Also created pythonw.exe')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1268
                shutil.copyfile(pythonw, os.path.join(os.path.dirname(py_executable), 'pythonw.exe'))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1269
            python_d = os.path.join(os.path.dirname(sys.executable), 'python_d.exe')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1270
            python_d_dest = os.path.join(os.path.dirname(py_executable), 'python_d.exe')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1271
            if os.path.exists(python_d):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1272
                logger.info('Also created python_d.exe')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1273
                shutil.copyfile(python_d, python_d_dest)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1274
            elif os.path.exists(python_d_dest):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1275
                logger.info('Removed python_d.exe as it is no longer at the source')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1276
                os.unlink(python_d_dest)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1277
            # we need to copy the DLL to enforce that windows will load the correct one.
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1278
            # may not exist if we are cygwin.
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1279
            py_executable_dll = 'python%s%s.dll' % (
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1280
                sys.version_info[0], sys.version_info[1])
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1281
            py_executable_dll_d = 'python%s%s_d.dll' % (
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1282
                sys.version_info[0], sys.version_info[1])
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1283
            pythondll = os.path.join(os.path.dirname(sys.executable), py_executable_dll)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1284
            pythondll_d = os.path.join(os.path.dirname(sys.executable), py_executable_dll_d)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1285
            pythondll_d_dest = os.path.join(os.path.dirname(py_executable), py_executable_dll_d)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1286
            if os.path.exists(pythondll):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1287
                logger.info('Also created %s' % py_executable_dll)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1288
                shutil.copyfile(pythondll, os.path.join(os.path.dirname(py_executable), py_executable_dll))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1289
            if os.path.exists(pythondll_d):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1290
                logger.info('Also created %s' % py_executable_dll_d)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1291
                shutil.copyfile(pythondll_d, pythondll_d_dest)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1292
            elif os.path.exists(pythondll_d_dest):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1293
                logger.info('Removed %s as the source does not exist' % pythondll_d_dest)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1294
                os.unlink(pythondll_d_dest)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1295
        if is_pypy:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1296
            # make a symlink python --> pypy-c
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1297
            python_executable = os.path.join(os.path.dirname(py_executable), 'python')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1298
            logger.info('Also created executable %s' % python_executable)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1299
            copyfile(py_executable, python_executable)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1300
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1301
    if os.path.splitext(os.path.basename(py_executable))[0] != expected_exe:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1302
        secondary_exe = os.path.join(os.path.dirname(py_executable),
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1303
                                     expected_exe)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1304
        py_executable_ext = os.path.splitext(py_executable)[1]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1305
        if py_executable_ext == '.exe':
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1306
            # python2.4 gives an extension of '.4' :P
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1307
            secondary_exe += py_executable_ext
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1308
        if os.path.exists(secondary_exe):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1309
            logger.warn('Not overwriting existing %s script %s (you must use %s)'
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1310
                        % (expected_exe, secondary_exe, py_executable))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1311
        else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1312
            logger.notify('Also creating executable in %s' % secondary_exe)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1313
            shutil.copyfile(sys.executable, secondary_exe)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1314
            make_exe(secondary_exe)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1315
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1316
    if '.framework' in prefix:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1317
        if 'Python.framework' in prefix:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1318
            logger.debug('MacOSX Python framework detected')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1319
            # Make sure we use the the embedded interpreter inside
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1320
            # the framework, even if sys.executable points to
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1321
            # the stub executable in ${sys.prefix}/bin
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1322
            # See http://groups.google.com/group/python-virtualenv/
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1323
            #                              browse_thread/thread/17cab2f85da75951
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1324
            original_python = os.path.join(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1325
                prefix, 'Resources/Python.app/Contents/MacOS/Python')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1326
        if 'EPD' in prefix:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1327
            logger.debug('EPD framework detected')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1328
            original_python = os.path.join(prefix, 'bin/python')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1329
        shutil.copy(original_python, py_executable)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1330
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1331
        # Copy the framework's dylib into the virtual
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1332
        # environment
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1333
        virtual_lib = os.path.join(home_dir, '.Python')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1334
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1335
        if os.path.exists(virtual_lib):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1336
            os.unlink(virtual_lib)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1337
        copyfile(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1338
            os.path.join(prefix, 'Python'),
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1339
            virtual_lib)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1340
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1341
        # And then change the install_name of the copied python executable
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1342
        try:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1343
            call_subprocess(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1344
                ["install_name_tool", "-change",
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1345
                 os.path.join(prefix, 'Python'),
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1346
                 '@executable_path/../.Python',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1347
                 py_executable])
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1348
        except:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1349
            logger.fatal(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1350
                "Could not call install_name_tool -- you must have Apple's development tools installed")
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1351
            raise
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1352
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1353
        # Some tools depend on pythonX.Y being present
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1354
        py_executable_version = '%s.%s' % (
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1355
            sys.version_info[0], sys.version_info[1])
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1356
        if not py_executable.endswith(py_executable_version):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1357
            # symlinking pythonX.Y > python
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1358
            pth = py_executable + '%s.%s' % (
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1359
                    sys.version_info[0], sys.version_info[1])
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1360
            if os.path.exists(pth):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1361
                os.unlink(pth)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1362
            os.symlink('python', pth)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1363
        else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1364
            # reverse symlinking python -> pythonX.Y (with --python)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1365
            pth = join(bin_dir, 'python')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1366
            if os.path.exists(pth):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1367
                os.unlink(pth)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1368
            os.symlink(os.path.basename(py_executable), pth)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1369
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1370
    if sys.platform == 'win32' and ' ' in py_executable:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1371
        # There's a bug with subprocess on Windows when using a first
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1372
        # argument that has a space in it.  Instead we have to quote
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1373
        # the value:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1374
        py_executable = '"%s"' % py_executable
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1375
    cmd = [py_executable, '-c', """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1376
import sys
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1377
prefix = sys.prefix
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1378
if sys.version_info[0] == 3:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1379
    prefix = prefix.encode('utf8')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1380
if hasattr(sys.stdout, 'detach'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1381
    sys.stdout = sys.stdout.detach()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1382
elif hasattr(sys.stdout, 'buffer'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1383
    sys.stdout = sys.stdout.buffer
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1384
sys.stdout.write(prefix)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1385
"""]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1386
    logger.info('Testing executable with %s %s "%s"' % tuple(cmd))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1387
    try:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1388
        proc = subprocess.Popen(cmd,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1389
                            stdout=subprocess.PIPE)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1390
        proc_stdout, proc_stderr = proc.communicate()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1391
    except OSError:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1392
        e = sys.exc_info()[1]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1393
        if e.errno == errno.EACCES:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1394
            logger.fatal('ERROR: The executable %s could not be run: %s' % (py_executable, e))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1395
            sys.exit(100)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1396
        else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1397
          raise e
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1398
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1399
    proc_stdout = proc_stdout.strip().decode("utf-8")
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1400
    proc_stdout = os.path.normcase(os.path.abspath(proc_stdout))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1401
    norm_home_dir = os.path.normcase(os.path.abspath(home_dir))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1402
    if hasattr(norm_home_dir, 'decode'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1403
        norm_home_dir = norm_home_dir.decode(sys.getfilesystemencoding())
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1404
    if proc_stdout != norm_home_dir:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1405
        logger.fatal(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1406
            'ERROR: The executable %s is not functioning' % py_executable)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1407
        logger.fatal(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1408
            'ERROR: It thinks sys.prefix is %r (should be %r)'
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1409
            % (proc_stdout, norm_home_dir))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1410
        logger.fatal(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1411
            'ERROR: virtualenv is not compatible with this system or executable')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1412
        if sys.platform == 'win32':
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1413
            logger.fatal(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1414
                'Note: some Windows users have reported this error when they '
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1415
                'installed Python for "Only this user" or have multiple '
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1416
                'versions of Python installed. Copying the appropriate '
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1417
                'PythonXX.dll to the virtualenv Scripts/ directory may fix '
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1418
                'this problem.')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1419
        sys.exit(100)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1420
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1421
        logger.info('Got sys.prefix result: %r' % proc_stdout)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1422
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1423
    pydistutils = os.path.expanduser('~/.pydistutils.cfg')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1424
    if os.path.exists(pydistutils):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1425
        logger.notify('Please make sure you remove any previous custom paths from '
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1426
                      'your %s file.' % pydistutils)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1427
    ## FIXME: really this should be calculated earlier
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1428
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1429
    fix_local_scheme(home_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1430
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1431
    return py_executable
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1432
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1433
def install_activate(home_dir, bin_dir, prompt=None):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1434
    home_dir = os.path.abspath(home_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1435
    if sys.platform == 'win32' or is_jython and os._name == 'nt':
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1436
        files = {
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1437
            'activate.bat': ACTIVATE_BAT,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1438
            'deactivate.bat': DEACTIVATE_BAT,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1439
            'activate.ps1': ACTIVATE_PS,
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1440
        }
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1441
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1442
        # MSYS needs paths of the form /c/path/to/file
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1443
        drive, tail = os.path.splitdrive(home_dir.replace(os.sep, '/'))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1444
        home_dir_msys = (drive and "/%s%s" or "%s%s") % (drive[:1], tail)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1445
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1446
        # Run-time conditional enables (basic) Cygwin compatibility
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1447
        home_dir_sh = ("""$(if [ "$OSTYPE" "==" "cygwin" ]; then cygpath -u '%s'; else echo '%s'; fi;)""" % 
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1448
                       (home_dir, home_dir_msys))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1449
        files['activate'] = ACTIVATE_SH.replace('__VIRTUAL_ENV__', home_dir_sh)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1450
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1451
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1452
        files = {'activate': ACTIVATE_SH}
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1453
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1454
        # suppling activate.fish in addition to, not instead of, the
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1455
        # bash script support.
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1456
        files['activate.fish'] = ACTIVATE_FISH
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1457
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1458
        # same for csh/tcsh support...
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1459
        files['activate.csh'] = ACTIVATE_CSH
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1460
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1461
    files['activate_this.py'] = ACTIVATE_THIS
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1462
    if hasattr(home_dir, 'decode'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1463
        home_dir = home_dir.decode(sys.getfilesystemencoding())
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1464
    vname = os.path.basename(home_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1465
    for name, content in files.items():
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1466
        content = content.replace('__VIRTUAL_PROMPT__', prompt or '')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1467
        content = content.replace('__VIRTUAL_WINPROMPT__', prompt or '(%s)' % vname)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1468
        content = content.replace('__VIRTUAL_ENV__', home_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1469
        content = content.replace('__VIRTUAL_NAME__', vname)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1470
        content = content.replace('__BIN_NAME__', os.path.basename(bin_dir))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1471
        writefile(os.path.join(bin_dir, name), content)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1472
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1473
def install_distutils(home_dir):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1474
    distutils_path = change_prefix(distutils.__path__[0], home_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1475
    mkdir(distutils_path)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1476
    ## FIXME: maybe this prefix setting should only be put in place if
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1477
    ## there's a local distutils.cfg with a prefix setting?
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1478
    home_dir = os.path.abspath(home_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1479
    ## FIXME: this is breaking things, removing for now:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1480
    #distutils_cfg = DISTUTILS_CFG + "\n[install]\nprefix=%s\n" % home_dir
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1481
    writefile(os.path.join(distutils_path, '__init__.py'), DISTUTILS_INIT)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1482
    writefile(os.path.join(distutils_path, 'distutils.cfg'), DISTUTILS_CFG, overwrite=False)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1483
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1484
def fix_local_scheme(home_dir):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1485
    """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1486
    Platforms that use the "posix_local" install scheme (like Ubuntu with
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1487
    Python 2.7) need to be given an additional "local" location, sigh.
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1488
    """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1489
    try:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1490
        import sysconfig
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1491
    except ImportError:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1492
        pass
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1493
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1494
        if sysconfig._get_default_scheme() == 'posix_local':
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1495
            local_path = os.path.join(home_dir, 'local')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1496
            if not os.path.exists(local_path):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1497
                os.mkdir(local_path)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1498
                for subdir_name in os.listdir(home_dir):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1499
                    if subdir_name == 'local':
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1500
                        continue
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1501
                    os.symlink(os.path.abspath(os.path.join(home_dir, subdir_name)), \
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1502
                                                            os.path.join(local_path, subdir_name))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1503
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1504
def fix_lib64(lib_dir):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1505
    """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1506
    Some platforms (particularly Gentoo on x64) put things in lib64/pythonX.Y
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1507
    instead of lib/pythonX.Y.  If this is such a platform we'll just create a
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1508
    symlink so lib64 points to lib
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1509
    """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1510
    if [p for p in distutils.sysconfig.get_config_vars().values()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1511
        if isinstance(p, basestring) and 'lib64' in p]:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1512
        logger.debug('This system uses lib64; symlinking lib64 to lib')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1513
        assert os.path.basename(lib_dir) == 'python%s' % sys.version[:3], (
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1514
            "Unexpected python lib dir: %r" % lib_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1515
        lib_parent = os.path.dirname(lib_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1516
        assert os.path.basename(lib_parent) == 'lib', (
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1517
            "Unexpected parent dir: %r" % lib_parent)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1518
        copyfile(lib_parent, os.path.join(os.path.dirname(lib_parent), 'lib64'))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1519
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1520
def resolve_interpreter(exe):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1521
    """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1522
    If the executable given isn't an absolute path, search $PATH for the interpreter
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1523
    """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1524
    if os.path.abspath(exe) != exe:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1525
        paths = os.environ.get('PATH', '').split(os.pathsep)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1526
        for path in paths:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1527
            if os.path.exists(os.path.join(path, exe)):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1528
                exe = os.path.join(path, exe)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1529
                break
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1530
    if not os.path.exists(exe):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1531
        logger.fatal('The executable %s (from --python=%s) does not exist' % (exe, exe))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1532
        raise SystemExit(3)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1533
    if not is_executable(exe):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1534
        logger.fatal('The executable %s (from --python=%s) is not executable' % (exe, exe))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1535
        raise SystemExit(3)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1536
    return exe
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1537
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1538
def is_executable(exe):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1539
    """Checks a file is executable"""
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1540
    return os.access(exe, os.X_OK)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1541
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1542
############################################################
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1543
## Relocating the environment:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1544
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1545
def make_environment_relocatable(home_dir):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1546
    """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1547
    Makes the already-existing environment use relative paths, and takes out
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1548
    the #!-based environment selection in scripts.
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1549
    """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1550
    home_dir, lib_dir, inc_dir, bin_dir = path_locations(home_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1551
    activate_this = os.path.join(bin_dir, 'activate_this.py')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1552
    if not os.path.exists(activate_this):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1553
        logger.fatal(
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1554
            'The environment doesn\'t have a file %s -- please re-run virtualenv '
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1555
            'on this environment to update it' % activate_this)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1556
    fixup_scripts(home_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1557
    fixup_pth_and_egg_link(home_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1558
    ## FIXME: need to fix up distutils.cfg
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1559
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1560
OK_ABS_SCRIPTS = ['python', 'python%s' % sys.version[:3],
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1561
                  'activate', 'activate.bat', 'activate_this.py']
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1562
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1563
def fixup_scripts(home_dir):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1564
    # This is what we expect at the top of scripts:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1565
    shebang = '#!%s/bin/python' % os.path.normcase(os.path.abspath(home_dir))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1566
    # This is what we'll put:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1567
    new_shebang = '#!/usr/bin/env python%s' % sys.version[:3]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1568
    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"
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1569
    if sys.platform == 'win32':
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1570
        bin_suffix = 'Scripts'
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1571
    else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1572
        bin_suffix = 'bin'
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1573
    bin_dir = os.path.join(home_dir, bin_suffix)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1574
    home_dir, lib_dir, inc_dir, bin_dir = path_locations(home_dir)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1575
    for filename in os.listdir(bin_dir):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1576
        filename = os.path.join(bin_dir, filename)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1577
        if not os.path.isfile(filename):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1578
            # ignore subdirs, e.g. .svn ones.
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1579
            continue
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1580
        f = open(filename, 'rb')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1581
        try:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1582
            try:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1583
                lines = f.read().decode('utf-8').splitlines()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1584
            except UnicodeDecodeError:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1585
                # This is probably a binary program instead
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1586
                # of a script, so just ignore it.
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1587
                continue
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1588
        finally:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1589
            f.close()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1590
        if not lines:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1591
            logger.warn('Script %s is an empty file' % filename)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1592
            continue
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1593
        if not lines[0].strip().startswith(shebang):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1594
            if os.path.basename(filename) in OK_ABS_SCRIPTS:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1595
                logger.debug('Cannot make script %s relative' % filename)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1596
            elif lines[0].strip() == new_shebang:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1597
                logger.info('Script %s has already been made relative' % filename)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1598
            else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1599
                logger.warn('Script %s cannot be made relative (it\'s not a normal script that starts with %s)'
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1600
                            % (filename, shebang))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1601
            continue
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1602
        logger.notify('Making script %s relative' % filename)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1603
        lines = [new_shebang+'\n', activate+'\n'] + lines[1:]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1604
        f = open(filename, 'wb')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1605
        f.write('\n'.join(lines).encode('utf-8'))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1606
        f.close()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1607
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1608
def fixup_pth_and_egg_link(home_dir, sys_path=None):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1609
    """Makes .pth and .egg-link files use relative paths"""
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1610
    home_dir = os.path.normcase(os.path.abspath(home_dir))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1611
    if sys_path is None:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1612
        sys_path = sys.path
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1613
    for path in sys_path:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1614
        if not path:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1615
            path = '.'
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1616
        if not os.path.isdir(path):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1617
            continue
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1618
        path = os.path.normcase(os.path.abspath(path))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1619
        if not path.startswith(home_dir):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1620
            logger.debug('Skipping system (non-environment) directory %s' % path)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1621
            continue
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1622
        for filename in os.listdir(path):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1623
            filename = os.path.join(path, filename)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1624
            if filename.endswith('.pth'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1625
                if not os.access(filename, os.W_OK):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1626
                    logger.warn('Cannot write .pth file %s, skipping' % filename)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1627
                else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1628
                    fixup_pth_file(filename)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1629
            if filename.endswith('.egg-link'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1630
                if not os.access(filename, os.W_OK):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1631
                    logger.warn('Cannot write .egg-link file %s, skipping' % filename)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1632
                else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1633
                    fixup_egg_link(filename)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1634
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1635
def fixup_pth_file(filename):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1636
    lines = []
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1637
    prev_lines = []
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1638
    f = open(filename)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1639
    prev_lines = f.readlines()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1640
    f.close()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1641
    for line in prev_lines:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1642
        line = line.strip()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1643
        if (not line or line.startswith('#') or line.startswith('import ')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1644
            or os.path.abspath(line) != line):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1645
            lines.append(line)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1646
        else:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1647
            new_value = make_relative_path(filename, line)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1648
            if line != new_value:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1649
                logger.debug('Rewriting path %s as %s (in %s)' % (line, new_value, filename))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1650
            lines.append(new_value)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1651
    if lines == prev_lines:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1652
        logger.info('No changes to .pth file %s' % filename)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1653
        return
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1654
    logger.notify('Making paths in .pth file %s relative' % filename)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1655
    f = open(filename, 'w')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1656
    f.write('\n'.join(lines) + '\n')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1657
    f.close()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1658
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1659
def fixup_egg_link(filename):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1660
    f = open(filename)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1661
    link = f.read().strip()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1662
    f.close()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1663
    if os.path.abspath(link) != link:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1664
        logger.debug('Link in %s already relative' % filename)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1665
        return
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1666
    new_link = make_relative_path(filename, link)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1667
    logger.notify('Rewriting link %s in %s as %s' % (link, filename, new_link))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1668
    f = open(filename, 'w')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1669
    f.write(new_link)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1670
    f.close()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1671
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1672
def make_relative_path(source, dest, dest_is_directory=True):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1673
    """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1674
    Make a filename relative, where the filename is dest, and it is
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1675
    being referred to from the filename source.
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1676
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1677
        >>> make_relative_path('/usr/share/something/a-file.pth',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1678
        ...                    '/usr/share/another-place/src/Directory')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1679
        '../another-place/src/Directory'
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1680
        >>> make_relative_path('/usr/share/something/a-file.pth',
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1681
        ...                    '/home/user/src/Directory')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1682
        '../../../home/user/src/Directory'
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1683
        >>> make_relative_path('/usr/share/a-file.pth', '/usr/share/')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1684
        './'
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1685
    """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1686
    source = os.path.dirname(source)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1687
    if not dest_is_directory:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1688
        dest_filename = os.path.basename(dest)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1689
        dest = os.path.dirname(dest)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1690
    dest = os.path.normpath(os.path.abspath(dest))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1691
    source = os.path.normpath(os.path.abspath(source))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1692
    dest_parts = dest.strip(os.path.sep).split(os.path.sep)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1693
    source_parts = source.strip(os.path.sep).split(os.path.sep)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1694
    while dest_parts and source_parts and dest_parts[0] == source_parts[0]:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1695
        dest_parts.pop(0)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1696
        source_parts.pop(0)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1697
    full_parts = ['..']*len(source_parts) + dest_parts
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1698
    if not dest_is_directory:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1699
        full_parts.append(dest_filename)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1700
    if not full_parts:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1701
        # Special case for the current directory (otherwise it'd be '')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1702
        return './'
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1703
    return os.path.sep.join(full_parts)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1704
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1705
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1706
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1707
############################################################
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1708
## Bootstrap script creation:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1709
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1710
def create_bootstrap_script(extra_text, python_version=''):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1711
    """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1712
    Creates a bootstrap script, which is like this script but with
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1713
    extend_parser, adjust_options, and after_install hooks.
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1714
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1715
    This returns a string that (written to disk of course) can be used
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1716
    as a bootstrap script with your own customizations.  The script
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1717
    will be the standard virtualenv.py script, with your extra text
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1718
    added (your extra text should be Python code).
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1719
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1720
    If you include these functions, they will be called:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1721
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1722
    ``extend_parser(optparse_parser)``:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1723
        You can add or remove options from the parser here.
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1724
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1725
    ``adjust_options(options, args)``:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1726
        You can change options here, or change the args (if you accept
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1727
        different kinds of arguments, be sure you modify ``args`` so it is
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1728
        only ``[DEST_DIR]``).
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1729
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1730
    ``after_install(options, home_dir)``:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1731
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1732
        After everything is installed, this function is called.  This
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1733
        is probably the function you are most likely to use.  An
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1734
        example would be::
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1735
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1736
            def after_install(options, home_dir):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1737
                subprocess.call([join(home_dir, 'bin', 'easy_install'),
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1738
                                 'MyPackage'])
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1739
                subprocess.call([join(home_dir, 'bin', 'my-package-script'),
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1740
                                 'setup', home_dir])
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1741
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1742
        This example immediately installs a package, and runs a setup
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1743
        script from that package.
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1744
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1745
    If you provide something like ``python_version='2.4'`` then the
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1746
    script will start with ``#!/usr/bin/env python2.4`` instead of
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1747
    ``#!/usr/bin/env python``.  You can use this when the script must
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1748
    be run with a particular Python version.
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1749
    """
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1750
    filename = __file__
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1751
    if filename.endswith('.pyc'):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1752
        filename = filename[:-1]
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1753
    f = open(filename, 'rb')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1754
    content = f.read()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1755
    f.close()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1756
    py_exe = 'python%s' % python_version
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1757
    content = (('#!/usr/bin/env %s\n' % py_exe)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1758
               + '## WARNING: This file is generated\n'
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1759
               + content)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1760
    return content.replace('##EXT' 'END##', extra_text)
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1761
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1762
##EXTEND##
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1763
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1764
def convert(s):
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1765
    b = base64.b64decode(s.encode('ascii'))
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1766
    return zlib.decompress(b).decode('utf-8')
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1767
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1768
##file site.py
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1769
SITE_PY = convert("""
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1770
eJzFPf1z2zaWv/OvwMqTIZXKdD66nR2n7o2TOK333MTbpLO5dT1aSoIs1hTJEqRl7c3d337vAwAB
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1771
kvLHpp3TdGKJBB4eHt43HtDRaHRcljJfiHWxaDIplEyq+UqUSb1SYllUol6l1WK/TKp6C0/n18mV
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1772
VKIuhNqqGFvFQfD0Cz/BU/FplSqDAnxLmrpYJ3U6T7JsK9J1WVS1XIhFU6X5lUjztE6TLP0XtCjy
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1773
WDz9cgyC01zAzLNUVuJGVgrgKlEsxfm2XhW5iJoS5/w8/nPycjwRal6lZQ0NKo0zUGSV1EEu5QLQ
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1774
hJaNAlKmtdxXpZyny3RuG26KJluIMkvmUvzznzw1ahqGgSrWcrOSlRQ5IAMwJcAqEQ/4mlZiXixk
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1775
LMRrOU9wAH7eEitgaBNcM4VkzAuRFfkVzCmXc6lUUm1FNGtqAkQoi0UBOKWAQZ1mWbApqms1hiWl
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1776
9djAI5Ewe/iTYfaAeeL4fc4BHD/kwc95ejth2MA9CK5eMdtUcpneigTBwk95K+dT/SxKl2KRLpdA
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1777
g7weY5OAEVAiS2cHJS3Ht3qFvjsgrCxXJjCGRJS5Mb+kHnFwWoskU8C2TYk0UoT5WzlLkxyokd/A
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1778
cAARSBoMjbNIVW3HodmJAgBUuI41SMlaiWidpDkw64/JnND+e5ovio0aEwVgtZT4tVG1O/9ogADQ
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1779
2iHAJMDFMqvZ5Fl6LbPtGBD4BNhXUjVZjQKxSCs5r4sqlYoAAGpbIW8B6YlIKqlJyJxp5HZC9Cea
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1780
pDkuLAoYCjy+RJIs06umIgkTyxQ4F7ji3YefxNuT16fH7zWPGWAss1drwBmg0EI7OMEA4qBR1UFW
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1781
gEDHwRn+EcligUJ2heMDXm2Dg3tXOohg7mXc7eMsOJBdL64eBuZYgzKhsQLq99/QZaJWQJ//uWe9
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1782
g+B4F1Vo4vxtsypAJvNkLcUqYf5Czgi+1XC+i8t69Qq4QSGcGkilcHEQwRThAUlcmkVFLkUJLJal
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1783
uRwHQKEZtfVXEVjhfZHv01p3OAEgVEEOL51nYxoxlzDRPqxXqC9M4y3NTDcJ7Dqvi4oUB/B/Pidd
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1784
lCX5NeGoiKH420xepXmOCCEvBOFeSAOr6xQ4cRGLM2pFesE0EiFrL26JItEALyHTAU/K22RdZnLC
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1785
4ou69W41QoPJWpi1zpjjoGVN6pVWrZ3qIO+9iD93uI7QrFeVBODNzBO6ZVFMxAx0NmFTJmsWr3pT
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1786
EOcEA/JEnZAnqCX0xe9A0WOlmrW0L5FXQLMQQwXLIsuKDZDsMAiE2MNGxij7zAlv4R38C3Dx30zW
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1787
81UQOCNZwBoUIr8LFAIBkyBzzdUaCY/bNCt3lUyas6YoqoWsaKiHEfuAEX9gY5xr8L6otVHj6eIq
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1788
F+u0RpU00yYzZYuXhzXrx1c8b5gGWG5FNDNNWzqtcXpZuUpm0rgkM7lESdCL9MouO4wZDIxJtrgW
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1789
a7Yy8A7IIlO2IMOKBZXOspbkBAAMFr4kT8smo0YKGUwkMNC6JPjrBE16oZ0lYG82ywEqJDbfc7A/
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1790
gNu/QIw2qxToMwcIoGFQS8HyzdK6Qgeh1UeBb/RNfx4fOPV0qW0TD7lM0kxb+SQPTunhSVWR+M5l
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1791
ib0mmhgKZpjX6Npd5UBHFPPRaBQExh3aKvO1UEFdbQ+BFYQZZzqdNSkavukUTb3+oQIeRTgDe91s
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1792
OwsPNITp9B6o5HRZVsUaX9u5fQRlAmNhj2BPnJOWkewge5z4CsnnqvTSNEXb7bCzQD0UnP908u70
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1793
88lHcSQuWpU26eqzSxjzJE+ArckiAFN1hm11GbRExZei7hPvwLwTU4A9o94kvjKpG+BdQP1T1dBr
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1794
mMbcexmcvD9+fXYy/fnjyU/Tj6efTgBBsDMy2KMpo3lswGFUMQgHcOVCxdq+Br0e9OD18Uf7IJim
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1795
alpuyy08AEMJLFxFMN+JCPHhVNvgaZovi3BMjX9lJ/yI1Yr2uC4Ov74UR0ci/DW5ScIAvJ62KS/i
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1796
jyQAn7alhK41/IkKNQ6ChVyCsFxLFKnoKXmyY+4ARISWhbasvxZpbt4zH7lDkMRH1ANwmE7nWaIU
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1797
Np5OQyAtdRj4QIeY3WGUkwg6llu361ijgp9KwlLk2GWC/wygmMyoH6LBKLpdTCMQsPU8UZJb0fSh
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1798
33SKWmY6jfSAIH7E4+AiseIIhWmCWqZKwRMlXkGtM1NFhj8RPsotiQwGQ6jXcJF0sBPfJFkjVeRM
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1799
CogYRR0yompMFXEQOBUR2M526cbjLjUNz0AzIF9WgN6rOpTDzx54KKBgTNiFoRlHS0wzxPSvHBsQ
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1800
DuAkhqiglepAYX0mzk/OxctnL/bRAYEocWGp4zVHm5rmjbQPl7BaV7J2EOZe4YSEYezSZYmaEZ8e
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1801
3g1zHduV6bPCUi9xJdfFjVwAtsjAziqLn+gNxNIwj3kCqwiamCw4Kz3j6SUYOfLsQVrQ2gP11gTF
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1802
rL9Z+j0O32WuQHVwKEyk1nE6G6+yKm5SdA9mW/0SrBuoN7RxxhUJnIXzmAyNGGgI8FtzpNRGhqDA
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1803
qoZdTMIbQaKGX7SqMCZwZ6hbL+nrdV5s8inHrkeoJqOxZV0ULM282KBdgj3xDuwGIFlAKNYSjaGA
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1804
ky5QtvYBeZg+TBcoS9EAAALTrCjAcmCZ4IymyHEeDoswxq8ECW8l0cLfmCEoODLEcCDR29g+MFoC
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1805
IcHkrIKzqkEzGcqaaQYDOyTxue4s5qDRB9ChYgyGLtLQuJGh38UhKGdx5iolpx/a0M+fPzPbqBVl
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1806
RBCxGU4ajf6SzFtcbsEUpqATjA/F+RVigw24owCmUZo1xf5HUZTsP8F6nmvZBssN8Vhdl4cHB5vN
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1807
Jtb5gKK6OlDLgz//5Ztv/vKMdeJiQfwD03GkRSfH4gN6hz5o/K2xQN+ZlevwY5r73EiwIkl+FDmP
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1808
iN/3TbooxOH+2OpP5OLWsOK/xvkABTI1gzKVgbajFqMnav9J/FKNxBMRuW2jMXsS2qRaK+ZbXehR
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1809
F2C7wdOYF01eh44iVeIrsG4QUy/krLkK7eCejTQ/YKoop5Hlgf3nl4iBzxmGr4wpnqKWILZAi++Q
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1810
/idmm4T8Ga0hkLxoonrx7nZYixniLh4u79Y7dITGzDBVyB0oEX6TBwugbdyXHPxoZxTtnuOMmo9n
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1811
CIylDwzzalcwQsEhXHAtJq7UOVyNPipI04ZVMygYVzWCgga3bsbU1uDIRoYIEr0bE57zwuoWQKdO
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1812
rs9E9GYVoIU7Ts/adVnB8YSQB47Ec3oiwak97L17xkvbZBmlYDo86lGFAXsLjXa6AL6MDICJGFU/
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1813
j7ilCSw+dBaF12AAWMFZG2SwZY+Z8I3rA472RgPs1LP6u3ozjYdA4CJFnD16EHRC+YhHqBRIUxn5
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1814
PXexuCVuf7A7LQ4xlVkmEmm1Q7i6ymNQqO40TMs0R93rLFI8zwrwiq1WJEZq3/vOAkUu+HjImGkJ
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1815
1GRoyeE0OiJvzxPAULfDhNdVg6kBN3OCGK1TRdYNybSCf8CtoIwEpY+AlgTNgnmolPkT+x1kzs5X
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1816
f9nBHpbQyBBu011uSM9iaDjm/Z5AMur8CUhBDiTsCyO5jqwOMuAwZ4E84YbXcqd0E4xYgZw5FoTU
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1817
DOBOL70AB5/EuGdBEoqQb2slS/GVGMHydUX1Ybr7d+VSkzaInAbkKuh8w5Gbi3DyEEedvITP0H5G
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1818
gnY3ygI4eAYuj5uad9ncMK1Nk4Cz7ituixRoZMqcjMYuqpeGMG76909HTouWWGYQw1DeQN4mjBlp
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1819
HNjl1qBhwQ0Yb827Y+nHbsYC+0ZhoV7I9S3Ef2GVqnmhQgxwe7kL96O5ok8bi+1ZOhvBH28BRuNL
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1820
D5LMdP4Csyz/xiChBz0cgu5NFtMii6TapHlICkzT78hfmh4elpSekTv4SOHUAUwUc5QH7yoQENqs
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1821
PABxQk0AUbkMlXb7+2DvnOLIwuXuI89tvjh8edkn7mRXhsd+hpfq5LauEoWrlfGisVDgavUNOCpd
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1822
mFySb/V2o96OxjChKhREkeLDx88CCcGZ2E2yfdzUW4ZHbO6dk/cxqINeu5dcndkRuwAiqBWRUQ7C
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1823
x3Pkw5F97OTumNgjgDyKYe5YFANJ88m/A+euhYIx9hfbHPNoXZWBH3j9zdfTgcyoi+Q3X4/uGaVD
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1824
jCGxjzqeoB2ZygDE4LRNl0omGfkaTifKKuYt79g25ZgVOsV/mskuB5xO/Jj3xmS08HvNe4Gj+ewR
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1825
PSDMLma/QrCqdH7rJkkzSsoDGvv7qOdMnM2pg2F8PEh3o4w5KfBYnk0GQyF18QwWJuTAftyfjvaL
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1826
jk3udyAgNZ8yUX1U9vQGfLt/5G2qu3uHfajamBgeesaZ/hcDWsKb8ZBd/xINh5/fRRlYYB4NRkNk
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1827
9xzt/+9ZPvtjJvnAqZht39/RMD0S0O81E9bjDE3r8XHHIA4tu2sCDbAHWIodHuAdHlp/aN7oWxo/
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1828
i1WSEk9Rdz0VG9rrpzQnbtoAlAW7YANwcBn1jvGbpqp435dUYCmrfdzLnAgsczJOGFVP9cEcvJc1
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1829
YmKbzSlt7BTFFENqJNSJYDuTsHXhh+VsVZj0kcxv0gr6gsKNwh8+/HgS9hlAD4OdhsG562i45OEm
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1830
HOE+gmlDTZzwMX2YQo/p8u9LVTeK8AlqttNNclaTbdA++DlZE9IPr8E9yRlv75T3qDFYnq/k/Hoq
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1831
ad8d2RS7OvnpN/gaMbHb8X7xlEqWVAEGM5lnDdKKfWAs3Vs2+Zy2KmoJro6us8W6G9pN50zcMkuu
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1832
RESdF5gF0txIiaKbpNKOYFkVWNkpmnRxcJUuhPytSTKMsOVyCbjgPpJ+FfPwlAwSb7kggCv+lJw3
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1833
VVpvgQSJKvQ2HNUOOA1nW55o5CHJOy5MQKwmOBQfcdr4ngm3MOQycbq/+YCTxBAYO5h9UuQueg7v
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1834
82KKo06pQHbCSPW3yOlx0B2hAAAjAArzH411Es1/I+mVu9dHa+4SFbWkR0o36C/IGUMo0RiTDvyb
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1835
fvqM6PLWDiyvdmN5dTeWV10srwaxvPKxvLobS1ckcGFt/shIwlAOqbvDMFis4qZ/eJiTZL7idlg4
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1836
iQWSAFGUJtY1MsX1w16SibfaCAipbWfvlx62xScpV2RWBWejNUjkftxP0nG1qfx2OlMpi+7MUzHu
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1837
7K4CHL/vQRxTndWMurO8LZI6iT25uMqKGYitRXfSApiIbi0Opy3zm+mME60dSzU6/69PP3x4j80R
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1838
1MhUGlA3XEQ0LDiV6GlSXam+NLVxWAnsSC39mhjqpgHuPTDJxaPs8T9vqdgCGUdsqFigECV4AFQS
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1839
ZZu5hUNh2HmuK4z0c2Zy3vc5EqO8HrWT2kGk4/Pzt8efjkeUfRv978gVGENbXzpcfEwL26Dvv7nN
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1840
LcWxDwi1TjO1xs+dk0frliPut7EGbM+H7zx48RCDPRix+7P8QykFSwKEinUe9jGEenAM9EVhQo8+
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1841
hhF7lXPuJhc7K/adI3uOi+KI/tAOQHcAf98RY4wpEEC7UJGJDNpgqqP0rXm9g6IO0Af6el8cgnVD
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1842
r24k41PUTmLAAXQoa5vtdv+8LRM2ekrWr0++P31/dvr6/PjTD44LiK7ch48HL8TJj58FlWqgAWOf
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1843
KMEqhRqLgsCwuKeExKKA/xrM/CyamvO10Ovt2ZneNFnjOREsHEabE8Nzriiy0Dh9xQlh+1CXAiFG
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1844
mQ6QnAM5VDlDB3YwXlrzYRBV6OJiOuczQ2e10aGXPmhlDmTRFnMM0geNXVIwCK72gldUAl6bqLDi
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1845
zTh9SGkAKW2jbY1GRum53s69sxVlNjq8nCV1hidtZ63oL0IX1/AyVmWWQiT3KrSypLthpUrLOPqh
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1846
3WtmvIY0oNMdRtYNedY7sUCr9Srkuen+45bRfmsAw5bB3sK8c0mVGlS+jHVmIsRGvKkSylv4apde
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1847
r4GCBcM9txoX0TBdCrNPILgWqxQCCODJFVhfjBMAQmcl/Nz8oZMdkAUWSoRv1ov9v4WaIH7rX34Z
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1848
aF5X2f4/RAlRkOCqnnCAmG7jtxD4xDIWJx/ejUNGjqpkxd8arK0Hh4QSoI60UykRb2ZPIyWzpS71
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1849
8PUBvtB+Ar3udK9kWenuw65xiBLwREXkNTxRhn4hVl5Z2BOcyrgDGo8NWMzw+J1bEWA+e+LjSmaZ
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1850
LhY/fXt2Ar4jnmRACeItsBMYjvMluJut6+D4eGAHFO51w+sK2bhCF5bqHRax12wwaY0iR729Egm7
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1851
TpQY7vfqZYGrJFUu2hFOm2GZWvwYWRnWwiwrs3anDVLYbUMUR5lhlpieV1RL6vME8DI9TTgkglgJ
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1852
z0mYDDxv6KZ5bYoHs3QOehRULijUCQgJEhcPAxLnFTnnwItKmTNE8LDcVunVqsZ9Bugc0/kFbP7j
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1853
8eez0/dU0//iZet1DzDnhCKBCddzHGG1HmY74ItbgYdcNZ0O8ax+hTBQ+8Cf7isuFDniAXr9OLGI
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1854
f7qv+BDXkRMJ8gxAQTVlVzwwAHC6DclNKwuMq42D8eNW47WY+WAoF4lnRnTNhTu/Pifalh1TQnkf
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1855
8/IRGzjLUtMwMp3d6rDuR89xWeKO0yIabgRvh2TLfGbQ9br3ZlcdmvvpSSGeJwWM+q39MUyhVq+p
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1856
no7DbLu4hcJabWN/yZ1cqdNunqMoAxEjt/PYZbJhJaybMwd6Fc09YOJbja6RxEFVPvolH2kPw8PE
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1857
ErsXp5iOdKKEjABmMqQ+ONOAD4UWARQIFeJGjuROxk9feHN0rMH9c9S6C2zjD6AIdVksHbcoKuBE
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1858
+PIbO478itBCPXooQsdTyWVe2JIt/GxW6FU+9+c4KAOUxESxq5L8SkYMa2JgfuUTe0cKlrStR+qL
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1859
9HLIsIhTcE5vd3B4Xy6GN04Mah1G6LW7ltuuOvLJgw0GT2XcSTAffJVsQPeXTR3xSg6L/PBBtN1Q
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1860
74eIhYDQVO+DRyGmY34Ld6xPC3iQGhoWeni/7diF5bUxjqy1j50DRqF9oT3YeQWhWa1oW8Y52Wd8
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1861
UesFtAb3qDX5I/tU1+zY3wNHtpyckAXKg7sgvbmNdINOOmHEJ4f42GVKlentwRb9biFvZFaA6wVR
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1862
HR48+NUePBjHNp0yWJL1xdidb8+3w7jRmxazQ3MyAj0zVcL6xbmsDxCdwYzPXZi1yOBS/6JDkiS/
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1863
Ji/5zd9PJ+LN+5/g39fyA8RVeHJwIv4BaIg3RQXxJR99pTsJ8FBFzYFj0Sg8XkjQaKuCr29At+3c
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1864
ozNui+jTHv4xD6spBRa4Vmu+MwRQ5AnScfDWTzBnGOC3OWTV8UaNpzi0KCP9Emmw+9wJntU40C3j
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1865
Vb3O0F44WZJ2NS9GZ6dvTt5/PInrW+Rw83PkZFH82iicjt4jrnA/bCLsk3mDTy4dx/kHmZUDfrMO
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1866
Os0ZFgw6RQhxSWkDTb6PIrHBRVJh5kCU20Uxj7ElsDwfm6s34EiPnfjyXkPvWVmEFY31LlrrzeNj
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1867
oIb4pauIRtCQ+ug5UU9CKJnh+S1+HI+GTfFEUGob/jy93izczLg+iEMT7GLazjryu1tduGI6a3iW
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1868
kwivI7sM5mxmliZqPZu7Z/Y+5EJfJwJajvY55DJpslrIHCSXgny61wE0vXvMjiWEWYXNGZ09ozRN
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1869
tkm2yilCSpQY4agjOpqOGzKUMYQY/Mfkmu0Bnv8TDR8kBuiEKMVPhdNVNfMVSzCHRES9gcKDTZq/
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1870
dOt5NIV5UI6Q560jC/NEt5ExupK1nj8/iMYXz9tKB8pKz71DtvMSrJ7LJnugOsunT5+OxH/c7/0w
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1871
KnFWFNfglgHsQa/ljF7vsNx6cna1+p69eRMDP85X8gIeXFL23D5vckpN3tGVFkTavwZGiGsTWmY0
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1872
7Tt2mZN2FW80cwvesNKW4+c8pUuDMLUkUdnqu5cw7WSkiVgSFEOYqHmahpymgPXYFg2ej8M0o+YX
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1873
eQscnyKYCb7FHTIOtVfoYVItq+Uei86RGBHgEdWW8Wh0wJhOiAGe0/OtRnN6mqd1e7Tjmbt5qg/S
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1874
1/YuIM1XItmgZJh5dIjhHLX0WLX1sIs7WdSLWIr5hZtw7MySX9+HO7A2SFqxXBpM4aFZpHkhq7kx
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1875
p7hi6TytHTCmHcLhznQFElmfOBhAaQTqnazCwkq0ffsnuy4uph9oH3nfjKTLh2p7rRQnh5K8U2AY
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1876
x+34lIayhLR8a76MYZT3lNbWnoA3lviTTqpiXb93+4V7xLDJ9a0WXL/RXnUBcOgmJasgLTt6OsK5
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1877
vsvCZ6bdcRcFfihEJ9xu0qpukmyqL0+YosM2tRvrGk97NO3OQ5fWWwEnvwAPeF9X0YPjYKpskJ5Y
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1878
BGtOSRyJpU5RxO5pL/9gVFmgl/eCfSXwKZAyi6k5o2ySSBeWXe3hT12z6ah4BPWVOVD0EJtgjrX0
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1879
ToS405hQ0VM47la59lrhBos5tmA9725k8KghO7B8L95MsHunhfjuSETPJ+LPnUBsXm7xViYgw5NF
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1880
/GQR+j4hdb04fNHauX7g24GwE8jLy0dPN0tnNL1wqPz8/r666BED0DXI7jKVi/0nCrFjnL8UqobS
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1881
zms3p9KM8XT6nq260gez2+MqdCptBlHFplVojmoz/q8dxJz41nqID8ei0mALaA/0m8KXTvGhvXQN
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1882
CxM1ev7KopRMhzbH8BtenALvNUFdodq5aaor7C3YgZyAPkbJW2Btw4Gg8BE8FNIlL7RoX3W2hf/I
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1883
xeOi/V2biz0sv/n6LjxdAR88sTBAUI+YTqs/kKl2ssxjF+YB+/X389/Dee8uvns0lXSvYVphKIWF
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1884
zKuE36BJbMpDm2owIolbQZFb3oaf+nrwTAyLI+qm+jq8a/rc/6656xaBnbnZ3e3N3T/75tJA993N
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1885
L0M04DBPE+JBNeOtwA7rAleMJ7qoYDhlqT9IfrcTznSHVrgPjClhwAQosanG3mjNdTJ3v2OFzD5f
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1886
7+oedRzU1Z1p985+djn+IYqWqwHwuT39TCUeC82B7DfSfV1TLhqcyqsrNU3wrrgpBRtU4NLzIo37
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1887
+o6u+pKJ2hqvEy9UARCGm3QpolttDIwBAQ3fWcv1Ic7NGYKGpipKpyxTpQvOIGkXF8DFnDmi/iYz
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1888
yXWVo0xiwk81VVlBVDDSN5ty4cJQrWcL1CQy1om6NqibHhN90SUOwdUy5ngk56s40vCoA4TgU1PO
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1889
tU1cqDyd2nfAL8/aY+DpxDKEzJu1rJK6vQLF3yZNxXfOCHQoFhfYSVW0ktnhFBex1PKHgxQmC+z3
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1890
r7ST7QUZd5z9Hlut93C2oh46BfaYY+WO7THcnN7aK9Dcq3cWdGGua+Rts5b77LUvsBTmPi/SlTp3
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1891
wG/1HUN8cyVnNtFNcPgI5N49kuaX51q1xk6KRcN55iqG/qUyeKqZbPHQXXE9LujfCtdx9O34vt6w
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1892
zNILDXY0tlTUrtWg4mlHG7cRNVbS3RNR+9XSj4yoPfgPjKj1zX5gcDQ+Wh8M1k/fE3qzmnCvyWsZ
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1893
AfpMgUi4s9e5ZM2YzMitRoawN70d2WtqWWc6R5yMmUCO7N+fRCD4Ojzllm5611WZcYciWl+66PH3
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1894
Zx9eH58RLabnx2/+8/h7qlbB9HHHZj045ZAX+0ztfa8u1k0/6AqDocFbbAfuneTDHRpC731vc3YA
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1895
wvBBnqEF7Soy9/WuDr0DEf1OgPjd0+5A3aWyByH3/DNdfO/WFXQKWAP9lKsNzS9ny9Y8MjsXLA7t
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1896
zoR53yaTtYz2cm27Fs6p++urE+236psKd+QBx7b6lFYAc8jIXzaFbI4S2EQlOyrd/3kAlcziMSxz
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1897
ywdI4Vw6t83RRXMMqvb/LwUVKLsE98HYYZzYG3+pHafLlb3KGvfC5jI2BPHOQY3683OFfSGzHVQI
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1898
AlZ4+i41RsToP73BZLdjnyhxsU8nLvdR2VzaX7hm2sn9e4qbrrW9k0hx5QZvO0HjZZO5G6m2T68D
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1899
OX+UnS+WTok/aL4DoHMrngrYG30mVoizrQghkNQbhlg1SHTUF4o5yKPddLA3tHom9nedx3PPownx
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1900
fHfDRefIm+7xgnuoe3qoxpx6ciwwlq/tOmgnviPIvL0j6BIiz/nAPUV99y18vbl4fmiTrcjv+NpR
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1901
JFRmM3IM+4VTpnbnxXdOd2KWakJ1TBizOcc0dYtLByr7BLtinF6t/o44yOz7MqSR9364yMf08C70
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1902
HnUxtax3CFMS0RM1pmk5pxs07vbJuD/dVm31gfBJjQcA6alAgIVgerrRqZzbcvlr9ExHhbOGrgx1
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1903
M+6hIxVUReNzBPcwvl+LX7c7nbB8UHdG0fTnBl0O1EsOws2+A7caeymR3SahO/WWD3a4AHxYdbj/
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1904
8wf079d32e4v7vKrbauXgwek2JfFkkCslOiQyDyOwciA3oxIW2MduRF0vJ+jpaPLUO3ckC/Q8aMy
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1905
Q7wQmAIMcman2gOwRiH4P2ts6wE=
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1906
""")
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1907
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1908
##file ez_setup.py
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1909
EZ_SETUP_PY = convert("""
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1910
eJzNWmtv49a1/a5fwSgwJGE0NN8PDzRFmkyBAYrcIo8CFx5XPk+LHYpUSWoctch/v+ucQ1KkZDrt
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1911
RT6UwcQ2ebjPfq6195G+/upwanZlMZvP538sy6ZuKnKwatEcD01Z5rWVFXVD8pw0GRbNPkrrVB6t
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1912
Z1I0VlNax1qM16qnlXUg7DN5EovaPLQPp7X192PdYAHLj1xYzS6rZzLLhXql2UEI2QuLZ5VgTVmd
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1913
rOes2VlZs7ZIwS3CuX5BbajWNuXBKqXZqZN/dzebWbhkVe4t8c+tvm9l+0NZNUrL7VlLvW58a7m6
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1914
sqwS/zhCHYtY9UGwTGbM+iKqGk5Qe59fXavfsYqXz0VeEj7bZ1VVVmurrLR3SGGRvBFVQRrRLzpb
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1915
utabMqzipVWXFj1Z9fFwyE9Z8TRTxpLDoSoPVaZeLw8qCNoPj4+XFjw+2rPZT8pN2q9Mb6wkCqs6
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1916
4vdamcKq7KDNa6OqtTw8VYQP42irZJi1zqtP9ey7D3/65uc//7T964cffvz4P99bG2vu2BFz3Xn/
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1917
6Ocf/qz8qh7tmuZwd3t7OB0y2ySXXVZPt21S1Lc39S3+63e7nVs3ahe79e/9nf8wm+15uOWkIRD4
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1918
Lx2xxfmNt9icum8PJ8/2bfH0tLizFknieYzI1HG90OFJkNA0jWgsvZBFImJksX5FStBJoXFKEhI4
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1919
vghCx5OUJqEQvnTTwI39kNEJKd5YlzAK4zhMeUIinkgWBE7skJQ7sRd7PE1fl9LrEsAAknA3SrlH
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1920
RRS5kvgeiUToiUAm3pRF/lgXSn2XOZLFfpqSyA/jNI1DRngqQ+JEbvKqlF4XPyEJw10eCcY9zwti
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1921
6capjDmJolQSNiElGOsSeU4QEi8QPBCuoCyOpXD8lJBARDIW4atSzn5h1CNuEkKPhBMmJfW4C30c
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1922
n/rUZcHLUthFvlBfejQM/ZRHiGss44DwOHU9CCKpk0xYxC7zBfZwweHJKOYe96QUbuA4qR8F0iPB
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1923
RKSZ64yVYXCHR2jIfeJ4YRSEEeLDXD9xHBI7qfO6mF6bMOZ4ETFKaeLEscfClIQ+SQLfJyHnk54x
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1924
YsJODBdBRFgCX6YxS9IwjD0RiiREOgqasPh1MVGvTSJQSURIJ4KDPCaiwA0gzYORcPhEtAEqY994
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1925
lAiCGnZ9jvdRRl4iYkpCGhJoxMXrYs6R4pGfypQ6EBawwAvS2PEDLpgnmMO8yUi5Y99EAUsD6VMZ
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1926
kxhZ6AuW+MKhHsIdByn1XhfT+4ZKknqu41COMHHUBCQJzn0EPgqcJJoQc4Ez0nGigMqIEI/G3IFa
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1927
8GyAxHYSN2beVKAucCZyIzf1hGB+KINYIGpuxHhEXA9SvXhKygXOSDcBQAF8uUSqEC9MWQop0uUx
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1928
jRM5gVbsAmeEI3gcRInH0jShksbwdOIgex3EPHangu2Pg0SokG4kOYdhYRi6QRK4LAZ+8TRJo3BK
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1929
ygVaUYemru8SRqjvOXAGcC6WQcBCAEXsylel9BYhSST2jHggqfRRUVSmQcQcuAqoJ6YSJhhblCi0
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1930
BvD7HuM0ZbFHmQwAX14kvYTIKbQKxxYJkUqeOFAHBYmMlb4ApocxAIMnbjQV6XBsEZHAKi7BKm7s
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1931
uELAuTHIKaQMhEeiKZQJL2KUcF9GAISAMUKS2A2QONyPKWPc5yGfkBKNLULBJGD5xHUjMFGSBLEH
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1932
EWDMMEhR2lPAGV2wGwsjIsOYwr/oHlANkQNDgsBHgYVkChuisUXUkwmJQw9kD9ilPkjaQai5CCVa
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1933
idCfkBJfwJ2DGMmUcOaTyA1F6LohyhAtRQIInMyX+IIJSCLTMAALcGC5I2kUM+lKD2HAI2+qAuKx
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1934
RQE4lgBvJVoGFGDgB67rSi4S38W/eEqX5KIbclQv5KXwSMrBHyoFAeCJ76jGynldSm8Ro8RPgA3o
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1935
OYLEZ47KWWQbnM3ALJM0kIwtcmPPjQFyCHTKmRs6YeqQMKG+QJ2n4VSk07FF0J0FDpoZV3mYBmkk
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1936
AiapcBLYypypSKcXyIAkQ2MHbvWThEdAJyKEEwG8WOQHU/1dK6W3SAqE1hchcWPqegxhYmHg0hjc
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1937
C+YXU0ySjvmIEZSNKxVqEk9wAJOb+mC2mIaphx4HUn6dDSYCjDf1rKlOd2bg2pF6l2e0m7fQu8/E
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1938
L0xg1Pio73xQI1G7Fg+H62ZcSGv7heQZun2xxa0ldNoWmAfXlhoAVnfagExa3X01M3bjgXmoLp5h
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1939
tmgwLigR+kV7J34xdzHfdcsgp1351aaXct+JfjjLUxfmLkyD79+r6aRuuKgw1y1HK9Q1Vya1FrTz
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1940
4Q2mMIIxjH9lWcu/lHWd0Xww/mGkw9/7P6zmV8JuejNHj1ajv5Q+4pesWXrmfoXgVoV2l3HoxXCo
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1941
F7Xj1eZimFv3am0pqcVmMNCtMSluMapuytpmxwq/mWTqX+AiJ6eNG87aIGFs/ObYlHv4gWG6PGEU
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1942
Lfhtb/bgpEDN9XvyGbHE8PwFriLKQXCeMu1Amp0Z5x9bpR+telcec66mWWJ8PZTWTebFcU9FZTU7
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1943
0lgYhHvBWpaagAvlXUti6u2VOhZcvyKsx5EjHi010i6fdxnbdbsLaK2OJow8a3G7WNlQ0njpUW2p
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1944
5AyOMXaiGh2QPGeYuek5EwRfIyNNgmuVixL+yCtB+OmsPvb4KAfqabfr7dqzCS2mabXU0qjQqrQO
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1945
0ScWrCx4bXzTqXEgSBTlVHhElVXWZAhd8TQ4zzARb+0vC6HPE8zZCDd6wallrnz44vmI0rI9bBCt
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1946
MH2WU5VH7CSMKqbOiLUXdU2ehDngOBfd46POl4pktbB+PNWN2H/4RfmrMIEoLNLgnjnZIFRBizJe
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1947
paAyxpx62F2G6p/PpN4aFIL9G2tx+Py0rURdHism6oVCGLX9vuTHXNTqlGQAoJePTU2g6jjyoHXb
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1948
cnVGEpVym3PRDOqy9dhFCXZlt74otDMGdEViw7OiapbOWm0yALkWqPud3g1Pd2h3zLdtA7PVwLxR
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1949
MkyAAOyXskYO0g9fQPj+pQ6Qhg5pH13vMBJtt8m1nJ81fr+Zv2ldtXrXyh6qMBbwV7Py27KQecaa
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1950
QRxgokFOBstluVzduw9DYhgmxX9KBPOfdufCmCiF5fvNTb3qy7wrb33K+akYc8GckWLRqGrrqwdw
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1951
ok72dPm0J3mqkI5FgSy3rb/kAsnTLb+Sp8pLVTmwScCWTkOZVXWzBmGoSllAwqnLCuvtzwPlF/aF
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1952
vE/Fp2L57bGqIA1IbwTcVBeUtgKhndNc2KR6qu+dh9fp7MWwfpchZzN6VBT7fdn8qQRwD3KI1PWs
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1953
LcR8/OZ6WKv3F5X+oF75Gk7RXFB+HtHpMHsNr75UxL83uapSR6aOWPW7FyhUFy05U4CVl8w0IBos
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1954
jQ1ZY86DdUPxX0qpBpDViX9Hqb/FqOqe2vWaTg3KP54ZcoIFS8N9HfUpCmHNkeRnI1pKGdNG94FC
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1955
BWahHjJrh3zMTdJ23enGGkDX25sanfZNrRrt+bAWLg68TeJD7pAplM+sN+OGsCZfBLTfoAE3FPD3
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1956
MiuWHWF0S424umJKnO6Kvwd3d420Qp/uddRd3dRLI3Z1p4rhmy9lphLoIIhix06dui+2EXqrS6ci
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1957
hyDljbrzUl4+jVap1lvFZfyuurDSfiZVsVR+fvv7XebzkBYrW3CuX8ryG50S6nOSpfgiCvUHzDlA
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1958
2dlO5AfV5X002TboNPpUQSui8l99krNUrpgB5dcWoGqmbu1RzoWAI/EK6lD1uQBd8awglmB4rWv9
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1959
9hDWNSjbs3ZLoHHb0Zx3hMq8y2Z7NlsCEcWd8rAWsydsp5orXgrDNTuEF0o0z2X1ud10bR0MYZS0
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1960
Ie2ncAopNErcAEwVisADTPfoegEknyuxrZxKtAQ0NMBe/Z5RRFKsr1JmALpX7ZPOsrWqpqvX0D/o
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1961
ZG0yNUe2bVIuxOGd+bG86LTG2dnBsKa6eq63uKAyXXItPtj4WR5Esbxa9rX1A1r82+cqawA+iDH8
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1962
q5trYPjntfog8FlFT3UArFJlCGhkZVUddXLk4kKYjvswPVTP3Qi9vsPE7mo/VJsauWGArcaP5Wqs
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1963
sUERbY3BivX8mc7hTjywtR1m6O5fwuinRsC7SwjABnd6F5aXtViuriCibu600OHzls060IKCufql
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1964
g63Zv3Mp/t4j05foQb6spxj7zLkfX/uIVHPsB3RL7aqOIF5qnS8+en6tbzajQo/VVxLPa14fJ/Rc
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1965
7lx3WeOhYTQz6Jip0hhMCqzc72GoPWoLu8Mb0o5f3dXGSLs4BxdoP6/eqLOVh5VO02exqHRaC0vR
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1966
+G+mirJU+fmCq5Ta1xyCRccC897nZW+WyGsxiMawF7e329Zb2621wQDo2I7tLv7jrv9/AfAaXNUU
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1967
TOsyF6jViUG46+NBJqZXv+rRK7Evv2i81ZEw33DQ8y6YowH05r+BuxfN92SX3RbVP8bNymDOGnY7
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1968
16PfvzG+4ecrzfzkjPZya/H/ScnXyqwX/JtSrrL5pbrryu1hPKFrZzsrJD6sUuyPwDGdKerJyxmq
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1969
dvmdHNCrrzU/+2W0pQ6gSvPl/Mertmi+7hBlDhB80kRUqcNeJCGapHNCz1cvCFwsf0A/Ne++jGMf
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1970
TuOJcm6+ZnP9TRR7tWjHreOhZ6huiKnPAP2zfmqpIqHHLG/emnNhyHxSs+JJYfIwj6t2AlLdVneO
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1971
3Is9u0R33ef+Wv2pVizPfbUW0rGhps1FRRfnZ/2xsnr3oT2Slh2tvngsLXu6M0OgIen7ufrjprrD
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1972
vzXQAgNE22ualqzbyAb97uvl6qF/2a5hcU+eBzVWzOdmVjA0PXQMQoAhsulmBv39oU13134SjSlb
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1973
dX85nKW3umfYbtu8713Sylhb2i3v2qaoc8C7S2P3pME8uIGedi1IxXbL+adi+P2fT8Xy/m+/PrxZ
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1974
/TrXDcpqOMjotwdo9AJmg8r1N7BySygc+Gp+XaYdJhpV8f/7Oy3Y1s330l09YBDTjnyjn5qHGF7x
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1975
6O7hZfMXz21OyLZB6lUfOGAGMzo/bjaL7VaV7Ha76D/1yJVEqKmr+L2nCbH7+959wDtv38JZplQG
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1976
BDaonX65d/fwEjNqlDjLVIvM9X+XVxF7
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1977
""")
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1978
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1979
##file distribute_setup.py
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1980
DISTRIBUTE_SETUP_PY = convert("""
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1981
eJztG2tz2zbyu34FTh4PqYSi7TT3GM+pM2nj9DzNJZnYaT8kHhoiIYk1X+XDsvrrb3cBkCAJyc61
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1982
dzM3c7qrIxGLxWLfuwCP/lTs6k2eTabT6Xd5Xld1yQsWxfBvvGxqweKsqnmS8DoGoMnliu3yhm15
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1983
VrM6Z00lWCXqpqjzPKkAFkdLVvDwjq+FU8lBv9h57JemqgEgTJpIsHoTV5NVnCB6+AFIeCpg1VKE
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1984
dV7u2DauNyyuPcaziPEoogm4IMLWecHylVxJ4z8/n0wYfFZlnhrUBzTO4rTIyxqpDTpqCb7/yJ2N
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1985
dliKXxsgi3FWFSKMV3HI7kVZATOQhm6qh98BKsq3WZLzaJLGZZmXHstL4hLPGE9qUWYceKqBuh17
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1986
tGgIUFHOqpwtd6xqiiLZxdl6gpvmRVHmRRnj9LxAYRA/bm+HO7i99SeTa2QX8TekhRGjYGUD3yvc
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1987
SljGBW1PSZeoLNYlj0x5+qgUE8W8vNLfql37tY5Tob+vspTX4aYdEmmBFLS/eUk/Wwk1dYwqI0eT
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1988
fD2Z1OXuvJNiFaP2yeFPVxcfg6vL64uJeAgFkH5Jzy+QxXJKC8EW7F2eCQObJrtZAgtDUVVSVSKx
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1989
YoFU/iBMI/cZL9fVTE7BD/4EZC5s1xcPImxqvkyEN2PPaaiFK4FfZWag90PgqEvY2GLBTid7iT4C
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1990
RQfmg2hAihFbgRQkQeyF/80fSuQR+7XJa1AmfNykIquB9StYPgNd7MDgEWIqwNyBmBTJdwDmmxdO
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1991
t6QmCxEK3OasP6bwOPA/MG4YHw8bbHOmx9XUYccIOIJTMMMhtenPHQXEOviiVqxuhtLJK78qOFid
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1992
C98+BD+/urz22IBp7Jkps9cXb159ensd/HTx8ery/TtYb3rq/8V/8XLaDn36+BYfb+q6OD85KXZF
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1993
7EtR+Xm5PlFOsDqpwFGF4iQ66fzSyXRydXH96cP1+/dvr4I3r368eD1YKDw7m05MoA8//hBcvnvz
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1994
Hsen0y+Tf4qaR7zm85+kOzpnZ/7p5B340XPDhCft6HE1uWrSlINVsAf4TP6Rp2JeAIX0e/KqAcpL
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1995
8/tcpDxO5JO3cSiySoG+FtKBEF58AASBBPftaDKZkBorX+OCJ1jCvzNtA+IBYk5IyknuXQ7TYJ0W
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1996
4CJhy9qb+OldhN/BU+M4uA1/y8vMdS46JKADx5XjqckSME+iYBsBIhD/WtThNlIYWi9BUGC7G5jj
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1997
mlMJihMR0oX5eSGydhctTKD2obbYm+yHSV4JDC+dQa5zRSxuug0ELQD4E7l1IKrg9cb/BeAVYR4+
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1998
TECbDFo/n97MxhuRWLqBjmHv8i3b5uWdyTENbVCphIZhaIzjsh1kr1vddmamO8nyuufAHB2xYTlH
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  1999
IXcGHqRb4Ap0FEI/4N+Cy2LbMoevUVNqXTGTE99YeIBFCIIW6HlZCi4atJ7xZX4v9KRVnAEemypI
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2000
zZlpJV42MTwQ67UL/3laWeFLHiDr/q/T/wM6TTKkWJgxkKIF0XcthKHYCNsJQsq749Q+HZ//in+X
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2001
6PtRbejRHH/Bn9JA9EQ1lDuQUU1rVymqJqn7ygNLSWBlg5rj4gGWrmi4W6XkMaSol+8pNXGd7/Mm
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2002
iWgWcUraznqNtqKsIAKiVQ7rqnTYa7PaYMkroTdmPI5EwndqVWTlUA0UvNOFyflxNS92x5EP/0fe
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2003
WRMJ+ByzjgoM6uoHRJxVDjpkeXh2M3s6e5RZAMHtXoyMe8/+99E6+OzhUqdXjzgcAqScDckHfyjK
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2004
2j31WCd/lf326x4jyV/qqk8H6IDS7wWZhpT3oMZQO14MUqQBBxZGmmTlhtzBAlW8KS1MWJz92QPh
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2005
BCt+JxbXZSNa75pyMvGqgcJsS8kz6ShfVnmChoq8mHRLGJoGIPiva3Jvy6tAckmgN3WKu3UAJkVZ
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2006
W0VJLPI3zaMmERVWSl/a3TgdV4aAY0/c+2GIprdeH0Aq54ZXvK5LtwcIhhJERtC1JuE4W3HQnoXT
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2007
UL8CHoIo59DVLi3EvrKmnSlz79/jLfYzr8cMX5Xp7rRjybeL6XO12sxC1nAXfXwqbf4+z1ZJHNb9
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2008
pQVoiawdQvIm7gz8yVBwplaNeY/TIdRBRuJvSyh03RHE9Jo8O20rMnsORm/G/XZxDAUL1PooaH4P
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2009
6TpVMl+y6RgftlJCnjk11pvK1AHzdoNtAuqvqLYAfCubDKOLzz4kAsRjxadbB5yleYmkhpiiaUJX
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2010
cVnVHpgmoLFOdwDxTrscNv9k7MvxLfBfsi+Z+31TlrBKspOI2XE5A+Q9/y98rOIwcxirshRaXLsv
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2011
+mMiqSz2ARrIBiZn2PfngZ+4wSkYmamxk9/tK2a/xhqeFEP2WYxVr9tsBlZ9l9dv8iaLfrfRPkqm
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2012
jcRRqnPIXQVhKXgtht4qwM2RBbZZFIarA1H698Ys+lgCl4pXygtDPfy6a/G15kpxtW0kgu0leUil
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2013
C7U5FePjWnbuMqjkZVJ4q2i/ZdWGMrMltiPveRL3sGvLy5p0KUqwaE6m3HoFwoXtP0p6qWPS9iFB
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2014
C2iKYLc9ftwy7HG44CPCjV5dZJEMm9ij5cw5cWY+u5U8ucUVe7k/+BdRCp1Ctv0uvYqIfLlH4mA7
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2015
Xe2BOqxhnkXU6yw4BvqlWKG7wbZmWDc86TqutL8aK6na12L4jyQMvVhEQm1KqIKXFIUEtrlVv7lM
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2016
sKyaGNZojZUGihe2ufX6twDVAVs/veTYxzJs/Rs6QCV92dQue7kqCpI9b7HI/I/fC2DpnhRcg6rs
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2017
sgwRHexLtVYNax3kzRLt7Bx5/uo+j1GrC7TcqCWny3BGIb0tXlrrIR9fTT3cUt9lS6IUl9zR8BH7
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2018
KHh0QrGVYYCB5AxIZ0swuTsPO+xbVEKMhtK1gCaHeVmCuyDrGyCD3ZJWa3uJ8ayjFgSvVVh/sCmH
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2019
CUIZgj7waJBRSTYS0ZJZHptul9MRkEoLEFk3NvKZShKwliXFAAJ0iT6AB/yWcAeLmvBd55QkDHtJ
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2020
yBKUjFUlCO66Au+1zB/cVZOF6M2UE6Rhc5zaqx579uxuOzuQFcvmf1efqOnaMF5rz3Ilnx9KmIew
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2021
mDNDIW1LlpHa+ziXraRRm938FLyqRgPDlXxcBwQ9ft4u8gQcLSxg2j+vwGMXKl2wSHpCYtNNeMMB
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2022
4Mn5/HDefhkq3dEa0RP9o9qslhnTfZhBVhFYkzo7pKn0pt4qRSeqAvQNLpqBB+4CPEBWdyH/Z4pt
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2023
PLxrCvIWK5lYi0zuCCK7DkjkLcG3BQqH9giIeGZ6DeDGGHahl+44dAQ+DqftNPMsPa1XfQizXap2
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2024
3WlDN+sDQmMp4OsJkE1ibAjIGRDFMp8zNwGGtnVswVK5Nc07eya4svkh0u2JIQZYz/Quxoj2TXio
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2025
rNlmFZp2cUPeGzxWqEZ7lggysdWRGZ9ClHX8929f+8cVHmnh6aiPf0ad3Y+ITgY3DCS57ClKEjVO
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2026
1eTF2hZ/urZRtQH9sCU2ze8hWQbTCMwOuVskPBQbUHahO9WDMB5X2Gscg/Wp/5TdQSDsNd8h8VJ7
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2027
MObu168V1h09/4PpqL4QYDSC7aQA1eq02Vf/ujjXM/sxz7BjOMfiYOju9eIjb7kE6d+ZbFn1y6OO
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2028
A12HlFJ489DcXHfAgMlIC0BOqAUiEfJINm9qTHrRe2z5rrM5XecMEzaDPR6Tqq/IH0hUzTc40Tlz
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2029
ZTlAdtCDla6qF0FGk6Q/VDM8ZjmvVJ1txdGRb++4AabAhy7KY31qrMp0BJi3LBG1UzFU/Nb5DvnZ
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2030
KpriN+qaa7bwvEHzT7Xw8SYCfjW4pzEckoeC6R2HDfvMCmRQ7ZreZoRlHNNteglOVTbuga2aWMWJ
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2031
PW1056q7yBMZbQJnsJO+P97na4beeR+c9tV8Bel0e0SM6yumGAEMQdobK23burWRjvdYrgAGPBUD
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2032
/5+mQESQL39xuwNHX/e6CygJoe6Ske2xLkPPuUm6v2ZKz+Wa5IJKWoqpx9ywRdiaObqxMHZBxKnd
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2033
PfEITE5FKvfJpyayIuw2qiKxYUXq0Kbq/CAs8KWnc+6+qwKepO0rnN6AlJH/07wcO0Cr55HgB/zO
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2034
0Id/j/KXkXw0q0uJWgd5OC2yuk8C2J8iSVbVbU60n1WGjHyY4AyTksFW6o3B0W4r6vFjW+mRYXTK
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2035
hvJ6fH+PmdjQ0zwCPuvl823Q63K6IxVKIAKFd6hKMf6y5dd7FVRmwBc//DBHEWIIAXHK71+hoPEo
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2036
hT0YZ/fFhKfGVcO3d7F1T7IPxKd3Ld/6jw6yYvaIaT/Kuf+KTRms6JUdSlvslYca1Pol+5RtRBtF
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2037
s+9kH3NvOLOczCnM1KwNilKs4gdXe/ouuLRBjkKDOpSE+vveOO839oa/1YU6DfhZf4EoGYkHI2w+
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2038
Pzu/abMoGvT0tTuRNakoubyQZ/ZOEFTeWJX51nxewl7lPQi5iWGCDpsAHD6sWdYVtplRiRcYRiQe
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2039
S2OmzgslGZpZJHHtOrjOwpl9ng9O5wwWaPaZiylcwyMiSRWWhpIK64FrApopbxF+K/lj7yH1yK0+
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2040
E+RzC5VfS2lHIzC3qUTp0NFCdzlWHRViG9fasbGt0s62GIbUyJGqDpX9KuR0oGicO+rrkTbb3Xsw
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2041
fqhDdcS2wgGLCoEES5A3sltQSONWT5QLyZRKiBTPGczj0XGXhH5u0Vz6pYK6d4RsGG/IiEOYmMLk
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2042
beVj1tY/0/c/yvNeTLbBK5bgjHrliT1xH2gLxXzEsCA3rjyu4tz1rhAjvmGr0jhIevXh8g8mfNYV
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2043
gUOEoJB9ZTRvc5nvFpgliSzM7aI5YpGohbo1h8EbT+LbCIiaGg1z2PYYbjEkz9dDQ30233kwih65
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2044
NGi3bodYVlG8oEMF6QtRIckXxg9EbFHm93EkIvn6Q7xS8OaLFpXRfIjUhbvU6w41dMfRrDj6gcNG
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2045
mV0KChsw1BsSDIjkWYjtHuhYW+WNcKBlA/XH/hqll4aBVUo5VuZ1PbUlyyZ8kUUqaNCdsT2byuby
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2046
Nl8nvB4daN/7+2hWqerJijTAYfOwlqaKceFzP0n7MiYLKYcTKEWiuy//RJ3rdyO+Igfdm4QeaD4P
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2047
eNOfN24/m7rRHt2hWdP5snR/dNZr+PtMDEXbz/5/rzwH9NJpZyaMhnnCmyzcdClc92QYKT+qkd6e
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2048
MbSxDcfWFr6RJCGo4NdvtEioIi5Yyss7PMvPGacDWN5NWDat8bSp3vk3N5gufHbmoXkjm7IzvGKT
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2049
iLlqAczFA72/BDnzPOUZxO7IuTFCnMZ4etP2A7BpZiaYn/tvXNyw5+20icZB93OsL9O03DMuJVci
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2050
WcnG+WLqTz2WCrw4UC0wpnQnM+oiNR0EKwh5zEiXAErgtmQt/gzlFSN9j1jvr7vQgD4Z3/XKtxlW
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2051
1Wke4Vth0v9js58AClGmcVXRa1rdkZ1GEoMSUsMLZB5VPrvFDTjtxRB8RQuQrgQRMrpGDYQqDsBX
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2052
mKx25KAnlqkpT4iIFF+5o8siwE8imRqAGg/22JUWg8Yud2wtaoXLnfVvUKiELMyLnfkbCjHI+NWN
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2053
QMlQeZ1cAyjGd9cGTQ6APty0eYEWyygf0AMYm5PVpK0+YCXyhxBRFEivclbDqv898EtHmrAePepC
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2054
S8VXAqUqBsf6HaTPC6hAI1et0Xdlmq4FccvHPwcB8T4Z9m1evvwb5S5hnIL4qGgC+k7/enpqJGPJ
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2055
ylei1zil8rc5xUeB1ipYhdw3STYN3+zpsb8z94XHXhocQhvD+aJ0AcOZh3hezKzlQpgWBONjk0AC
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2056
+t3p1JBtiNSVmO0ApaTetR09jBDdid1CK6CPx/2gvkizgwQ4M48pbPLqsGYQZG500QNwtRbcWi2q
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2057
LokDU7kh8wZKZ4z3iKRzQGtbQwu8z6DR2TlJOdwAcZ2MFd7ZGLCh88UnAIYb2NkBQFUgmBb7b9x6
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2058
lSqKkxPgfgJV8Nm4AqYbxYPq2nZPgZAF0XLtghJOlWvBN9nwwpPQ4SDlMdXc9x7bc8mvCwSXh153
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2059
JRW44NVOQWnnd/j6v4rxw5fbgLiY7r9g8hRQRR4ESGoQqHcpie42ap6d38wm/wIwBuVg
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2060
""")
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2061
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2062
##file activate.sh
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2063
ACTIVATE_SH = convert("""
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2064
eJytVVFvokAQfudXTLEP2pw1fW3jg01NNGm1KV4vd22zrDDIJrhrYJHay/33m0VEKGpyufIg7s63
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2065
M9/OfDO0YBaKBAIRISzTRMMcIU3Qh0zoEOxEpbGHMBeyxz0t1lyjDRdBrJYw50l4YbVgo1LwuJRK
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2066
Q5xKEBp8EaOno41l+bg7Be0O/LaAnhbEmKAGFfmAci1iJZcoNax5LPg8wiRHiQBeoCvBPmfT+zv2
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2067
PH6afR/cs8fBbGTDG9yADlHmSPOY7f4haInA95WKdQ4s91JpeDQO5fZAnKTxczaaTkbTh+EhMqWx
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2068
QWl/rEGsNJ2kV0cRySKleRGTUKWUVB81pT+vD3Dpw0cSfoMsFF4IIV8jcHqRyVPLpTHrkOu89IUr
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2069
EoDHo4gkoBUsiAFVlP4FKjaLFSeNFEeTS4AfJBOV6sKshVwUbmpAkyA4N8kFL+RygQlkpDfum58N
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2070
GO1QWNLFipij/yn1twOHit5V29UvZ8Seh0/OeDo5kPz8at24lp5jRXSuDlXPuWqUjYCNejlXJwtV
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2071
mHcUtpCddTh53hM7I15EpA+2VNLHRMep6Rn8xK0FDkYB7ABnn6J3jWnXbLvQfyzqz61dxDFGVP1a
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2072
o1Xasx7bsipU+zZjlSVjtlUkoXofq9FHlMZtDxaLCrrH2O14wiaDhyFj1wWs2qIl773iTbZohyza
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2073
iD0TUQQBF5HZr6ISgzKKNZrD5UpvgO5FwoT2tgkIMec+tcYm45sO+fPytqGpBy75aufpTG/gmhRb
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2074
+u3AjQtC5l1l7QV1dBAcadt+7UhFGpXONprZRviAWtbY3dgZ3N4P2ePT9OFxdjJiruJSuLk7+31f
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2075
x60HKiWc9eH9SBc04XuPGCVYce1SXlDyJcJrjfKr7ebSNpEaQVpg+l3wiAYOJZ9GCAxoR9JMWAiv
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2076
+IyoWBSfhOIIIoRar657vSzLLj9Q0xRZX9Kk6SUq0BmPsceNl179Mi8Vii65Pkj21XXf4MAlSy/t
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2077
Exft7A8WX4/iVRkZprZfNK2/YFL/55T+9wm9m86Uhr8A0Hwt
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2078
""")
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2079
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2080
##file activate.fish
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2081
ACTIVATE_FISH = convert("""
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2082
eJydVm1v4jgQ/s6vmA1wBxUE7X2stJVYlVWR2lK13d6d9laRk0yIr8HmbIe0++tvnIQQB9pbXT5A
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2083
Ys/LM55nZtyHx5RrSHiGsMm1gRAh1xhDwU0Kng8hFzMWGb5jBv2E69SDs0TJDdj3MxilxmzPZzP7
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2084
pVPMMl+q9bjXh1eZQ8SEkAZULoAbiLnCyGSvvV6SC7IoBcS4Nw0wjcFbvJDcjiuTswzFDpiIQaHJ
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2085
lQAjQUi1YRmUboC2uZJig8J4PaCnT5IaDcgsbm/CjinOwgx1KcUTMEhhTgV4g2B1fRk8Le8fv86v
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2086
g7v545UHpZB9rKnp+gXsMhxLunIIpwVQxP/l9c/Hq9Xt1epm4R27bva6AJqN92G4YhbMG2i+LB+u
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2087
grv71c3dY7B6WtzfLy9bePbp0taDTXSwJQJszUnnp0y57mvpPcrF7ZODyhswtd59+/jdgw+fwBNS
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2088
xLSscksUPIDqwwNmCez3PpxGeyBYg6HE0YdcWBxcKczYzuVJi5Wu915vn5oWePCCoPUZBN5B7IgV
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2089
MCi54ZDLG7TUZ0HweXkb3M5vFmSpFm/gthhBx0UrveoPpv9AJ9unIbQYdUoe21bKg2q48sPFGVwu
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2090
H+afrxd1qvclaNlRFyh1EQ2sSccEuNAGWQwysfVpz1tPajUqbqJUnEcIJkWo6OXDaodK8ZiLdbmM
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2091
L1wb+9H0D+pcyPSrX5u5kgWSygRYXCnJUi/KKcuU4cqsAyTKZBiissLc7NFwizvjxtieKBVCIdWz
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2092
fzilzPaYyljZN0cGN1v7NnaIPNCGmVy3GKuJaQ6iVjE1Qfm+36hglErwmnAD8hu0dDy4uICBA8ZV
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2093
pQr/q/+O0KFW2kjelu9Dgb9SDBsWV4F4x5CswgS0zBVlk5tDMP5bVtUGpslbm81Lu2sdKq7uNMGh
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2094
MVQ4fy9xhogC1lS5guhISa0DlBWv0O8odT6/LP+4WZzDV6FzIkEqC0uolGZSZoMnlpxplmD2euaT
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2095
O4hkTpPnbztDccey0bhjDaBIqaWQa0uwEtQEwtyU56i4fq54F9IE3ORR6mKriODM4XOYZwaVYLYz
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2096
7SPbKkz4i7VkB6/Ot1upDE3znNqYKpM8raa0Bx8vfvntJ32UENsM4aI6gJL+jJwhxhh3jVIDOcpi
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2097
m0r2hmEtS8XXXNBk71QCDXTBNhhPiHX2LtHkrVIlhoEshH/EZgdq53Eirqs5iFKMnkOmqZTtr3Xq
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2098
djvPTWZT4S3NT5aVLgurMPUWI07BRVYqkQrmtCKohNY8qu9EdACoT6ki0a66XxVF4f9AQ3W38yO5
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2099
mWmZmIIpnDFrbXakvKWeZhLwhvrbUH8fahhqD0YUcBDJjEBMQwiznE4y5QbHrbhHBOnUAYzb2tVN
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2100
jJa65e+eE2Ya30E2GurxUP8ssA6e/wOnvo3V78d3vTcvMB3n7l3iX1JXWqk=
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2101
""")
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2102
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2103
##file activate.csh
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2104
ACTIVATE_CSH = convert("""
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2105
eJx9U11vmzAUffevOCVRu+UB9pws29Kl0iq1aVWllaZlcgxciiViItsQdb9+xiQp+dh4QOB7Pu49
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2106
XHqY59IgkwVhVRmLmFAZSrGRNkdgykonhFiqSCRW1sJSmJg8wCDT5QrucRCyHn6WFRKhVGmhKwVp
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2107
kUpNiS3emup3TY6XIn7DVNQyJUwlrgthJD6n/iCNv72uhCzCpFx9CRkThRQGKe08cWXJ9db/yh/u
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2108
pvzl9mn+PLnjj5P5D1yM8QmXlzBkSdXwZ0H/BBc0mEo5FE5qI2jKhclHOOvy9HD/OO/6YO1mX9vx
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2109
sY0H/tPIV0dtqel0V7iZvWyNg8XFcBA0ToEqVeqOdNUEQFvN41SumAv32VtJrakQNSmLWmgp4oJM
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2110
yDoBHgoydtoEAs47r5wHHnUal5vbJ8oOI+9wI86vb2d8Nrm/4Xy4RZ8R85E4uTZPB5EZPnTaaAGu
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2111
E59J8BE2J8XgrkbLeXMlVoQxznEYFYY8uFFdxsKQRx90Giwx9vSueHP1YNaUSFG4vTaErNSYuBOF
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2112
lXiVyXa9Sy3JdClEyK1dD6Nos9mEf8iKlOpmqSNTZnYjNEWiUYn2pKNB3ttcLJ3HmYYXy6Un76f7
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2113
r8rRsC1TpTJj7f19m5sUf/V3Ir+x/yjtLu8KjLX/CmN/AcVGUUo=
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2114
""")
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2115
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2116
##file activate.bat
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2117
ACTIVATE_BAT = convert("""
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2118
eJyFUkEKgzAQvAfyhz0YaL9QEWpRqlSjWGspFPZQTevFHOr/adQaU1GaUzI7Mzu7ZF89XhKkEJS8
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2119
qxaKMMsvboQ+LxxE44VICSW1gEa2UFaibqoS0iyJ0xw2lIA6nX5AHCu1jpRsv5KRjknkac9VLVug
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2120
sX9mtzxIeJDE/mg4OGp47qoLo3NHX2jsMB3AiDht5hryAUOEifoTdCXbSh7V0My2NMq/Xbh5MEjU
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2121
ZT63gpgNT9lKOJ/CtHsvT99re3pX303kydn4HeyOeAg5cjf2EW1D6HOPkg9NGKhu
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2122
""")
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2123
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2124
##file deactivate.bat
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2125
DEACTIVATE_BAT = convert("""
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2126
eJxzSE3OyFfIT0vj4spMU0hJTcvMS01RiPf3cYkP8wwKCXX0iQ8I8vcNCFHQ4FIAguLUEgWIgK0q
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2127
FlWqXJpcICVYpGzx2BAZ4uHv5+Hv6wq1BWINXBTdKriEKkI1DhW2QAfhttcxxANiFZCBbglQSJUL
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2128
i2dASrm4rFz9XLgAwJNbyQ==
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2129
""")
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2130
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2131
##file activate.ps1
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2132
ACTIVATE_PS = convert("""
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2133
eJylWdmS40Z2fVeE/oHT6rCloNUEAXDThB6wAyQAEjsB29GBjdgXYiWgmC/zgz/Jv+AEWNVd3S2N
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2134
xuOKYEUxM+/Jmzfvcm7W//zXf/+wUMOoXtyi1F9kbd0sHH/hFc2iLtrK9b3FrSqyxaVQwr8uhqJd
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2135
uHaeg9mqzRdR8/13Pyy8qPLdJh0+LMhi0QCoXxYfFh9WtttEnd34H8p6/f1300KauwrULws39e18
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2136
0ZaLNm9rgN/ZVf3h++/e124Vlc0vKsspHy+Yyi5+XbzPhijvCtduoiL/kA1ukWV27n0o7Sb8LIFj
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2137
CvWR5GQgUJdp1Pw8TS9+rPy6SDv/+e3d+0+4qw8f3v20+PliV37efEYBAB9FTKC+RHn/Cfxn3rdv
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2138
00Fube5O+iyCtHDs9BfPfz3q4sfFv9d91Ljhfy7ei0VO+nVTtdOkv/jpt0l2AX6iG1jXgKnnDuD4
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2139
ke2k/i8fzzz5UedkVcP4pwF+Wvz2FJl+3vt598urXf5Y6LNA5WcFOP7r0sW7b9a+W/xcu0Xpv5zk
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2140
Kfq3P9Dz9di/fCxS72MXVU1rpx9L4Bxl85Wmn5a+zP76Zuh3pL9ROWr87PN+//GHIl+oOtvn9XSU
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2141
qH+p0gQBFnx1uV+JLH5O5zv+PXW+WepXVVHZT0+oQezkIATcIm+ivPV/z5J/+cYj3ir4w0Lx09vC
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2142
e5n/y5/Y5LPPfdrqb88ga/PabxZRVfmp39l588m/6u+/e+OpP+dF7n1WZpJ9//Z4v372fDDz9eHB
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2143
7Juvs/BLMHzrxL9+9twXpJfhd1/DrpQ5Euu/vlss3wp9HXC/54C/Ld69m6zwdx3tC0d8daSv0V8B
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2144
n4b9YYF53sJelJV/ix6LZspw/sJtqyl5LJ5r/23htA1Imfm/gt9R7dqVB1LjhydAX4Gb+zksQF59
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2145
9+P7H//U+376afFuvh2/T6P85Xr/5c8C6OXyFY4BGuN+EE0+GeR201b+wkkLN5mmBY5TfMw8ngqL
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2146
CztXxCSXKMCYrRIElWkEJlEPYsSOeKBVZCAQTKBhApMwRFQzmCThE0YQu2CdEhgjbgmk9GluHpfR
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2147
/hhwJCZhGI5jt5FsAkOrObVyE6g2y1snyhMGFlDY1x+BoHpCMulTj5JYWNAYJmnKpvLxXgmQ8az1
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2148
4fUGxxcitMbbhDFcsiAItg04E+OSBIHTUYD1HI4FHH4kMREPknuYRMyhh3AARWMkfhCketqD1CWJ
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2149
mTCo/nhUScoQcInB1hpFhIKoIXLo5jLpwFCgsnLCx1QlEMlz/iFEGqzH3vWYcpRcThgWnEKm0QcS
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2150
rA8ek2a2IYYeowUanOZOlrbWSJUC4c7y2EMI3uJPMnMF/SSXdk6E495VLhzkWHps0rOhKwqk+xBI
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2151
DhJirhdUCTamMfXz2Hy303hM4DFJ8QL21BcPBULR+gcdYxoeiDqOFSqpi5B5PUISfGg46gFZBPo4
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2152
jdh8lueaWuVSMTURfbAUnLINr/QYuuYoMQV6l1aWxuZVTjlaLC14UzqZ+ziTGDzJzhiYoPLrt3uI
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2153
tXkVR47kAo09lo5BD76CH51cTt1snVpMOttLhY93yxChCQPI4OBecS7++h4p4Bdn4H97bJongtPk
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2154
s9gQnXku1vzsjjmX4/o4YUDkXkjHwDg5FXozU0fW4y5kyeYW0uJWlh536BKr0kMGjtzTkng6Ep62
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2155
uTWnQtiIqKnEsx7e1hLtzlXs7Upw9TwEnp0t9yzCGgUJIZConx9OHJArLkRYW0dW42G9OeR5Nzwk
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2156
yk1mX7du5RGHT7dka7N3AznmSif7y6tuKe2N1Al/1TUPRqH6E2GLVc27h9IptMLkCKQYRqPQJgzV
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2157
2m6WLsSipS3v3b1/WmXEYY1meLEVIU/arOGVkyie7ZsH05ZKpjFW4cpY0YkjySpSExNG2TS8nnJx
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2158
nrQmWh2WY3cP1eISP9wbaVK35ZXc60yC3VN/j9n7UFoK6zvjSTE2+Pvz6Mx322rnftfP8Y0XKIdv
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2159
Qd7AfK0nexBTMqRiErvCMa3Hegpfjdh58glW2oNMsKeAX8x6YJLZs9K8/ozjJkWL+JmECMvhQ54x
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2160
9rsTHwcoGrDi6Y4I+H7yY4/rJVPAbYymUH7C2D3uiUS3KQ1nrCAUkE1dJMneDQIJMQQx5SONxoEO
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2161
OEn1/Ig1eBBUeEDRuOT2WGGGE4bNypBLFh2PeIg3bEbg44PHiqNDbGIQm50LW6MJU62JHCGBrmc9
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2162
2F7WBJrrj1ssnTAK4sxwRgh5LLblhwNAclv3Gd+jC/etCfyfR8TMhcWQz8TBIbG8IIyAQ81w2n/C
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2163
mHWAwRzxd3WoBY7BZnsqGOWrOCKwGkMMNfO0Kci/joZgEocLjNnzgcmdehPHJY0FudXgsr+v44TB
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2164
I3jnMGnsK5veAhgi9iXGifkHMOC09Rh9cAw9sQ0asl6wKMk8mpzFYaaDSgG4F0wisQDDBRpjCINg
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2165
FIxhlhQ31xdSkkk6odXZFpTYOQpOOgw9ugM2cDQ+2MYa7JsEirGBrOuxsQy5nPMRdYjsTJ/j1iNw
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2166
FeSt1jY2+dd5yx1/pzZMOQXUIDcXeAzR7QlDRM8AMkUldXOmGmvYXPABjxqkYKO7VAY6JRU7kpXr
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2167
+Epu2BU3qFFXClFi27784LrDZsJwbNlDw0JzhZ6M0SMXE4iBHehCpHVkrQhpTFn2dsvsZYkiPEEB
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2168
GSEAwdiur9LS1U6P2U9JhGp4hnFpJo4FfkdJHcwV6Q5dV1Q9uNeeu7rV8PAjwdFg9RLtroifOr0k
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2169
uOiRTo/obNPhQIf42Fr4mtThWoSjitEdAmFW66UCe8WFjPk1YVNpL9srFbond7jrLg8tqAasIMpy
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2170
zkH0SY/6zVAwJrEc14zt14YRXdY+fcJ4qOd2XKB0/Kghw1ovd11t2o+zjt+txndo1ZDZ2T+uMVHT
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2171
VSXhedBAHoJIID9xm6wPQI3cXY+HR7vxtrJuCKh6kbXaW5KkVeJsdsjqsYsOwYSh0w5sMbu7LF8J
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2172
5T7U6LJdiTx+ca7RKlulGgS5Z1JSU2Llt32cHFipkaurtBrvNX5UtvNZjkufZ/r1/XyLl6yOpytL
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2173
Km8Fn+y4wkhlqZP5db0rooqy7xdL4wxzFVTX+6HaxuQJK5E5B1neSSovZ9ALB8091dDbbjVxhWNY
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2174
Ve5hn1VnI9OF0wpvaRm7SZuC1IRczwC7GnkhPt3muHV1YxUJfo+uh1sYnJy+vI0ZwuPV2uqWJYUH
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2175
bmBsi1zmFSxHrqwA+WIzLrHkwW4r+bad7xbOzJCnKIa3S3YvrzEBK1Dc0emzJW+SqysQfdEDorQG
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2176
9ZJlbQzEHQV8naPaF440YXzJk/7vHGK2xwuP+Gc5xITxyiP+WQ4x18oXHjFzCBy9kir1EFTAm0Zq
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2177
LYwS8MpiGhtfxiBRDXpxDWxk9g9Q2fzPPAhS6VFDAc/aiNGatUkPtZIStZFQ1qD0IlJa/5ZPAi5J
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2178
ySp1ETDomZMnvgiysZSBfMikrSDte/K5lqV6iwC5q7YN9I1dBZXUytDJNqU74MJsUyNNLAPopWK3
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2179
tzmLkCiDyl7WQnj9sm7Kd5kzgpoccdNeMw/6zPVB3pUwMgi4C7hj4AMFAf4G27oXH8NNT9zll/sK
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2180
S6wVlQwazjxWKWy20ZzXb9ne8ngGalPBWSUSj9xkc1drsXkZ8oOyvYT3e0rnYsGwx85xZB9wKeKg
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2181
cJKZnamYwiaMymZvzk6wtDUkxmdUg0mPad0YHtvzpjEfp2iMxvORhnx0kCVLf5Qa43WJsVoyfEyI
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2182
pzmf8ruM6xBr7dnBgzyxpqXuUPYaKahOaz1LrxNkS/Q3Ae5AC+xl6NbxAqXXlzghZBZHmOrM6Y6Y
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2183
ctAkltwlF7SKEsShjVh7QHuxMU0a08/eiu3x3M+07OijMcKFFltByXrpk8w+JNnZpnp3CfgjV1Ax
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2184
gUYCnWwYow42I5wHCcTzLXK0hMZN2DrPM/zCSqe9jRSlJnr70BPE4+zrwbk/xVIDHy2FAQyHoomT
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2185
Tt5jiM68nBQut35Y0qLclLiQrutxt/c0OlSqXAC8VrxW97lGoRWzhOnifE2zbF05W4xuyhg7JTUL
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2186
aqJ7SWDywhjlal0b+NLTpERBgnPW0+Nw99X2Ws72gOL27iER9jgzj7Uu09JaZ3n+hmCjjvZpjNst
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2187
vOWWTbuLrg+/1ltX8WpPauEDEvcunIgTxuMEHweWKCx2KQ9DU/UKdO/3za4Szm2iHYL+ss9AAttm
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2188
gZHq2pkUXFbV+FiJCKrpBms18zH75vax5jSo7FNunrVWY3Chvd8KKnHdaTt/6ealwaA1x17yTlft
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2189
8VBle3nAE+7R0MScC3MJofNCCkA9PGKBgGMYEwfB2QO5j8zUqa8F/EkWKCzGQJ5EZ05HTly1B01E
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2190
z813G5BY++RZ2sxbQS8ZveGPJNabp5kXAeoign6Tlt5+L8i5ZquY9+S+KEUHkmYMRFBxRrHnbl2X
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2191
rVemKnG+oB1yd9+zT+4c43jQ0wWmQRR6mTCkY1q3VG05Y120ZzKOMBe6Vy7I5Vz4ygPB3yY4G0FP
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2192
8RxiMx985YJPXsgRU58EuHj75gygTzejP+W/zKGe78UQN3yOJ1aMQV9hFH+GAfLRsza84WlPLAI/
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2193
9G/5JdcHftEfH+Y3/fHUG7/o8bv98dzzy3e8S+XCvgqB+VUf7sH0yDHpONdbRE8tAg9NWOzcTJ7q
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2194
TuAxe/AJ07c1Rs9okJvl1/0G60qvbdDzz5zO0FuPFQIHNp9y9Bd1CufYVx7dB26mAxwa8GMNrN/U
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2195
oGbNZ3EQ7inLzHy5tRg9AXJrN8cB59cCUBeCiVO7zKM0jU0MamhnRThkg/NMmBOGb6StNeD9tDfA
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2196
7czsAWopDdnGoXUHtA+s/k0vNPkBcxEI13jVd/axp85va3LpwGggXXWw12Gwr/JGAH0b8CPboiZd
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2197
QO1l0mk/UHukud4C+w5uRoNzpCmoW6GbgbMyaQNkga2pQINB18lOXOCJzSWPFOhZcwzdgrsQnne7
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2198
nvjBi+7cP2BbtBeDOW5uOLGf3z94FasKIguOqJl+8ss/6Kumns4cuWbqq5592TN/RNIbn5Qo6qbi
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2199
O4F0P9txxPAwagqPlftztO8cWBzdN/jz3b7GD6JHYP/Zp4ToAMaA74M+EGSft3hEGMuf8EwjnTk/
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2200
nz/P7SLipB/ogQ6xNX0fDqNncMCfHqGLCMM0ZzFa+6lPJYQ5p81vW4HkCvidYf6kb+P/oB965g8K
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2201
C6uR0rdjX1DNKc5pOSTquI8uQ6KXxYaKBn+30/09tK4kMpJPgUIQkbENEPbuezNPPje2Um83SgyX
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2202
GTCJb6MnGVIpgncdQg1qz2bvPfxYD9fewCXDomx9S+HQJuX6W3VAL+v5WZMudRQZk9ZdOk6GIUtC
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2203
PqEb/uwSIrtR7/edzqgEdtpEwq7p2J5OQV+RLrmtTvFwFpf03M/VrRyTZ73qVod7v7Jh2Dwe5J25
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2204
JqFOU2qEu1sP+CRotklediycKfLjeIZzjJQsvKmiGSNQhxuJpKa+hoWUizaE1PuIRGzJqropwgVB
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2205
oo1hr870MZLgnXF5ZIpr6mF0L8aSy2gVnTAuoB4WEd4d5NPVC9TMotYXERKlTcwQ2KiB/C48AEfH
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2206
Qbyq4CN8xTFnTvf/ebOc3isnjD95s0QF0nx9s+y+zMmz782xL0SgEmRpA3x1w1Ff9/74xcxKEPdS
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2207
IEFTz6GgU0+BK/UZ5Gwbl4gZwycxEw+Kqa5QmMkh4OzgzEVPnDAiAOGBFaBW4wkDmj1G4RyElKgj
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2208
NlLCq8zsp085MNh/+R4t1Q8yxoSv8PUpTt7izZwf2BTHZZ3pIZpUIpuLkL1nNL6sYcHqcKm237wp
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2209
T2+RCjgXweXd2Zp7ZM8W6dG5bZsqo0nrJBTx8EC0+CQQdzEGnabTnkzofu1pYkWl4E7XSniECdxy
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2210
vLYavPMcL9LW5SToJFNnos+uqweOHriUZ1ntIYZUonc7ltEQ6oTRtwOHNwez2sVREskHN+bqG3ua
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2211
eaEbJ8XpyO8CeD9QJc8nbLP2C2R3A437ISUNyt5Yd0TbDNcl11/DSsOzdbi/VhCC0KE6v1vqVNkq
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2212
45ZnG6fiV2NwzInxCNth3BwL0+8814jE6+1W1EeWtpWbSZJOJNYXmWRXa7vLnAljE692eHjZ4y5u
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2213
y1u63De0IzKca7As48Z3XshVF+3XiLNz0JIMh/JOpbiNLlMi672uO0wYzOCZjRxcxj3D+gVenGIE
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2214
MvFUGGXuRps2RzMcgWIRolHXpGUP6sMsQt1hspUBnVKUn/WQj2u6j3SXd9Xz0QtEzoM7qTu5y7gR
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2215
q9gNNsrlEMLdikBt9bFvBnfbUIh6voTw7eDsyTmPKUvF0bHqWLbHe3VRHyRZnNeSGKsB73q66Vsk
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2216
taxWYmwz1tYVFG/vOQhlM0gUkyvIab3nv2caJ1udU1F3pDMty7stubTE4OJqm0i0ECfrJIkLtraC
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2217
HwRWKzlqpfhEIqYH09eT9WrOhQyt8YEoyBlnXtAT37WHIQ03TIuEHbnRxZDdLun0iok9PUC79prU
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2218
m5beZzfQUelEXnhzb/pIROKx3F7qCttYIFGh5dXNzFzID7u8vKykA8Uejf7XXz//S4nKvW//ofS/
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2219
QastYw==
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2220
""")
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2221
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2222
##file distutils-init.py
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2223
DISTUTILS_INIT = convert("""
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2224
eJytV92L4zYQf/dfMU0ottuse7RvC6FQrg8Lxz2Ugz4si9HacqKuIxlJ2ST313dG8odkO9d7aGBB
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2225
luZLv/nNjFacOqUtKJMIvzK3cXlhWgp5MDBsqK5SNYftsBAGpLLA4F1oe2Ytl+9wUvW55TswCi4c
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2226
KibhbFDSglXQCFmDPXIwtm7FawLRbwtPzg2T9gf4gupKv4GS0N262w7V0NvpbCy8cvTo3eAus6C5
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2227
ETU3ICQZX1hFTw/dzR6V/AW1RCN4/XAtbsVXqIXmlVX6liS4lOzEYY9QFB2zx6LfoSNjz1a0pqT9
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2228
QOIfJWQ2E888NEVZNqLlZZnvIB0NpHkimlFdKn2iRRY7yGG/CCJb6Iz280d34SFXBS2yEYPNF0Q7
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2229
yM7oCjpWvbEDQmnhRwOs6zjThpKE8HogwRAgraqYFZgGZvzmzVh+mgz9vskT3hruwyjdFcqyENJw
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2230
bbMPO5jdzonxK68QKT7B57CMRRG5shRSWDTX3dI8LzRndZbnSWL1zfvriUmK4TcGWSnZiEPCrxXv
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2231
bM+sP7VW2is2WgWXCO3sAu3Rzysz3FiNCA8WPyM4gb1JAAmCiyTZbhFjWx3h9SzauuRXC9MFoVbc
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2232
yNTCm1QXOOIfIn/g1kGMhDUBN72hI5XCBQtIXQw8UEEdma6Jaz4vJIJ51Orc15hzzmu6TdFp3ogr
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2233
Aof0c98tsw1SiaiWotHffk3XYCkqdToxWRfTFXqgpg2khcLluOHMVC0zZhLKIomesfSreUNNgbXi
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2234
Ky9VRzwzkBneNoGQyyvGjbsFQqOZvpWIjqH281lJ/jireFgR3cPzSyTGWzQpDNIU+03Fs4XKLkhp
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2235
/n0uFnuF6VphB44b3uWRneSbBoMSioqE8oeF0JY+qTvYfEK+bPLYdoR4McfYQ7wMZj39q0kfP8q+
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2236
FfsymO0GzNlPh644Jje06ulqHpOEQqdJUfoidI2O4CWx4qOglLye6RrFQirpCRXvhoRqXH3sYdVJ
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2237
AItvc+VUsLO2v2hVAWrNIfVGtkG351cUMNncbh/WdowtSPtCdkzYFv6mwYc9o2Jt68ud6wectBr8
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2238
hYAulPSlgzH44YbV3ikjrulEaNJxt+/H3wZ7bXSXje/YY4tfVVrVmUstaDwwOBLMg6iduDB0lMVC
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2239
UyzYx7Ab4kjCqdViEJmDcdk/SKbgsjYXgfMznUWcrtS4z4fmJ/XOM1LPk/iIpqass5XwNbdnLb1Y
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2240
8h3ERXSWZI6rZJxKs1LBqVH65w0Oy4ra0CBYxEeuOMbDmV5GI6E0Ha/wgVTtkX0+OXvqsD02CKLf
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2241
XHbeft85D7tTCMYy2Njp4DJP7gWJr6paVWXZ1+/6YXLv/iE0M90FktiI7yFJD9e7SOLhEkkaMTUO
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2242
azq9i2woBNR0/0eoF1HFMf0H8ChxH/jgcB34GZIz3Qn4/vid+VEamQrOVqAPTrOfmD4MPdVh09tb
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2243
8dLLjvh/61lEP4yW5vJaH4vHcevG8agXvzPGoOhhXNncpTr99PTHx6e/UvffFLaxUSjuSeP286Dw
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2244
gtEMcW1xKr/he4/6IQ6FUXP+0gkioHY5iwC9Eyx3HKO7af0zPPe+XyLn7fAY78k4aiR387bCr5XT
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2245
5C4rFgwLGfMvJuAMew==
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2246
""")
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2247
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2248
##file distutils.cfg
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2249
DISTUTILS_CFG = convert("""
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2250
eJxNj00KwkAMhfc9xYNuxe4Ft57AjYiUtDO1wXSmNJnK3N5pdSEEAu8nH6lxHVlRhtDHMPATA4uH
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2251
xJ4EFmGbvfJiicSHFRzUSISMY6hq3GLCRLnIvSTnEefN0FIjw5tF0Hkk9Q5dRunBsVoyFi24aaLg
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2252
9FDOlL0FPGluf4QjcInLlxd6f6rqkgPu/5nHLg0cXCscXoozRrP51DRT3j9QNl99AP53T2Q=
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2253
""")
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2254
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2255
##file activate_this.py
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2256
ACTIVATE_THIS = convert("""
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2257
eJyNU01v2zAMvetXEB4K21jmDOstQA4dMGCHbeihlyEIDMWmG62yJEiKE//7kXKdpN2KzYBt8euR
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2258
fKSyLPs8wiEo8wh4wqZTGou4V6Hm0wJa1cSiTkJdr8+GsoTRHuCotBayiWqQEYGtMCgfD1KjGYBe
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2259
5a3p0cRKiAe2NtLADikftnDco0ko/SFEVgEZ8aRC5GLux7i3BpSJ6J1H+i7A2CjiHq9z7JRZuuQq
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2260
siwTIvpxJYCeuWaBpwZdhB+yxy/eWz+ZvVSU8C4E9FFZkyxFsvCT/ZzL8gcz9aXVE14Yyp2M+2W0
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2261
y7n5mp0qN+avKXvbsyyzUqjeWR8hjGE+2iCE1W1tQ82hsCZN9UzlJr+/e/iab8WfqsmPI6pWeUPd
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2262
FrMsd4H/55poeO9n54COhUs+sZNEzNtg/wanpjpuqHJaxs76HtZryI/K3H7KJ/KDIhqcbJ7kI4ar
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2263
XL+sMgXnX0D+Te2Iy5xdP8yueSlQB/x/ED2BTAtyE3K4SYUN6AMNfbO63f4lBW3bUJPbTL+mjSxS
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2264
PyRfJkZRgj+VbFv+EzHFi5pKwUEepa4JslMnwkowSRCXI+m5XvEOvtuBrxHdhLalG0JofYBok6qj
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2265
YdN2dEngUlbC4PG60M1WEN0piu7Nq7on0mgyyUw3iV1etLo6r/81biWdQ9MWHFaePWZYaq+nmp+t
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2266
s3az+sj7eA0jfgPfeoN1
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2267
""")
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2268
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2269
if __name__ == '__main__':
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2270
    main()
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2271
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2272
## TODO:
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2273
## Copy python.exe.manifest
1f2840354865 correct filter on tag completion to avoid tags that are not translated
ymh <ymh.work@gmail.com>
parents:
diff changeset
  2274
## Monkeypatch distutils.sysconfig