Commit 7935149c authored by Reinout van Rees's avatar Reinout van Rees

Refactored execute permission into one spot.

A fixed (0755) execute permission is used in two places, I refactored it into
one method. Bonus: this makes it easy to test the fix proposed in
https://github.com/buildout/buildout/pull/18
parent ef7d2ad3
...@@ -117,6 +117,11 @@ def call_subprocess(args, **kw): ...@@ -117,6 +117,11 @@ def call_subprocess(args, **kw):
"Failed to run command:\n%s" "Failed to run command:\n%s"
% repr(args)[1:-1]) % repr(args)[1:-1])
def _execute_permission():
return 493 # 0755, -rwxr-xr-x
_easy_install_cmd = 'from setuptools.command.easy_install import main; main()' _easy_install_cmd = 'from setuptools.command.easy_install import main; main()'
class Installer: class Installer:
...@@ -1099,7 +1104,7 @@ def _create_script(contents, dest): ...@@ -1099,7 +1104,7 @@ def _create_script(contents, dest):
script.endswith('-script.py') and script[:-10] or script) script.endswith('-script.py') and script[:-10] or script)
try: try:
os.chmod(dest, 493) # 0755 os.chmod(dest, _execute_permission())
except (AttributeError, os.error): except (AttributeError, os.error):
pass pass
...@@ -1167,7 +1172,7 @@ def _pyscript(path, dest, rsetup, initialization=''): ...@@ -1167,7 +1172,7 @@ def _pyscript(path, dest, rsetup, initialization=''):
if changed: if changed:
open(dest, 'w').write(contents) open(dest, 'w').write(contents)
try: try:
os.chmod(dest, 493) # 0755 os.chmod(dest, _execute_permission())
except (AttributeError, os.error): except (AttributeError, os.error):
pass pass
logger.info("Generated interpreter %r.", script) logger.info("Generated interpreter %r.", script)
......
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