aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command/easy_install.py
diff options
context:
space:
mode:
authortarek <none@none>2009-10-27 09:44:07 +0100
committertarek <none@none>2009-10-27 09:44:07 +0100
commit6ef67c96970c10cc7cb5d4c4093abc40817fa2ba (patch)
tree752132891e589e019e51cf0bf8dc69794f90e836 /setuptools/command/easy_install.py
parent9d29ae853126d08c8779e7e158905ae263d6f52a (diff)
downloadexternal_python_setuptools-6ef67c96970c10cc7cb5d4c4093abc40817fa2ba.tar.gz
external_python_setuptools-6ef67c96970c10cc7cb5d4c4093abc40817fa2ba.tar.bz2
external_python_setuptools-6ef67c96970c10cc7cb5d4c4093abc40817fa2ba.zip
Generated scripts now wraps their call in a __main__ section. Fixes #11
--HG-- branch : distribute extra : rebase_source : d69b879d01ca2690826cdf9b7541e541ae8e0f5a
Diffstat (limited to 'setuptools/command/easy_install.py')
-rwxr-xr-xsetuptools/command/easy_install.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 195139c7..c83e4283 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -1591,16 +1591,18 @@ def get_script_args(dist, executable=sys_executable, wininst=False):
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():
+ 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"
- "sys.exit(\n"
- " load_entry_point(%(spec)r, %(group)r, %(name)r)()\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