diff options
author | Justin Azoff <justin@bouncybouncy.net> | 2012-05-12 19:01:44 -0400 |
---|---|---|
committer | Justin Azoff <justin@bouncybouncy.net> | 2012-05-12 19:01:44 -0400 |
commit | 8dde28ee529c74d578e8142dfbb0a537a8bf0414 (patch) | |
tree | 7bf8e8f3de9f31acd5954306b83b6cfafd8b0585 /setuptools/command | |
parent | 5be712ee48b86f32284e72c3b862002fd3dedd85 (diff) | |
download | external_python_setuptools-8dde28ee529c74d578e8142dfbb0a537a8bf0414.tar.gz external_python_setuptools-8dde28ee529c74d578e8142dfbb0a537a8bf0414.tar.bz2 external_python_setuptools-8dde28ee529c74d578e8142dfbb0a537a8bf0414.zip |
When writing out scripts, respect the users umask
--HG--
branch : distribute
extra : rebase_source : d4fc14bcdcd3e1a45da8bdcdef490537863ece35
Diffstat (limited to 'setuptools/command')
-rwxr-xr-x | setuptools/command/easy_install.py | 10 | ||||
-rwxr-xr-x | setuptools/command/install_scripts.py | 5 |
2 files changed, 11 insertions, 4 deletions
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index dfd9f7ff..49a2c41e 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -10,7 +10,7 @@ file, or visit the `EasyInstall home page`__. __ 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 @@ -762,12 +762,13 @@ Please make the appropriate changes for your system and try again. 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) @@ -1870,6 +1871,11 @@ def rmtree(path, ignore_errors=False, onerror=auto_chmod): 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]) diff --git a/setuptools/command/install_scripts.py b/setuptools/command/install_scripts.py index 6ce1b993..82456035 100755 --- a/setuptools/command/install_scripts.py +++ b/setuptools/command/install_scripts.py @@ -39,15 +39,16 @@ class install_scripts(_install_scripts): 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) |