Commits

Jason R. Coombs  committed 281c6b9 Merge

Merged in justinazoff/distribute (pull request #6)

  • Participants
  • Parent commits 770a5b5, 916bda1

Comments (0)

Files changed (2)

File setuptools/command/easy_install.py

 __ http://packages.python.org/distribute/easy_install.html
 
 """
-import sys, os.path, zipimport, shutil, tempfile, zipfile, re, stat, random
+import sys, os, os.path, zipimport, shutil, tempfile, zipfile, re, stat, random
 from glob import glob
 from setuptools import Command, _dont_write_bytecode
 from setuptools.sandbox import run_setup
         target = os.path.join(self.script_dir, script_name)
         self.add_output(target)
 
+        mask = current_umask()
         if not self.dry_run:
             ensure_directory(target)
             f = open(target,"w"+mode)
             f.write(contents)
             f.close()
-            chmod(target,0755)
+            chmod(target, 0777-mask)
 
 
 
     except os.error:
         onerror(os.rmdir, path, sys.exc_info())
 
+def current_umask():
+    tmp = os.umask(022)
+    os.umask(tmp)
+    return tmp
+
 def bootstrap():
     # This function is called when setuptools*.egg is run using /bin/sh
     import setuptools; argv0 = os.path.dirname(setuptools.__path__[0])

File setuptools/command/install_scripts.py

 
     def write_script(self, script_name, contents, mode="t", *ignored):
         """Write an executable file to the scripts directory"""
-        from setuptools.command.easy_install import chmod
+        from setuptools.command.easy_install import chmod, current_umask
         log.info("Installing %s script to %s", script_name, self.install_dir)
         target = os.path.join(self.install_dir, script_name)
         self.outfiles.append(target)
 
+        mask = current_umask()
         if not self.dry_run:
             ensure_directory(target)
             f = open(target,"w"+mode)
             f.write(contents)
             f.close()
-            chmod(target,0755)
+            chmod(target, 0777-mask)