• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python
2#
3# This file is part of pyasn1-modules software.
4#
5# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com>
6# License: http://snmplabs.com/pyasn1/license.html
7#
8import sys
9
10doclines = """A collection of ASN.1-based protocols modules.
11
12   A collection of ASN.1 modules expressed in form of pyasn1 classes.
13   Includes protocols PDUs definition (SNMP, LDAP etc.) and various
14   data structures (X.509, PKCS etc.).
15"""
16
17doclines = [x.strip() for x in doclines.split('\n') if x]
18
19
20classifiers = """\
21Development Status :: 5 - Production/Stable
22Environment :: Console
23Intended Audience :: Developers
24Intended Audience :: Education
25Intended Audience :: Information Technology
26Intended Audience :: System Administrators
27Intended Audience :: Telecommunications Industry
28License :: OSI Approved :: BSD License
29Natural Language :: English
30Operating System :: OS Independent
31Programming Language :: Python :: 2
32Programming Language :: Python :: 2.4
33Programming Language :: Python :: 2.5
34Programming Language :: Python :: 2.6
35Programming Language :: Python :: 2.7
36Programming Language :: Python :: 3
37Programming Language :: Python :: 3.2
38Programming Language :: Python :: 3.3
39Programming Language :: Python :: 3.4
40Programming Language :: Python :: 3.5
41Programming Language :: Python :: 3.6
42Programming Language :: Python :: 3.7
43Programming Language :: Python :: 3.8
44Topic :: Communications
45Topic :: System :: Monitoring
46Topic :: System :: Networking :: Monitoring
47Topic :: Software Development :: Libraries :: Python Modules
48"""
49
50
51def howto_install_setuptools():
52    print("""
53   Error: You need setuptools Python package!
54
55   It's very easy to install it, just type (as root on Linux):
56
57   wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
58   python ez_setup.py
59
60   Then you could make eggs from this package.
61""")
62
63
64if sys.version_info[:2] < (2, 4):
65    print("ERROR: this package requires Python 2.4 or later!")
66    sys.exit(1)
67
68try:
69    from setuptools import setup, Command
70
71    params = {
72        'zip_safe': True,
73        'install_requires': ['pyasn1>=0.4.6,<0.5.0']
74    }
75
76except ImportError:
77    for arg in sys.argv:
78        if 'egg' in arg:
79            howto_install_setuptools()
80            sys.exit(1)
81
82    from distutils.core import setup, Command
83
84    if sys.version_info[:2] > (2, 4):
85        params = {
86            'requires': ['pyasn1(>=0.4.6,<0.5.0)']
87        }
88    else:
89        params = {
90            'requires': ['pyasn1']
91        }
92
93params.update(
94    {'name': 'pyasn1-modules',
95     'version': open('pyasn1_modules/__init__.py').read().split('\'')[1],
96     'description': doclines[0],
97     'long_description': ' '.join(doclines[1:]),
98     'maintainer': 'Ilya Etingof <etingof@gmail.com>',
99     'author': 'Ilya Etingof',
100     'author_email': 'etingof@gmail.com',
101     'url': 'https://github.com/etingof/pyasn1-modules',
102     'platforms': ['any'],
103     'classifiers': [x for x in classifiers.split('\n') if x],
104     'license': 'BSD-2-Clause',
105     'packages': ['pyasn1_modules']}
106)
107
108
109# handle unittest discovery feature
110try:
111    import unittest2 as unittest
112except ImportError:
113    import unittest
114
115
116class PyTest(Command):
117    user_options = []
118
119    def initialize_options(self):
120        pass
121
122    def finalize_options(self):
123        pass
124
125    def run(self):
126        suite = unittest.TestLoader().loadTestsFromNames(
127            ['tests.__main__.suite']
128        )
129
130        unittest.TextTestRunner(verbosity=2).run(suite)
131
132params['cmdclass'] = {
133    'test': PyTest,
134    'tests': PyTest
135}
136
137setup(**params)
138