diff options
author | phillip.eby <phillip.eby@6015fed2-1504-0410-9fe1-9d1591cc4771> | 2008-01-18 21:47:09 +0000 |
---|---|---|
committer | phillip.eby <phillip.eby@6015fed2-1504-0410-9fe1-9d1591cc4771> | 2008-01-18 21:47:09 +0000 |
commit | 1674a6edaa9238a5b38dcd7957d053215b304042 (patch) | |
tree | 0718768b974f0a34a6f19591b5434ec825efb12d /setuptools/command | |
parent | 4b539b7e907505e361f0d504def823d308dba4c7 (diff) | |
download | python-setuptools-1674a6edaa9238a5b38dcd7957d053215b304042.tar.gz |
chmod/test cleanups and Jython support.
git-svn-id: http://svn.python.org/projects/sandbox/trunk/setuptools@60061 6015fed2-1504-0410-9fe1-9d1591cc4771
Diffstat (limited to 'setuptools/command')
-rw-r--r-- | setuptools/command/bdist_egg.py | 43 | ||||
-rwxr-xr-x | setuptools/command/easy_install.py | 44 | ||||
-rwxr-xr-x | setuptools/command/install_scripts.py | 10 |
3 files changed, 69 insertions, 28 deletions
diff --git a/setuptools/command/bdist_egg.py b/setuptools/command/bdist_egg.py index 2e9007c..bb1112c 100644 --- a/setuptools/command/bdist_egg.py +++ b/setuptools/command/bdist_egg.py @@ -382,7 +382,7 @@ def analyze_egg(egg_dir, stubs): for flag,fn in safety_flags.items(): if os.path.exists(os.path.join(egg_dir,'EGG-INFO',fn)): return flag - + if not can_scan(): return False safe = True for base, dirs, files in walk_egg(egg_dir): for name in files: @@ -449,6 +449,47 @@ def iter_symbols(code): for name in iter_symbols(const): yield name +def can_scan(): + if not sys.platform.startswith('java') and sys.platform != 'cli': + # CPython, PyPy, etc. + return True + log.warn("Unable to analyze compiled code on this platform.") + log.warn("Please ask the author to include a 'zip_safe'" + " setting (either True or False) in the package's setup.py") + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + # Attribute names of options for commands that might need to be convinced to # install to the egg build directory diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 053bf8d..4f88841 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -608,10 +608,10 @@ Please make the appropriate changes for your system and try again. f = open(target,"w"+mode) f.write(contents) f.close() - try: - os.chmod(target,0755) - except (AttributeError, os.error): - pass + chmod(target,0755) + + + def install_eggs(self, spec, dist_filename, tmpdir): # .egg dirs or files are already built, so just return them @@ -988,18 +988,18 @@ See the setuptools documentation for the "develop" command for more info. def pf(src,dst): if dst.endswith('.py') and not src.startswith('EGG-INFO/'): to_compile.append(dst) - self.unpack_progress(src,dst); to_chmod.append(dst) + to_chmod.append(dst) + elif dst.endswith('.dll') or dst.endswith('.so'): + to_chmod.append(dst) + self.unpack_progress(src,dst) return not self.dry_run and dst or None unpack_archive(egg_path, destination, pf) self.byte_compile(to_compile) if not self.dry_run: - flags = stat.S_IXGRP|stat.S_IXGRP for f in to_chmod: - mode = ((os.stat(f)[stat.ST_MODE]) | 0555) & 07777 - log.debug("changing mode of %s to %o", f, mode) - os.chmod(f, mode) - + mode = ((os.stat(f)[stat.ST_MODE]) | 0555) & 07755 + chmod(f, mode) def byte_compile(self, to_compile): from distutils.util import byte_compile @@ -1435,7 +1435,7 @@ def get_script_header(script_text, executable=sys_executable, wininst=False): def auto_chmod(func, arg, exc): if func is os.remove and os.name=='nt': - os.chmod(arg, stat.S_IWRITE) + chmod(arg, stat.S_IWRITE) return func(arg) exc = sys.exc_info() raise exc[0], (exc[1][0], exc[1][1] + (" %s %s" % (func,arg))) @@ -1530,18 +1530,18 @@ def is_python_script(script_text, filename): return False # Not any Python I can recognize +try: + from os import chmod as _chmod +except ImportError: + # Jython compatibility + def _chmod(*args): pass - - - - - - - - - - - +def chmod(path, mode): + log.debug("changing mode of %s to %o", path, mode) + try: + _chmod(path, mode) + except os.error, e: + log.debug("chmod failed: %s", e) diff --git a/setuptools/command/install_scripts.py b/setuptools/command/install_scripts.py index fb91906..79fa375 100755 --- a/setuptools/command/install_scripts.py +++ b/setuptools/command/install_scripts.py @@ -1,6 +1,6 @@ from distutils.command.install_scripts import install_scripts \ as _install_scripts -from easy_install import get_script_args, sys_executable +from easy_install import get_script_args, sys_executable, chmod from pkg_resources import Distribution, PathMetadata, ensure_directory import os from distutils import log @@ -50,10 +50,10 @@ class install_scripts(_install_scripts): f = open(target,"w"+mode) f.write(contents) f.close() - try: - os.chmod(target,0755) - except (AttributeError, os.error): - pass + chmod(target,0755) + + + |