diff options
author | Simon Warta <[email protected]> | 2017-07-30 16:59:06 +0200 |
---|---|---|
committer | Simon Warta <[email protected]> | 2017-07-30 17:16:56 +0200 |
commit | 7d2d2732d47f2ed9d1b12d265df311cc9904b59f (patch) | |
tree | bf5a90cde69ceb3c3e0fa74c08efb5f64b3619e4 /src/scripts | |
parent | 8f471a00051522c4ca92387aa84dd61e613cf20c (diff) |
install.py: pull out calculate_exec_mode
Diffstat (limited to 'src/scripts')
-rwxr-xr-x | src/scripts/install.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/scripts/install.py b/src/scripts/install.py index f58b171e9..45678d0a7 100755 --- a/src/scripts/install.py +++ b/src/scripts/install.py @@ -80,6 +80,15 @@ def force_symlink(target, linkname): raise e os.symlink(target, linkname) +def calculate_exec_mode(options): + out = 0o777 + if 'umask' in os.__dict__: + umask = int(options.umask, 8) + logging.debug('Setting umask to %s' % oct(umask)) + os.umask(int(options.umask, 8)) + out &= (umask ^ 0o777) + return out + def main(args=None): if args is None: args = sys.argv @@ -89,13 +98,7 @@ def main(args=None): (options, args) = parse_command_line(args) - exe_mode = 0o777 - - if 'umask' in os.__dict__: - umask = int(options.umask, 8) - logging.debug('Setting umask to %s' % oct(umask)) - os.umask(int(options.umask, 8)) - exe_mode &= (umask ^ 0o777) + exe_mode = calculate_exec_mode(options) def copy_file(src, dst): logging.debug('Copying %s to %s' % (src, dst)) |