Mercurial > p > roundup > code
comparison setup.py @ 6378:b57c3d50505b
issue2550899 Migrate setup.py to setuptools
Also fixes issue2550866 'pip install --editable .' fails
Installing roundup requires setuptools package which is available in
most OS distrobutions or via pip. Patch by John
Kristensen (jerrykan); additional doc changes (upgrade.txt,
RELEASE.txt) John Rouillard.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sat, 17 Apr 2021 16:41:23 -0400 |
| parents | 4e48a6a40bfe |
| children | b671ed2b49b2 |
comparison
equal
deleted
inserted
replaced
| 6377:a7e7314fb7d9 | 6378:b57c3d50505b |
|---|---|
| 19 # | 19 # |
| 20 | 20 |
| 21 | 21 |
| 22 from __future__ import print_function | 22 from __future__ import print_function |
| 23 from roundup.dist.command.build_doc import build_doc | 23 from roundup.dist.command.build_doc import build_doc |
| 24 from roundup.dist.command.build_scripts import build_scripts | |
| 25 from roundup.dist.command.build import build, list_message_files | 24 from roundup.dist.command.build import build, list_message_files |
| 26 from roundup.dist.command.bdist_rpm import bdist_rpm | 25 from roundup.dist.command.bdist_rpm import bdist_rpm |
| 27 from roundup.dist.command.install_lib import install_lib | 26 from roundup.dist.command.install_lib import install_lib |
| 28 | 27 |
| 29 # FIXME: setuptools breaks the --manifest-only option to setup.py and | 28 from setuptools import setup |
| 30 # doesn't seem to generate a MANIFEST file. Since I'm not familiar with | |
| 31 # the way setuptools handles the files to include I'm commenting this | |
| 32 # for now -- Ralf Schlatterbeck | |
| 33 #try: | |
| 34 # from setuptools import setup | |
| 35 #except ImportError: | |
| 36 from distutils.core import setup | |
| 37 | 29 |
| 38 import sys, os | 30 import sys, os |
| 39 from glob import glob | 31 from glob import glob |
| 40 | 32 |
| 41 | 33 |
| 46 | 38 |
| 47 'e' -- A glob pattern""" | 39 'e' -- A glob pattern""" |
| 48 | 40 |
| 49 return (d, [f for f in glob('%s/%s'%(d, e)) if os.path.isfile(f)]) | 41 return (d, [f for f in glob('%s/%s'%(d, e)) if os.path.isfile(f)]) |
| 50 | 42 |
| 51 def scriptname(path): | 43 |
| 44 def mapscript(path): | |
| 52 """ Helper for building a list of script names from a list of | 45 """ Helper for building a list of script names from a list of |
| 53 module files. | 46 module files. |
| 54 """ | 47 """ |
| 55 script = os.path.splitext(os.path.basename(path))[0] | 48 module = os.path.splitext(os.path.basename(path))[0] |
| 56 script = script.replace('_', '-') | 49 script = module.replace('_', '-') |
| 57 return script | 50 return '%s = roundup.scripts.%s:run' % (script, module) |
| 51 | |
| 58 | 52 |
| 59 def main(): | 53 def main(): |
| 60 # template munching | 54 # template munching |
| 61 packages = [ | 55 packages = [ |
| 62 'roundup', | 56 'roundup', |
| 69 'roundup.scripts', | 63 'roundup.scripts', |
| 70 'roundup.test', | 64 'roundup.test', |
| 71 ] | 65 ] |
| 72 | 66 |
| 73 # build list of scripts from their implementation modules | 67 # build list of scripts from their implementation modules |
| 74 scripts = [scriptname(f) for f in glob('roundup/scripts/[!_]*.py')] | 68 scripts = [mapscript(f) for f in glob('roundup/scripts/[!_]*.py')] |
| 75 | 69 |
| 76 data_files = [ | 70 data_files = [ |
| 77 ('share/roundup/cgi-bin', ['frontends/roundup.cgi']), | 71 ('share/roundup/cgi-bin', ['frontends/roundup.cgi']), |
| 78 ] | 72 ] |
| 79 # install man pages on POSIX platforms | 73 # install man pages on POSIX platforms |
| 159 'Topic :: Internet :: WWW/HTTP :: WSGI :: Application', | 153 'Topic :: Internet :: WWW/HTTP :: WSGI :: Application', |
| 160 ], | 154 ], |
| 161 | 155 |
| 162 # Override certain command classes with our own ones | 156 # Override certain command classes with our own ones |
| 163 cmdclass= {'build_doc': build_doc, | 157 cmdclass= {'build_doc': build_doc, |
| 164 'build_scripts': build_scripts, | |
| 165 'build': build, | 158 'build': build, |
| 166 'bdist_rpm': bdist_rpm, | 159 'bdist_rpm': bdist_rpm, |
| 167 'install_lib': install_lib, | 160 'install_lib': install_lib, |
| 168 }, | 161 }, |
| 169 packages=packages, | 162 packages=packages, |
| 170 scripts=scripts, | 163 entry_points={ |
| 164 'console_scripts': scripts | |
| 165 }, | |
| 171 data_files=data_files) | 166 data_files=data_files) |
| 172 | 167 |
| 173 if __name__ == '__main__': | 168 if __name__ == '__main__': |
| 174 os.chdir(os.path.dirname(__file__) or '.') | 169 os.chdir(os.path.dirname(__file__) or '.') |
| 175 main() | 170 main() |
