diff options
author | nfnty <git@nfnty.se> | 2017-04-12 03:12:42 +0200 |
---|---|---|
committer | nfnty <git@nfnty.se> | 2017-04-12 03:20:21 +0200 |
commit | 20f0f2ba96a4a9dcbb8beffbee957b42157d4efd (patch) | |
tree | 93e6df2696d6f6bb173949ec9062e070a29b8621 /setup.py | |
parent | 51e86c62d0e3e7caf5d839219796ae2043646515 (diff) | |
download | ranger-20f0f2ba96a4a9dcbb8beffbee957b42157d4efd.tar.gz |
setup.py: Make executables executable
Diffstat (limited to 'setup.py')
-rwxr-xr-x | setup.py | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/setup.py b/setup.py index 03188c94..8d762013 100755 --- a/setup.py +++ b/setup.py @@ -4,19 +4,26 @@ from __future__ import (absolute_import, division, print_function) +from distutils import log # pylint: disable=import-error,no-name-in-module from hashlib import sha512 import os import shutil import ranger + +SCRIPTS_PATH = 'build_scripts' +EXECUTABLES_PATHS = ['/ranger/data/scope.sh'] + + +# pylint: disable=import-error,no-name-in-module,ungrouped-imports if os.environ.get('SETUPTOOLS_USE'): from setuptools import setup + from setuptools.command.install_lib import install_lib else: - from distutils.core import setup # pylint: disable=import-error,no-name-in-module - - -SCRIPTS_PATH = 'build_scripts' + from distutils.core import setup + from distutils.command.install_lib import install_lib +# pylint: enable=import-error,no-name-in-module,ungrouped-imports def findall(directory): @@ -43,6 +50,19 @@ def scripts_hack(*scripts): return scripts_path +class InstallLib(install_lib): + def run(self): + install_lib.run(self) + + # Make executables executable + for path in self.get_outputs(): + for exe_path in EXECUTABLES_PATHS: + if path.endswith(exe_path): + mode = ((os.stat(path).st_mode) | 0o555) & 0o7777 + log.info('changing mode of %s to %o', path, mode) + os.chmod(path, mode) + + def main(): setup( name='ranger-fm', @@ -76,6 +96,8 @@ def main(): 'Topic :: Utilities', ], + cmdclass={'install_lib': InstallLib}, + scripts=scripts_hack( ('ranger.py', 'ranger'), ('ranger/ext/rifle.py', 'rifle'), |