|
- #!/usr/bin/python
-
- # This is supposed to be using Distribute:
- #
- # distutils provides a "setup" method.
- # setuptools is a set of monkeypatches on top of that.
- # distribute is a particular version/implementation of setuptools.
- #
- # So we don't really know if this is using the old setuptools or the
- # Distribute-provided version of setuptools.
-
- import traceback
- import sys
-
- try:
- from setuptools import setup, find_packages
- from distutils.extension import Extension
- from Cython.Build import cythonize
- except ImportError:
- traceback.print_exc()
- print "Please install the prerequisites listed in README.txt"
- sys.exit(1)
-
- # Hack to workaround logging/multiprocessing issue:
- # https://groups.google.com/d/msg/nose-users/fnJ-kAUbYHQ/_UsLN786ygcJ
- try: import multiprocessing
- except: pass
-
- if len(sys.argv) == 2 and sys.argv[1] == 'sdist':
- # When building just a source distribution package, skip Cython,
- # so that the generated .c files don't get included. This isn't
- # foolproof, but the worst case is that the .c files get included,
- # which is fine.
- cython_modules = []
- else:
- # Build cython modules.
- cython_modules = cythonize("**/*.pyx")
-
- # We need a MANIFEST.in. Generate it here rather than polluting the
- # repository with yet another setup-related file.
- with open("MANIFEST.in", "w") as m:
- m.write("""
- # Root
- include README.txt
- include setup.cfg
- include setup.py
- include Makefile
- include .coveragerc
- include .pylintrc
-
- # Cython files -- include source.
- recursive-include nilmdb/server *.pyx *.pyxdep *.pxd
-
- # Tests
- recursive-include tests *.py
- recursive-include tests/data *
- include tests/test.order
-
- # Docs
- recursive-include docs Makefile *.md
- """)
-
- # Run setup
- setup(name='nilmdb',
- version = '1.0',
- url = 'https://git.jim.sh/jim/lees/nilmdb.git',
- author = 'Jim Paris',
- description = "NILM Database",
- long_description = "NILM Database",
- license = "Proprietary",
- author_email = 'jim@jtan.com',
- tests_require = [ 'nose',
- 'coverage',
- ],
- setup_requires = [ 'cython',
- ],
- install_requires = [ 'distribute',
- 'decorator',
- 'cherrypy >= 3.2',
- ],
- packages = [ 'nilmdb',
- 'nilmdb.utils',
- 'nilmdb.utils.datetime_tz',
- 'nilmdb.server',
- 'nilmdb.client',
- 'nilmdb.cmdline',
- 'nilmdb.scripts',
- ],
- entry_points = {
- 'console_scripts': [
- 'nilmtool = nilmdb.scripts.nilmtool:main',
- 'nilmdb-server = nilmdb.scripts.nilmdb_server:main',
- ],
- },
- ext_modules = cython_modules,
- zip_safe = False,
- )
|