Mercurial > p > roundup > code
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 4962:63c31b18b955 | 4963:cdfb1a3fb56f |
|---|---|
| 50 | 50 |
| 51 'e' -- A glob pattern""" | 51 'e' -- A glob pattern""" |
| 52 | 52 |
| 53 return (d, [f for f in glob('%s/%s'%(d, e)) if os.path.isfile(f)]) | 53 return (d, [f for f in glob('%s/%s'%(d, e)) if os.path.isfile(f)]) |
| 54 | 54 |
| 55 def scriptname(path): | 55 |
| 56 def mapscript(path): | |
| 56 """ Helper for building a list of script names from a list of | 57 """ Helper for building a list of script names from a list of |
| 57 module files. | 58 module files. |
| 58 """ | 59 """ |
| 59 script = os.path.splitext(os.path.basename(path))[0] | 60 module = os.path.splitext(os.path.basename(path))[0] |
| 60 script = script.replace('_', '-') | 61 script = module.replace('_', '-') |
| 61 return script | 62 return '%s = roundup.scripts.%s:run' % (script, module) |
| 63 | |
| 62 | 64 |
| 63 def main(): | 65 def main(): |
| 64 # template munching | 66 # template munching |
| 65 packages = [ | 67 packages = [ |
| 66 'roundup', | 68 'roundup', |
| 72 'roundup.backends', | 74 'roundup.backends', |
| 73 'roundup.scripts', | 75 'roundup.scripts', |
| 74 ] | 76 ] |
| 75 | 77 |
| 76 # build list of scripts from their implementation modules | 78 # build list of scripts from their implementation modules |
| 77 scripts = [scriptname(f) for f in glob('roundup/scripts/[!_]*.py')] | 79 scripts = [mapscript(f) for f in glob('roundup/scripts/[!_]*.py')] |
| 78 | 80 |
| 79 data_files = [ | 81 data_files = [ |
| 80 ('share/roundup/cgi-bin', ['frontends/roundup.cgi']), | 82 ('share/roundup/cgi-bin', ['frontends/roundup.cgi']), |
| 81 ] | 83 ] |
| 82 # install man pages on POSIX platforms | 84 # install man pages on POSIX platforms |
| 153 'build': build, | 155 'build': build, |
| 154 'bdist_rpm': bdist_rpm, | 156 'bdist_rpm': bdist_rpm, |
| 155 'install_lib': install_lib, | 157 'install_lib': install_lib, |
| 156 }, | 158 }, |
| 157 packages=packages, | 159 packages=packages, |
| 158 scripts=scripts, | 160 entry_points={ |
| 161 'console_scripts': scripts | |
| 162 }, | |
| 159 data_files=data_files) | 163 data_files=data_files) |
| 160 | 164 |
| 161 if __name__ == '__main__': | 165 if __name__ == '__main__': |
| 162 os.chdir(os.path.dirname(__file__) or '.') | 166 os.chdir(os.path.dirname(__file__) or '.') |
| 163 main() | 167 main() |
