Created
July 16, 2016 03:01
-
-
Save adiroiban/5b461f3ca96828a3036c99964d1d236e to your computer and use it in GitHub Desktop.
coverage friendly setup.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Copyright (c) Twisted Matrix Laboratories. | |
# See LICENSE for details. | |
""" | |
Setuptools installer for Twisted. | |
""" | |
import os | |
import sys | |
import setuptools | |
# Tell Twisted not to enforce zope.interface requirement on import, since | |
# we're going to have to import twisted.python.dist and can rely on | |
# setuptools to install dependencies. | |
setuptools._TWISTED_NO_CHECK_REQUIREMENTS = True | |
def get_setup_arguments(): | |
# On Python 3, use setup3.py until Python 3 port is done: | |
if sys.version_info[0] > 2: | |
import setup3 | |
setup3.main() | |
return | |
if os.path.exists('twisted'): | |
sys.path.insert(0, '.') | |
requirements = ["zope.interface >= 3.6.0"] | |
from twisted.python.dist import ( | |
STATIC_PACKAGE_METADATA, getExtensions, getScripts, | |
setup, _EXTRAS_REQUIRE) | |
setup_args = STATIC_PACKAGE_METADATA.copy() | |
setup_args.update(dict( | |
packages=setuptools.find_packages(), | |
install_requires=requirements, | |
conditionalExtensions=getExtensions(), | |
scripts=getScripts(), | |
include_package_data=True, | |
zip_safe=False, | |
extras_require=_EXTRAS_REQUIRE, | |
)) | |
return setup_args | |
def main(args): | |
""" | |
Invoke twisted.python.dist with the appropriate metadata about the | |
Twisted package. | |
""" | |
setup_args = get_setup_arguments() | |
setup(**setup_args) | |
if __name__ == "__main__": | |
try: | |
main(sys.argv[1:]) | |
except KeyboardInterrupt: | |
sys.exit(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment