Commit e15ad8af authored by Jason R. Coombs's avatar Jason R. Coombs

Beginning extraction of ScriptWriter classes for writing console and gui scripts

--HG--
extra : rebase_source : 24c34791314ba58ecb0c7dca7bd7fa02a3a84949
parent e550b63a
......@@ -1780,13 +1780,8 @@ def fix_jython_executable(executable, options):
return executable
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 = (
class ScriptWriter(object):
template = (
"# EASY-INSTALL-ENTRY-SCRIPT: %(spec)r,%(group)r,%(name)r\n"
"__requires__ = %(spec)r\n"
"import sys\n"
......@@ -1797,7 +1792,15 @@ def get_script_args(dist, executable=sys_executable, wininst=False):
" sys.exit(\n"
" load_entry_point(%(spec)r, %(group)r, %(name)r)()\n"
" )\n"
) % locals()
)
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 = ScriptWriter.template % locals()
if sys.platform=='win32' or wininst:
# On Windows/wininst, add a .py extension and an .exe launcher
if group=='gui_scripts':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment