setup.py 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #!/usr/bin/env python
  2. #
  3. # This file is part of pyasn1 software.
  4. #
  5. # Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com>
  6. # License: http://snmplabs.com/pyasn1/license.html
  7. #
  8. import os
  9. import sys
  10. classifiers = """\
  11. Development Status :: 5 - Production/Stable
  12. Environment :: Console
  13. Intended Audience :: Developers
  14. Intended Audience :: Education
  15. Intended Audience :: Information Technology
  16. Intended Audience :: System Administrators
  17. Intended Audience :: Telecommunications Industry
  18. License :: OSI Approved :: BSD License
  19. Natural Language :: English
  20. Operating System :: OS Independent
  21. Programming Language :: Python :: 2
  22. Programming Language :: Python :: 2.4
  23. Programming Language :: Python :: 2.5
  24. Programming Language :: Python :: 2.6
  25. Programming Language :: Python :: 2.7
  26. Programming Language :: Python :: 3
  27. Programming Language :: Python :: 3.2
  28. Programming Language :: Python :: 3.3
  29. Programming Language :: Python :: 3.4
  30. Programming Language :: Python :: 3.5
  31. Programming Language :: Python :: 3.6
  32. Programming Language :: Python :: 3.7
  33. Topic :: Communications
  34. Topic :: Software Development :: Libraries :: Python Modules
  35. """
  36. def howto_install_setuptools():
  37. print("""
  38. Error: You need setuptools Python package!
  39. It's very easy to install it, just type:
  40. wget https://bootstrap.pypa.io/ez_setup.py
  41. python ez_setup.py
  42. Then you could make eggs from this package.
  43. """)
  44. if sys.version_info[:2] < (2, 4):
  45. print("ERROR: this package requires Python 2.4 or later!")
  46. sys.exit(1)
  47. try:
  48. from setuptools import setup, Command
  49. params = {
  50. 'zip_safe': True
  51. }
  52. except ImportError:
  53. for arg in sys.argv:
  54. if 'egg' in arg:
  55. howto_install_setuptools()
  56. sys.exit(1)
  57. from distutils.core import setup, Command
  58. params = {}
  59. params.update({
  60. 'name': 'pyasn1',
  61. 'version': open(os.path.join('pyasn1', '__init__.py')).read().split('\'')[1],
  62. 'description': 'ASN.1 types and codecs',
  63. 'long_description': 'Pure-Python implementation of ASN.1 types and DER/BER/CER codecs (X.208)',
  64. 'maintainer': 'Ilya Etingof <etingof@gmail.com>',
  65. 'author': 'Ilya Etingof',
  66. 'author_email': 'etingof@gmail.com',
  67. 'url': 'https://github.com/etingof/pyasn1',
  68. 'platforms': ['any'],
  69. 'classifiers': [x for x in classifiers.split('\n') if x],
  70. 'license': 'BSD',
  71. 'packages': ['pyasn1',
  72. 'pyasn1.type',
  73. 'pyasn1.compat',
  74. 'pyasn1.codec',
  75. 'pyasn1.codec.ber',
  76. 'pyasn1.codec.cer',
  77. 'pyasn1.codec.der',
  78. 'pyasn1.codec.native']})
  79. # handle unittest discovery feature
  80. try:
  81. import unittest2 as unittest
  82. except ImportError:
  83. import unittest
  84. class PyTest(Command):
  85. user_options = []
  86. def initialize_options(self):
  87. pass
  88. def finalize_options(self):
  89. pass
  90. def run(self):
  91. suite = unittest.TestLoader().loadTestsFromNames(
  92. ['tests.__main__.suite']
  93. )
  94. unittest.TextTestRunner(verbosity=2).run(suite)
  95. params['cmdclass'] = {
  96. 'test': PyTest,
  97. 'tests': PyTest,
  98. }
  99. setup(**params)