diff --git a/src/zc/buildout/easy_install.py b/src/zc/buildout/easy_install.py index 4903dcdc66aa01281042bea4b2b9eb57cea9d52f..eeb8da85f46f577fffe3489062f0f5a5cb64d89f 100644 --- a/src/zc/buildout/easy_install.py +++ b/src/zc/buildout/easy_install.py @@ -31,6 +31,7 @@ import setuptools.command.easy_install import setuptools.command.setopt import setuptools.package_index import shutil +import stat import subprocess import sys import tempfile @@ -1623,14 +1624,28 @@ def _fix_file_links(links): def _final_version(parsed_version): return not parsed_version.is_prerelease +def chmod(path): + if os.path.islink(path) or not os.path.exists(path): + return + # give the same permission but write as owner to group and other. + current_perm = os.stat(path).st_mode & \ + (stat.S_IRWXU + stat.S_IRWXG + stat.S_IRWXO) + owner_perm = current_perm & stat.S_IRWXU + new_perm = (owner_perm + owner_perm / 0o010 + owner_perm / 0o100) & \ + (~ 0o022) + if new_perm != current_perm: + os.chmod(path, new_perm) + def redo_pyc(egg): if not os.path.isdir(egg): return for dirpath, dirnames, filenames in os.walk(egg): + chmod(dirpath) for filename in filenames: + filepath = os.path.join(dirpath, filename) + chmod(filepath) if not filename.endswith('.py'): continue - filepath = os.path.join(dirpath, filename) if not (os.path.exists(filepath+'c') or os.path.exists(filepath+'o')): # If it wasn't compiled, it may not be compilable