summary refs log tree commit diff stats
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
parentfe5f90d39a07f1c40ee1f4e3df16b20a2b45000a (diff)
downloadranger-31277e06fb83c3ceedd0613f881e79e78a38e7e5.tar.gz
setup.py: Generate scripts during build
Fixes #799
l---------scripts/ranger1
l---------scripts/rifle1
-rwxr-xr-xsetup.py16
3 files changed, 14 insertions, 4 deletions
diff --git a/scripts/ranger b/scripts/ranger
deleted file mode 120000
index 21b7d3ee..00000000
--- a/scripts/ranger
+++ /dev/null
@@ -1 +0,0 @@
-../ranger.py
\ No newline at end of file
diff --git a/scripts/rifle b/scripts/rifle
deleted file mode 120000
index 1dbaa2d8..00000000
--- a/scripts/rifle
+++ /dev/null
@@ -1 +0,0 @@
-../ranger/ext/rifle.py
\ No newline at end of file
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',