Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bcb0e20

Browse files
committed
Change the mode of scripts in the build/scripts* directory to
executable.
1 parent c971387 commit bcb0e20

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

Lib/distutils/command/build_scripts.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
__revision__ = "$Id$"
88

99
import sys, os, re
10+
from stat import ST_MODE
1011
from distutils import sysconfig
1112
from distutils.core import Command
1213
from distutils.dep_util import newer
@@ -54,10 +55,12 @@ def copy_scripts (self):
5455
line to refer to the current Python interpreter as we copy.
5556
"""
5657
self.mkpath(self.build_dir)
58+
outfiles = []
5759
for script in self.scripts:
5860
adjust = 0
5961
script = convert_path(script)
6062
outfile = os.path.join(self.build_dir, os.path.basename(script))
63+
outfiles.append(outfile)
6164

6265
if not self.force and not newer(script, outfile):
6366
log.debug("not copying %s (up-to-date)", script)
@@ -106,6 +109,15 @@ def copy_scripts (self):
106109
f.close()
107110
self.copy_file(script, outfile)
108111

112+
if os.name == 'posix':
113+
for file in outfiles:
114+
if self.dry_run:
115+
log.info("changing mode of %s", file)
116+
else:
117+
mode = ((os.stat(file)[ST_MODE]) | 0555) & 07777
118+
log.info("changing mode of %s to %o", file, mode)
119+
os.chmod(file, mode)
120+
109121
# copy_scripts ()
110122

111123
# class build_scripts

0 commit comments

Comments
 (0)