diff setup.py @ 4963:cdfb1a3fb56f

Fix setup.py to allow "development mode" (issue2550866) The setup.py script would fail with missing file errors when attempting to install roundup using "development mode" (eg. pip install -e roundup/). Thanks to tonich for the initial patch to fix the issue using console_scripts
author John Kristensen <john@jerrykan.com>
date Tue, 10 Feb 2015 14:08:01 +1100
parents 16cb37d93ec6
children a4d7e495f2f6
line wrap: on
line diff
--- a/setup.py	Sat Jan 17 21:06:04 2015 +0300
+++ b/setup.py	Tue Feb 10 14:08:01 2015 +1100
@@ -52,13 +52,15 @@
 
     return (d, [f for f in glob('%s/%s'%(d, e)) if os.path.isfile(f)])
 
-def scriptname(path):
+
+def mapscript(path):
     """ Helper for building a list of script names from a list of
         module files.
     """
-    script = os.path.splitext(os.path.basename(path))[0]
-    script = script.replace('_', '-')
-    return script
+    module = os.path.splitext(os.path.basename(path))[0]
+    script = module.replace('_', '-')
+    return '%s = roundup.scripts.%s:run' % (script, module)
+
 
 def main():
     # template munching
@@ -74,7 +76,7 @@
     ]
 
     # build list of scripts from their implementation modules
-    scripts = [scriptname(f) for f in glob('roundup/scripts/[!_]*.py')]
+    scripts = [mapscript(f) for f in glob('roundup/scripts/[!_]*.py')]
 
     data_files = [
         ('share/roundup/cgi-bin', ['frontends/roundup.cgi']),
@@ -155,7 +157,9 @@
                      'install_lib': install_lib,
                      },
           packages=packages,
-          scripts=scripts,
+          entry_points={
+              'console_scripts': scripts
+          },
           data_files=data_files)
 
 if __name__ == '__main__':

Roundup Issue Tracker: http://roundup-tracker.org/