Commit ef3949e2 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Xavier Thompson

[fix] Give owner's non-write permissions to group and other

parent 07a3a7e4
......@@ -33,6 +33,7 @@ import setuptools.command.easy_install
import setuptools.command.setopt
import setuptools.package_index
import shutil
import stat
import subprocess
import sys
import tempfile
......@@ -1595,14 +1596,27 @@ class MissingDistribution(zc.buildout.UserError):
req, ws = self.data
return "Couldn't find a distribution for %r." % str(req)
def chmod(path):
mode = os.lstat(path).st_mode
if stat.S_ISLNK(mode):
return
# give the same permission but write as owner to group and other.
mode = stat.S_IMODE(mode)
urx = (mode >> 6) & 5
new_mode = mode & ~0o77 | urx << 3 | urx
if new_mode != mode:
os.chmod(path, new_mode)
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
......
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