blob: 7a0ecd0776729caec5573f6436f1f6aa6eaae649 [file] [log] [blame]
elie8b513892011-02-17 18:35:16 +00001#!/usr/bin/env python
elie71ba6062015-12-29 23:14:22 +00002#
3# This file is part of pyasn1-modules software.
4#
Ilya Etingofb9614192018-12-29 21:59:05 +01005# Copyright (c) 2005-2019, Ilya Etingof <[email protected]>
Ilya Etingof66122a92018-03-29 08:08:34 +02006# License: http://snmplabs.com/pyasn1/license.html
elie71ba6062015-12-29 23:14:22 +00007#
Ilya Etingofcd2de072017-06-01 22:36:02 +02008import sys
9
10doclines = """A collection of ASN.1-based protocols modules.
eliea8dd0182012-07-04 12:39:21 +000011
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
Ilya Etingofcd2de072017-06-01 22:36:02 +020017doclines = [x.strip() for x in doclines.split('\n') if x]
18
19
eliea8dd0182012-07-04 12:39:21 +000020classifiers = """\
21Development Status :: 5 - Production/Stable
22Environment :: Console
23Intended Audience :: Developers
24Intended Audience :: Education
25Intended Audience :: Information Technology
eliea8dd0182012-07-04 12:39:21 +000026Intended Audience :: System Administrators
27Intended Audience :: Telecommunications Industry
28License :: OSI Approved :: BSD License
29Natural Language :: English
30Operating System :: OS Independent
31Programming Language :: Python :: 2
Ilya Etingofc9187892016-12-23 21:18:25 +010032Programming Language :: Python :: 2.4
33Programming Language :: Python :: 2.5
34Programming Language :: Python :: 2.6
35Programming Language :: Python :: 2.7
eliea8dd0182012-07-04 12:39:21 +000036Programming Language :: Python :: 3
Ilya Etingofc9187892016-12-23 21:18:25 +010037Programming Language :: Python :: 3.2
38Programming Language :: Python :: 3.3
39Programming Language :: Python :: 3.4
40Programming Language :: Python :: 3.5
41Programming Language :: Python :: 3.6
Ilya Etingof1acfe302018-06-28 10:09:39 +020042Programming Language :: Python :: 3.7
Aliaksei Urbanskia9139ec2019-10-17 07:57:05 +030043Programming Language :: Python :: 3.8
elie8549b5d2012-07-23 16:54:31 +000044Topic :: Communications
Ilya Etingofc9187892016-12-23 21:18:25 +010045Topic :: System :: Monitoring
46Topic :: System :: Networking :: Monitoring
eliea8dd0182012-07-04 12:39:21 +000047Topic :: Software Development :: Libraries :: Python Modules
48"""
elie8b513892011-02-17 18:35:16 +000049
Ilya Etingof2a5c89c2016-03-27 23:45:18 +020050
elie8b513892011-02-17 18:35:16 +000051def howto_install_setuptools():
elie367753c2011-10-04 11:36:10 +000052 print("""
53 Error: You need setuptools Python package!
elie8b513892011-02-17 18:35:16 +000054
elie367753c2011-10-04 11:36:10 +000055 It's very easy to install it, just type (as root on Linux):
elie1536a5e2012-07-23 16:35:59 +000056
Ilya Etingofcd2de072017-06-01 22:36:02 +020057 wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
elie8b513892011-02-17 18:35:16 +000058 python ez_setup.py
elie1536a5e2012-07-23 16:35:59 +000059
60 Then you could make eggs from this package.
elie367753c2011-10-04 11:36:10 +000061""")
elie8b513892011-02-17 18:35:16 +000062
Ilya Etingof2a5c89c2016-03-27 23:45:18 +020063
Ilya Etingofcd2de072017-06-01 22:36:02 +020064if sys.version_info[:2] < (2, 4):
65 print("ERROR: this package requires Python 2.4 or later!")
66 sys.exit(1)
67
elie8b513892011-02-17 18:35:16 +000068try:
Ilya Etingofcd2de072017-06-01 22:36:02 +020069 from setuptools import setup, Command
Ilya Etingof2a5c89c2016-03-27 23:45:18 +020070
elie8b513892011-02-17 18:35:16 +000071 params = {
Ilya Etingof061aac02017-09-07 17:12:24 +020072 'zip_safe': True,
Ilya Etingof213c0f42019-08-01 07:47:31 +020073 'install_requires': ['pyasn1>=0.4.6,<0.5.0']
Ilya Etingof2a5c89c2016-03-27 23:45:18 +020074 }
Ilya Etingof2a5c89c2016-03-27 23:45:18 +020075
Ilya Etingofcd2de072017-06-01 22:36:02 +020076except ImportError:
elie8b513892011-02-17 18:35:16 +000077 for arg in sys.argv:
Ilya Etingofcd2de072017-06-01 22:36:02 +020078 if 'egg' in arg:
79 howto_install_setuptools()
elie8b513892011-02-17 18:35:16 +000080 sys.exit(1)
Ilya Etingof061aac02017-09-07 17:12:24 +020081
Ilya Etingofcd2de072017-06-01 22:36:02 +020082 from distutils.core import setup, Command
Ilya Etingof2a5c89c2016-03-27 23:45:18 +020083
elieb4c93222012-04-17 19:41:47 +000084 if sys.version_info[:2] > (2, 4):
Ilya Etingof061aac02017-09-07 17:12:24 +020085 params = {
Ilya Etingof213c0f42019-08-01 07:47:31 +020086 'requires': ['pyasn1(>=0.4.6,<0.5.0)']
Ilya Etingof061aac02017-09-07 17:12:24 +020087 }
88 else:
89 params = {
90 'requires': ['pyasn1']
91 }
elie8b513892011-02-17 18:35:16 +000092
elie35eec0d2015-10-10 18:09:59 +000093params.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:]),
Ilya Etingoff2120842016-12-04 12:06:34 +010098 'maintainer': 'Ilya Etingof <[email protected]>',
elie35eec0d2015-10-10 18:09:59 +000099 'author': 'Ilya Etingof',
Ilya Etingoff2120842016-12-04 12:06:34 +0100100 'author_email': '[email protected]',
101 'url': 'https://github.com/etingof/pyasn1-modules',
elie35eec0d2015-10-10 18:09:59 +0000102 'platforms': ['any'],
103 'classifiers': [x for x in classifiers.split('\n') if x],
Ilya Etingof213c0f42019-08-01 07:47:31 +0200104 'license': 'BSD-2-Clause',
elie35eec0d2015-10-10 18:09:59 +0000105 'packages': ['pyasn1_modules']}
106)
elie8b513892011-02-17 18:35:16 +0000107
Ilya Etingof7ef20602017-08-05 12:12:08 +0200108
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
elie367753c2011-10-04 11:36:10 +0000137setup(**params)