summaryrefslogtreecommitdiff
path: root/setuptools/command/easy_install.py
diff options
context:
space:
mode:
authorJustin Azoff <justin@bouncybouncy.net>2012-05-12 19:01:44 -0400
committerJustin Azoff <justin@bouncybouncy.net>2012-05-12 19:01:44 -0400
commita4b57a24719fbfdf3ed8f74a1ef65d940d0dca20 (patch)
treeb30ffbc3ae0188e283a8078913687842f7e34e92 /setuptools/command/easy_install.py
parenta5cb5317fa6c37c2e6fedc04ba1e008c6d629994 (diff)
downloadpython-setuptools-bitbucket-a4b57a24719fbfdf3ed8f74a1ef65d940d0dca20.tar.gz
When writing out scripts, respect the users umask
Diffstat (limited to 'setuptools/command/easy_install.py')
-rwxr-xr-xsetuptools/command/easy_install.py10
1 files changed, 8 insertions, 2 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])