Commit efb23eb7 authored by PJ Eby's avatar PJ Eby

Oddly enough, some setup.py files actually check __name__=='__main__'

--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041022
parent 60f18d3c
...@@ -184,7 +184,7 @@ class Installer: ...@@ -184,7 +184,7 @@ class Installer:
) )
elif multi is None: elif multi is None:
multi = True multi = True
elif not multi: elif not multi:
# explicit false, raise an error # explicit false, raise an error
raise RuntimeError( raise RuntimeError(
...@@ -337,7 +337,9 @@ class Installer: ...@@ -337,7 +337,9 @@ class Installer:
try: try:
sys.argv[:] = [setup_script, '-q', 'bdist_egg'] sys.argv[:] = [setup_script, '-q', 'bdist_egg']
sys.path.insert(0,os.getcwd()) sys.path.insert(0,os.getcwd())
execfile(setup_script, {'__file__':setup_script}) execfile(setup_script,
{'__file__':setup_script, '__name__':'__main__'}
)
except SystemExit, v: except SystemExit, v:
if v.args and v.args[0]: if v.args and v.args[0]:
raise RuntimeError( raise RuntimeError(
...@@ -365,8 +367,6 @@ class Installer: ...@@ -365,8 +367,6 @@ class Installer:
def install_egg(self, egg_path, zip_ok): def install_egg(self, egg_path, zip_ok):
import shutil import shutil
destination = os.path.join(self.instdir, os.path.basename(egg_path)) destination = os.path.join(self.instdir, os.path.basename(egg_path))
...@@ -383,10 +383,10 @@ class Installer: ...@@ -383,10 +383,10 @@ class Installer:
shutil.move(egg_path, destination) shutil.move(egg_path, destination)
else: else:
shutil.copy2(egg_path, destination) shutil.copy2(egg_path, destination)
elif os.path.isdir(egg_path): elif os.path.isdir(egg_path):
shutil.move(egg_path, destination) shutil.move(egg_path, destination)
else: else:
os.mkdir(destination) os.mkdir(destination)
self._extract_zip(egg_path, destination) self._extract_zip(egg_path, destination)
...@@ -502,7 +502,7 @@ def main(argv): ...@@ -502,7 +502,7 @@ def main(argv):
parser.add_option("-z", "--zip", parser.add_option("-z", "--zip",
action="store_true", dest="zip_ok", default=False, action="store_true", dest="zip_ok", default=False,
help="install package as a zipfile") help="install package as a zipfile")
parser.add_option("-m", "--multi-version", parser.add_option("-m", "--multi-version",
action="store_true", dest="multi", default=None, action="store_true", dest="multi", default=None,
help="make apps have to require() a version") help="make apps have to require() a version")
...@@ -512,7 +512,7 @@ def main(argv): ...@@ -512,7 +512,7 @@ def main(argv):
try: try:
if not args: if not args:
raise RuntimeError("No urls, filenames, or requirements specified") raise RuntimeError("No urls, filenames, or requirements specified")
for spec in args: for spec in args:
inst = Installer(options.instdir, options.zip_ok, options.multi) inst = Installer(options.instdir, options.zip_ok, options.multi)
try: try:
......
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