aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2020-03-25 13:44:58 -0400
committerJason R. Coombs <jaraco@jaraco.com>2020-03-25 13:48:32 -0400
commit70e95ee66a17e1655f70c9dbda107cea958f583f (patch)
treea9e2c3ffa067ec614eeb08cde4ef16163b488dca
parenta3620a45b3df9be32316bd8807ca5a83c1380c9a (diff)
downloadexternal_python_setuptools-70e95ee66a17e1655f70c9dbda107cea958f583f.tar.gz
external_python_setuptools-70e95ee66a17e1655f70c9dbda107cea958f583f.tar.bz2
external_python_setuptools-70e95ee66a17e1655f70c9dbda107cea958f583f.zip
When copying package data, make sure it's writable, but otherwise preserve the mode. Fixes #2041.
-rw-r--r--setuptools/command/build_py.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/setuptools/command/build_py.py b/setuptools/command/build_py.py
index bac4fb1c..9d0288a5 100644
--- a/setuptools/command/build_py.py
+++ b/setuptools/command/build_py.py
@@ -7,6 +7,7 @@ import textwrap
import io
import distutils.errors
import itertools
+import stat
from setuptools.extern import six
from setuptools.extern.six.moves import map, filter, filterfalse
@@ -20,6 +21,10 @@ except ImportError:
"do nothing"
+def make_writable(target):
+ os.chmod(target, os.stat(target).st_mode | stat.S_IWRITE)
+
+
class build_py(orig.build_py, Mixin2to3):
"""Enhanced 'build_py' command that includes data files with packages
@@ -120,8 +125,8 @@ class build_py(orig.build_py, Mixin2to3):
target = os.path.join(build_dir, filename)
self.mkpath(os.path.dirname(target))
srcfile = os.path.join(src_dir, filename)
- outf, copied = self.copy_file(
- srcfile, target, preserve_mode=False)
+ outf, copied = self.copy_file(srcfile, target)
+ make_writable(target)
srcfile = os.path.abspath(srcfile)
if (copied and
srcfile in self.distribution.convert_2to3_doctests):