summary refs log tree commit diff stats
path: root/setup.py
diff options
context:
space:
mode:
authornfnty <git@nfnty.se>2017-02-09 15:01:44 +0100
committernfnty <git@nfnty.se>2017-02-09 15:13:47 +0100
commit31277e06fb83c3ceedd0613f881e79e78a38e7e5 (patch)
tree978c26b8115df5b5bbb8c651292c4f964a0e4fc2 /setup.py
parentfe5f90d39a07f1c40ee1f4e3df16b20a2b45000a (diff)
downloadranger-31277e06fb83c3ceedd0613f881e79e78a38e7e5.tar.gz
setup.py: Generate scripts during build
Fixes #799
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/setup.py b/setup.py
index 16ab88c7..56ace9ce 100755
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,8 @@
 from __future__ import (absolute_import, division, print_function)
 
 import distutils.core  # pylint: disable=import-error,no-name-in-module
-import os.path
+import os
+import shutil
 
 import ranger
 
@@ -15,6 +16,14 @@ def _findall(directory):
             if os.path.isfile(os.path.join(directory, f))]
 
 
+def _script(src_path, name):
+    if not os.path.exists('build/scripts'):
+        os.makedirs('build/scripts')
+    dest_path = os.path.join('build/scripts', name)
+    shutil.copy(src_path, dest_path)
+    return dest_path
+
+
 if __name__ == '__main__':
     distutils.core.setup(  # pylint: disable=no-member
         name='ranger',
@@ -25,7 +34,10 @@ if __name__ == '__main__':
         author_email=ranger.__email__,
         license=ranger.__license__,
         url='http://ranger.nongnu.org',
-        scripts=['scripts/ranger', 'scripts/rifle'],
+        scripts=[
+            _script('ranger.py', 'ranger'),
+            _script('ranger/ext/rifle.py', 'rifle'),
+        ],
         data_files=[
             ('share/applications', [
                 'doc/ranger.desktop',