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