PageRenderTime 52ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/setup.py

https://bitbucket.org/marcelm/exomate
Python | 69 lines | 60 code | 6 blank | 3 comment | 3 complexity | b573239b9ac930f18c28281445dcdc6d MD5 | raw file
  1. from distutils.core import setup, Extension, Command
  2. import sys
  3. import textwrap
  4. import subprocess
  5. from glob import glob
  6. import os
  7. __version__ = '0.1'
  8. if sys.version < '3.2':
  9. sys.stdout.write("At least Python 3.2 is required (try running with 'python3 setup.py').\n")
  10. sys.exit(1)
  11. class InstallServer(Command):
  12. description = "Install the Exomate server into the given directory"
  13. user_options = [("prefix=", None, "The prefix to install to.")]
  14. def initialize_options(self):
  15. """Use this to set option defaults before parsing."""
  16. self.prefix = None
  17. def finalize_options(self):
  18. """Code to validate/modify command-line/config input goes here."""
  19. if self.prefix is None:
  20. raise DistutilsOptionError('"prefix" is required')
  21. if not os.path.exists(self.prefix):
  22. raise DistutilsOptionError('"prefix" has to be a valid path')
  23. def run(self):
  24. """Your actual command functionality goes here."""
  25. subprocess.check_call(textwrap.dedent("""
  26. rsync -vrlD --exclude '*.pyc' \\
  27. --exclude '*~' \\
  28. --exclude '*.cfg' \\
  29. --exclude '__pycache__' \\
  30. ./exomate/ {prefix}/exomate/
  31. rsync -p \\
  32. ./run_tornado.py {prefix}/
  33. echo "git_revision='$(date +"%Y-%m-%d") $(git rev-parse --short HEAD)'" >> {prefix}/exomate/__init__.py
  34. chmod -R o+r {prefix}
  35. """.format(prefix=self.prefix)), shell=True)
  36. setup(
  37. name = 'exomate',
  38. version = __version__,
  39. author = 'Marcel Martin',
  40. author_email = 'marcel.martin@tu-dortmund.de',
  41. url = '',
  42. description = '',
  43. license = 'MIT',
  44. cmdclass={"install_server": InstallServer},
  45. packages = ['exomate', 'exomate.scripts'],
  46. scripts = [ s for s in glob(os.path.join("bin", "exomate-*")) if not s.endswith('~') ],
  47. install_requires = [
  48. "SQLalchemy >= 0.8.0b2",
  49. "Flask-SQLAlchemy"
  50. ],
  51. classifiers = [
  52. "Development Status :: 4 - Beta",
  53. #"Development Status :: 5 - Production/Stable",
  54. "Environment :: Console",
  55. "Intended Audience :: Science/Research",
  56. "License :: OSI Approved :: MIT License",
  57. "Natural Language :: English",
  58. "Programming Language :: Python :: 3",
  59. "Topic :: Scientific/Engineering :: Bio-Informatics"
  60. ]
  61. )