setup.py 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/usr/bin/env python3
  2. import os, re
  3. from distutils.core import setup
  4. import setup_cython
  5. def getEnvInt(name, default=0):
  6. try:
  7. return int(os.getenv(name, "%d" % default))
  8. except ValueError:
  9. return default
  10. def getEnvBool(name, default=False):
  11. return bool(getEnvInt(name, 1 if default else 0))
  12. def pyCythonPatchLine(line):
  13. # Patch the import statements
  14. line = re.sub(r'^(\s*from cms)(\.[0-9a-zA-Z_\.]+)? (c?import)', r'\1_cython\2 \3', line)
  15. line = re.sub(r'^(\s*c?import cms)(\.)?', r'\1_cython\2', line)
  16. return line
  17. buildCython = getEnvBool("CMS_CYTHON_BUILD", True)
  18. setup_cython.parallelBuild = getEnvBool("CMS_CYTHON_PARALLEL", True)
  19. setup_cython.profileEnabled = getEnvBool("CMS_PROFILE")
  20. setup_cython.debugEnabled = getEnvBool("CMS_DEBUG_BUILD")
  21. setup_cython.pyCythonPatchLine = pyCythonPatchLine
  22. cmdclass = {}
  23. if buildCython:
  24. buildCython = setup_cython.cythonBuildPossible()
  25. if buildCython:
  26. cmdclass["build_ext"] = setup_cython.CythonBuildExtension
  27. setup_cython.registerCythonModules()
  28. else:
  29. print("Skipping build of CYTHON modules.")
  30. ext_modules = setup_cython.ext_modules
  31. setup( name = "cms",
  32. version = "0.0",
  33. description = "simple WSGI/Python based CMS script",
  34. license = "GNU General Public License v2 or later",
  35. author = "Michael Buesch",
  36. author_email = "m@bues.ch",
  37. url = "https://bues.ch",
  38. packages = [ "cms", ],
  39. scripts = [ "index.wsgi", "cms-cli", ],
  40. cmdclass = cmdclass,
  41. ext_modules = ext_modules,
  42. keywords = "CMS WSGI Apache httpd",
  43. classifiers = [
  44. "Development Status :: 5 - Production/Stable",
  45. "Environment :: Console",
  46. "Intended Audience :: Developers",
  47. "Intended Audience :: Other Audience",
  48. "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)",
  49. "Operating System :: POSIX",
  50. "Operating System :: POSIX :: Linux",
  51. "Programming Language :: Cython",
  52. "Programming Language :: Python",
  53. "Programming Language :: Python :: 3",
  54. "Programming Language :: Python :: Implementation :: CPython",
  55. "Topic :: Database",
  56. "Topic :: Database :: Database Engines/Servers",
  57. "Topic :: Database :: Front-Ends",
  58. "Topic :: Internet",
  59. "Topic :: Internet :: WWW/HTTP",
  60. "Topic :: Internet :: WWW/HTTP :: Browsers",
  61. "Topic :: Internet :: WWW/HTTP :: Dynamic Content",
  62. "Topic :: Internet :: WWW/HTTP :: Site Management",
  63. "Topic :: Internet :: WWW/HTTP :: WSGI",
  64. "Topic :: Text Processing",
  65. "Topic :: Text Processing :: Markup :: HTML",
  66. ],
  67. long_description = "simple WSGI/Python based CMS script"
  68. )