Commit 3f2a4d40 authored by Reinout van Rees's avatar Reinout van Rees

Using distribute's way of chmod +x.

os.umask is a bit weird in that it *does* return the current umask,
but it has a required argument that it immediately sets as the new umask...
Weird. Distribute solves that by assigning a dummy value and re-setting
the umask to the original value.

The matching test verifies that it actually works.

Note that I use python 2.6+'s octal notation: 0o755.
Buildout 2 doesn't support python 2.5 anymore, iirc, so that's fine.
parent 27f1cc7a
...@@ -119,7 +119,12 @@ def call_subprocess(args, **kw): ...@@ -119,7 +119,12 @@ def call_subprocess(args, **kw):
def _execute_permission(): def _execute_permission():
return 493 # 0755, -rwxr-xr-x current_umask = os.umask(0o022)
# os.umask only returns the current umask if you also give it one, so we
# have to give it a dummy one and immediately set it back to the real
# value... Distribute does the same.
os.umask(current_umask)
return 0o777 - current_umask
_easy_install_cmd = 'from setuptools.command.easy_install import main; main()' _easy_install_cmd = 'from setuptools.command.easy_install import main; main()'
......
...@@ -705,6 +705,16 @@ The scripts that are generated are made executable: ...@@ -705,6 +705,16 @@ The scripts that are generated are made executable:
... os.access(os.path.join(bin, 'run'), os.X_OK) ... os.access(os.path.join(bin, 'run'), os.X_OK)
True True
For setting the executable permission, the user's umask is honored:
>>> orig_umask = os.umask(0o077) # Only user gets permissions.
>>> zc.buildout.easy_install._execute_permission() == 0o700
True
>>> tmp = os.umask(0o022) # User can write, the rest not.
>>> zc.buildout.easy_install._execute_permission() == 0o755
True
>>> tmp = os.umask(orig_umask) # Reset umask to the original value.
Including extra paths in scripts Including extra paths in scripts
-------------------------------- --------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment