[Python-checkins] python/dist/src/Lib/distutils/command build_scripts.py,1.18,1.19

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Fri, 24 Jan 2003 06:56:57 -0800


Update of /cvsroot/python/python/dist/src/Lib/distutils/command
In directory sc8-pr-cvs1:/tmp/cvs-serv28741

Modified Files:
	build_scripts.py 
Log Message:
Change the mode of scripts in the build/scripts* directory to
executable.


Index: build_scripts.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/distutils/command/build_scripts.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** build_scripts.py	19 Nov 2002 13:12:28 -0000	1.18
--- build_scripts.py	24 Jan 2003 14:56:52 -0000	1.19
***************
*** 8,11 ****
--- 8,12 ----
  
  import sys, os, re
+ from stat import ST_MODE
  from distutils import sysconfig
  from distutils.core import Command
***************
*** 55,62 ****
--- 56,65 ----
          """
          self.mkpath(self.build_dir)
+         outfiles = []
          for script in self.scripts:
              adjust = 0
              script = convert_path(script)
              outfile = os.path.join(self.build_dir, os.path.basename(script))
+             outfiles.append(outfile)
  
              if not self.force and not newer(script, outfile):
***************
*** 106,109 ****
--- 109,121 ----
                  f.close()
                  self.copy_file(script, outfile)
+ 
+         if os.name == 'posix':
+             for file in outfiles:
+                 if self.dry_run:
+                     log.info("changing mode of %s", file)
+                 else:
+                     mode = ((os.stat(file)[ST_MODE]) | 0555) & 07777
+                     log.info("changing mode of %s to %o", file, mode)
+                     os.chmod(file, mode)
  
      # copy_scripts ()