Esempio n. 1
0
def get_script_args(dist,
                    executable=os.path.normpath(sys.executable),
                    wininst=False):
    """Yield write_script() argument tuples for a distribution's entrypoints"""
    header = easy_install.get_script_header("", executable, wininst)
    for group in "console_scripts", "gui_scripts":
        for name, _ep in dist.get_entry_map(group).items():
            script_text = runner_script_template
            if sys.platform == "win32" or wininst:
                # On Windows/wininst, add a .py extension and an .exe launcher
                if group == "gui_scripts":
                    launcher_type = "gui"
                    ext = "-script.pyw"
                    old = [".pyw"]
                    new_header = re.sub("(?i)python.exe", "pythonw.exe",
                                        header)
                else:
                    launcher_type = "cli"
                    ext = "-script.py"
                    old = [".py", ".pyc", ".pyo"]
                    new_header = re.sub("(?i)pythonw.exe", "python.exe",
                                        header)
                if (os.path.exists(new_header[2:-1].strip('"'))
                        or sys.platform != "win32"):
                    hdr = new_header
                else:
                    hdr = header
                yield (name + ext, hdr + script_text, "t",
                       [name + x for x in old])
                yield (
                    name + ".exe",
                    easy_install.get_win_launcher(launcher_type),
                    "b",  # write in binary mode
                )
                if not easy_install.is_64bit():
                    # install a manifest for the launcher to prevent Windows
                    #  from detecting it as an installer (which it will for
                    #  launchers like easy_install.exe). Consider only
                    #  adding a manifest for launchers detected as installers.
                    #  See Distribute #143 for details.
                    m_name = name + ".exe.manifest"
                    yield (m_name, easy_install.load_launcher_manifest(name),
                           "t")
            else:
                # On other platforms, we assume the right thing to do is to
                # just write the stub with no extension.
                yield (name, header + script_text)
Esempio n. 2
0
    def get_script_args(dist, executable=sys_executable, wininst=False):
        """Yield write_script() argument tuples for a distribution's entrypoints"""
        spec = str(dist.as_requirement())
        header = get_script_header("", executable, wininst)
        for group in 'console_scripts', 'gui_scripts':
            for name, ep in dist.get_entry_map(group).items():
                script_text = (
                    "# EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r\n"
                    "__requires__ = %(spec)r\n"
                    "import sys\n"
                    "from pkg_resources import load_entry_point\n"
                    "\n"
                    "if __name__ == '__main__':"
                    "\n"
                    "    sys.exit(\n"
                    "        load_entry_point(%(spec)r, %(group)r, %(name)r)()\n"
                    "    )\n"
                ) % locals()
                if sys.platform=='win32' or wininst:
                    # On Windows/wininst, add a .py extension and an .exe launcher
                    if group=='gui_scripts':
                        ext, launcher = '-script.pyw', 'gui.exe'
                        old = ['.pyw']
                        new_header = re.sub('(?i)python.exe','pythonw.exe',header)
                    else:
                        ext, launcher = '-script.py', 'cli.exe'
                        old = ['.py','.pyc','.pyo']
                        new_header = re.sub('(?i)pythonw.exe','python.exe',header)

                    if (sys.platform=='win32' and is_64bit()) or ('--plat-name=win-amd64' in sys.argv):
                        launcher = launcher.replace(".", "-64.")
                    else: # on linux (build system) always fall back to this
                        launcher = launcher.replace(".", "-32.")
                    if os.path.exists(new_header[2:-1]) or sys.platform!='win32':
                        hdr = new_header
                    else:
                        hdr = header
                    yield (name+ext, hdr+script_text, 't', [name+x for x in old])
                    yield (
                        name+'.exe', resource_string('setuptools', launcher),
                        'b' # write in binary mode
                    )
                else:
                    # On other platforms, we assume the right thing to do is to
                    # just write the stub with no extension.
                    yield (name, header+script_text)
Esempio n. 3
0
def get_script_args(dist, executable=sys_executable, wininst=False):
    """Yield write_script() argument tuples for a distribution's entrypoints"""
    header = get_script_header("", executable, wininst)
    for group in 'console_scripts', 'gui_scripts':
        for name, ep in dist.get_entry_map(group).items():
            script_text = """import sys
if __name__ == '__main__':
    import {module_name}
    sys.exit({module_name}.{attrs}())
""".format(
                module_name=ep.module_name,
                attrs='.'.join(ep.attrs),
            )
            if sys.platform == 'win32' or wininst:
                # On Windows/wininst, add a .py extension and an .exe launcher
                if group == 'gui_scripts':
                    ext, launcher = '-script.pyw', 'gui.exe'
                    old = ['.pyw']
                    new_header = re.sub('(?i)python.exe', 'pythonw.exe',
                                        header)
                else:
                    ext, launcher = '-script.py', 'cli.exe'
                    old = ['.py', '.pyc', '.pyo']
                    new_header = re.sub('(?i)pythonw.exe', 'python.exe',
                                        header)
                if is_64bit():
                    launcher = launcher.replace(".", "-64.")
                else:
                    launcher = launcher.replace(".", "-32.")
                if os.path.exists(new_header[2:-1]) or sys.platform != 'win32':
                    hdr = new_header
                else:
                    hdr = header
                yield (name + ext, hdr + script_text, 't',
                       [name + x for x in old])
                yield (
                    name + '.exe',
                    resource_string('setuptools', launcher),
                    'b'  # write in binary mode
                )
            else:
                # On other platforms, we assume the right thing to do is to
                # just write the stub with no extension.
                yield (name, header + script_text)
Esempio n. 4
0
def get_script_args(dist, executable=os.path.normpath(sys.executable), wininst=False):
    """Yield write_script() argument tuples for a distribution's entrypoints"""
    header = easy_install.get_script_header("", executable, wininst)
    for group in 'console_scripts', 'gui_scripts':
        for name, _ep in dist.get_entry_map(group).items():
            script_text = runner_script_template
            if sys.platform=='win32' or wininst:
                # On Windows/wininst, add a .py extension and an .exe launcher
                if group=='gui_scripts':
                    launcher_type = 'gui'
                    ext = '-script.pyw'
                    old = ['.pyw']
                    new_header = re.sub('(?i)python.exe','pythonw.exe',header)
                else:
                    launcher_type = 'cli'
                    ext = '-script.py'
                    old = ['.py','.pyc','.pyo']
                    new_header = re.sub('(?i)pythonw.exe','python.exe',header)
                if os.path.exists(new_header[2:-1].strip('"')) or sys.platform!='win32':
                    hdr = new_header
                else:
                    hdr = header
                yield (name+ext, hdr+script_text, 't', [name+x for x in old])
                yield (
                    name+'.exe', easy_install.get_win_launcher(launcher_type),
                    'b' # write in binary mode
                )
                if not easy_install.is_64bit():
                    # install a manifest for the launcher to prevent Windows
                    #  from detecting it as an installer (which it will for
                    #  launchers like easy_install.exe). Consider only
                    #  adding a manifest for launchers detected as installers.
                    #  See Distribute #143 for details.
                    m_name = name + '.exe.manifest'
                    yield (m_name, easy_install.load_launcher_manifest(name), 't')
            else:
                # On other platforms, we assume the right thing to do is to
                # just write the stub with no extension.
                yield (name, header+script_text)
Esempio n. 5
0
def get_script_args(dist, executable=sys_executable, wininst=False):
    """Yield write_script() argument tuples for a distribution's entrypoints"""
    header = get_script_header("", executable, wininst)
    for group in 'console_scripts', 'gui_scripts':
        for name, ep in dist.get_entry_map(group).items():
            script_text = """import sys
if __name__ == '__main__':
    import {module_name}
    sys.exit({module_name}.{attrs}())
""".format(module_name=ep.module_name, attrs='.'.join(ep.attrs),
           )
            if sys.platform == 'win32' or wininst:
                # On Windows/wininst, add a .py extension and an .exe launcher
                if group == 'gui_scripts':
                    ext, launcher = '-script.pyw', 'gui.exe'
                    old = ['.pyw']
                    new_header = re.sub('(?i)python.exe', 'pythonw.exe', header)
                else:
                    ext, launcher = '-script.py', 'cli.exe'
                    old = ['.py', '.pyc', '.pyo']
                    new_header = re.sub('(?i)pythonw.exe', 'python.exe', header)
                if is_64bit():
                    launcher = launcher.replace(".", "-64.")
                else:
                    launcher = launcher.replace(".", "-32.")
                if os.path.exists(new_header[2:-1]) or sys.platform != 'win32':
                    hdr = new_header
                else:
                    hdr = header
                yield (name+ext, hdr+script_text, 't', [name+x for x in old])
                yield (
                    name+'.exe', resource_string('setuptools', launcher),
                    'b'  # write in binary mode
                )
            else:
                # On other platforms, we assume the right thing to do is to
                # just write the stub with no extension.
                yield (name, header+script_text)
Esempio n. 6
0
V8_SNAPSHOT_ENABLED = not DEBUG  # build using snapshots for faster start-up
V8_NATIVE_REGEXP = True  # Whether to use native or interpreted regexp implementation
V8_OBJECT_PRINT = DEBUG  # enable object printing
V8_EXTRA_CHECKS = DEBUG  # enable extra checks
V8_VERIFY_HEAP = DEBUG  # enable verify heap
V8_GDB_JIT = False  # enable GDB jit
V8_VTUNE_JIT = False
V8_DISASSEMBLEER = DEBUG  # enable the disassembler to inspect generated code
V8_DEBUGGER_SUPPORT = True  # enable debugging of JavaScript code
V8_LIVE_OBJECT_LIST = DEBUG  # enable live object list features in the debugger
V8_WERROR = False  # ignore compile warnings
V8_STRICTALIASING = True  # enable strict aliasing
V8_BACKTRACE = True
V8_I18N = False

IS_64BIT = is_64bit()
IS_ARM = 'arm' in platform.processor()

ARCH = 'x64' if IS_64BIT else 'arm' if IS_ARM else 'ia32'
MODE = 'debug' if DEBUG else 'release'

LIBV8_PATH = "libv8"
LIBV8_SVN_URL = "http://v8.googlecode.com/svn/trunk/"
LIBV8_SVN_REV = 19632

# fixes distutils bug that causes warning when compiling
# c++ with gcc and the -Wstrict-prototypes flag
(opt, ) = get_config_vars('OPT')
os.environ['OPT'] = " ".join(flag for flag in opt.split()
                             if flag != '-Wstrict-prototypes')
Esempio n. 7
0
V8_SNAPSHOT_ENABLED = not DEBUG # build using snapshots for faster start-up
V8_NATIVE_REGEXP = True         # Whether to use native or interpreted regexp implementation
V8_OBJECT_PRINT = DEBUG         # enable object printing
V8_EXTRA_CHECKS = DEBUG         # enable extra checks
V8_VERIFY_HEAP = DEBUG          # enable verify heap
V8_GDB_JIT = False              # enable GDB jit
V8_VTUNE_JIT = False
V8_DISASSEMBLEER = DEBUG        # enable the disassembler to inspect generated code
V8_DEBUGGER_SUPPORT = True      # enable debugging of JavaScript code
V8_LIVE_OBJECT_LIST = DEBUG     # enable live object list features in the debugger
V8_WERROR = False               # ignore compile warnings
V8_STRICTALIASING = True        # enable strict aliasing
V8_BACKTRACE = True
V8_I18N = False

IS_64BIT = is_64bit()
IS_ARM = 'arm' in platform.processor()

ARCH = 'x64' if IS_64BIT else 'arm' if IS_ARM else 'ia32'
MODE = 'debug' if DEBUG else 'release'

LIBV8_PATH = "libv8"
LIBV8_SVN_URL = "http://v8.googlecode.com/svn/trunk/"
LIBV8_SVN_REV = 19632

# fixes distutils bug that causes warning when compiling
# c++ with gcc and the -Wstrict-prototypes flag
(opt,) = get_config_vars('OPT')
os.environ['OPT'] = " ".join(
    flag for flag in opt.split() if flag != '-Wstrict-prototypes'
)