• 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-2017, Ilya Etingof <etingof@gmail.com>
6# License: http://pyasn1.sf.net/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
42Topic :: Communications
43Topic :: System :: Monitoring
44Topic :: System :: Networking :: Monitoring
45Topic :: Software Development :: Libraries :: Python Modules
46"""
47
48
49def howto_install_setuptools():
50    print("""
51   Error: You need setuptools Python package!
52
53   It's very easy to install it, just type (as root on Linux):
54
55   wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
56   python ez_setup.py
57
58   Then you could make eggs from this package.
59""")
60
61
62if sys.version_info[:2] < (2, 4):
63    print("ERROR: this package requires Python 2.4 or later!")
64    sys.exit(1)
65
66try:
67    from setuptools import setup, Command
68
69    params = {
70        'zip_safe': True,
71        'install_requires': ['pyasn1>=0.4.1,<0.5.0']
72    }
73
74except ImportError:
75    for arg in sys.argv:
76        if 'egg' in arg:
77            howto_install_setuptools()
78            sys.exit(1)
79
80    from distutils.core import setup, Command
81
82    if sys.version_info[:2] > (2, 4):
83        params = {
84            'requires': ['pyasn1(>=0.4.1,<0.5.0)']
85        }
86    else:
87        params = {
88            'requires': ['pyasn1']
89        }
90
91params.update(
92    {'name': 'pyasn1-modules',
93     'version': open('pyasn1_modules/__init__.py').read().split('\'')[1],
94     'description': doclines[0],
95     'long_description': ' '.join(doclines[1:]),
96     'maintainer': 'Ilya Etingof <etingof@gmail.com>',
97     'author': 'Ilya Etingof',
98     'author_email': 'etingof@gmail.com',
99     'url': 'https://github.com/etingof/pyasn1-modules',
100     'platforms': ['any'],
101     'classifiers': [x for x in classifiers.split('\n') if x],
102     'license': 'BSD',
103     'packages': ['pyasn1_modules']}
104)
105
106
107# handle unittest discovery feature
108try:
109    import unittest2 as unittest
110except ImportError:
111    import unittest
112
113
114class PyTest(Command):
115    user_options = []
116
117    def initialize_options(self):
118        pass
119
120    def finalize_options(self):
121        pass
122
123    def run(self):
124        suite = unittest.TestLoader().loadTestsFromNames(
125            ['tests.__main__.suite']
126        )
127
128        unittest.TextTestRunner(verbosity=2).run(suite)
129
130params['cmdclass'] = {
131    'test': PyTest,
132    'tests': PyTest
133}
134
135setup(**params)
136