1#!/usr/bin/env python
2#   Copyright (c) 2008 by David P. D. Moss. All rights reserved.
3#
4#   Released under the BSD license. See the LICENSE file for details.
5"""
6A distutils Python setup file. For setuptools support see setup_egg.py.
7"""
8import os
9import sys
10
11from setuptools import setup
12
13if os.path.exists('MANIFEST'):
14    os.remove('MANIFEST')
15
16keywords = [
17    'Networking', 'Systems Administration', 'IANA', 'IEEE', 'CIDR', 'IP',
18    'IPv4', 'IPv6', 'CIDR', 'EUI', 'MAC', 'MAC-48', 'EUI-48', 'EUI-64'
19]
20
21#   Required by distutils only.
22packages = [
23    'netaddr',
24    'netaddr.ip',
25    'netaddr.eui',
26    'netaddr.strategy',
27    'netaddr.contrib',
28]
29
30#   Required by distutils only.
31package_data = {
32    'netaddr.ip': [
33        '*.xml',
34    ],
35    'netaddr.eui': [
36        '*.txt',
37        '*.idx'
38    ],
39}
40
41with open('README.rst') as f:
42    long_description = f.read()
43
44platforms = 'OS Independent'
45
46classifiers = [
47    'Development Status :: 5 - Production/Stable',
48    'Environment :: Console',
49    'Intended Audience :: Developers',
50    'Intended Audience :: Education',
51    'Intended Audience :: Information Technology',
52    'Intended Audience :: Science/Research',
53    'Intended Audience :: System Administrators',
54    'Intended Audience :: Telecommunications Industry',
55    'License :: OSI Approved :: BSD License',
56    'License :: OSI Approved :: MIT License',
57    'Natural Language :: English',
58    'Operating System :: OS Independent',
59    'Programming Language :: Python',
60    'Programming Language :: Python :: 2',
61    'Programming Language :: Python :: 2.7',
62    'Programming Language :: Python :: 3',
63    'Programming Language :: Python :: 3.5',
64    'Programming Language :: Python :: 3.6',
65    'Programming Language :: Python :: 3.7',
66    'Programming Language :: Python :: 3.8',
67    'Topic :: Communications',
68    'Topic :: Documentation',
69    'Topic :: Education',
70    'Topic :: Education :: Testing',
71    'Topic :: Home Automation',
72    'Topic :: Internet',
73    'Topic :: Internet :: Log Analysis',
74    'Topic :: Internet :: Name Service (DNS)',
75    'Topic :: Internet :: Proxy Servers',
76    'Topic :: Internet :: WWW/HTTP',
77    'Topic :: Internet :: WWW/HTTP :: Indexing/Search',
78    'Topic :: Internet :: WWW/HTTP :: Site Management',
79    'Topic :: Security',
80    'Topic :: Software Development',
81    'Topic :: Software Development :: Libraries',
82    'Topic :: Software Development :: Libraries :: Python Modules',
83    'Topic :: Software Development :: Quality Assurance',
84    'Topic :: Software Development :: Testing',
85    'Topic :: Software Development :: Testing :: Traffic Generation',
86    'Topic :: System :: Benchmark',
87    'Topic :: System :: Clustering',
88    'Topic :: System :: Distributed Computing',
89    'Topic :: System :: Installation/Setup',
90    'Topic :: System :: Logging',
91    'Topic :: System :: Monitoring',
92    'Topic :: System :: Networking',
93    'Topic :: System :: Networking :: Firewalls',
94    'Topic :: System :: Networking :: Monitoring',
95    'Topic :: System :: Networking :: Time Synchronization',
96    'Topic :: System :: Recovery Tools',
97    'Topic :: System :: Shells',
98    'Topic :: System :: Software Distribution',
99    'Topic :: System :: Systems Administration',
100    'Topic :: System :: System Shells',
101    'Topic :: Text Processing',
102    'Topic :: Text Processing :: Filters',
103    'Topic :: Utilities',
104]
105
106
107def main():
108    if sys.version_info[:2] < (2, 5):
109        sys.stderr.write("netaddr requires Python version 2.5 or higher.\n")
110        sys.exit(1)
111
112    if sys.argv[-1] == 'setup.py':
113        sys.stdout.write("To install, run 'python setup.py install'\n\n")
114
115    setup_options = dict(
116        author='David P. D. Moss, Stefan Nordhausen et al',
117        author_email='drkjam@gmail.com',
118        classifiers=classifiers,
119        description='A network address manipulation library for Python',
120        download_url='https://pypi.org/project/netaddr/',
121        keywords=keywords,
122        license='BSD License',
123        long_description=long_description,
124        name='netaddr',
125        package_data=package_data,
126        packages=packages,
127        platforms=platforms,
128        entry_points={'console_scripts': ['netaddr = netaddr.cli:main']},
129        url='https://github.com/drkjam/netaddr/',
130        version=(
131            [
132                ln for ln in open(os.path.join(os.path.dirname(__file__), 'netaddr', '__init__.py'))
133                if '__version__' in ln
134            ][0]
135            .split('=')[-1]
136            .strip()
137            .strip('\'"')
138        ),
139        install_requires=['importlib-resources;python_version<"3.7"'],
140    )
141
142    setup(**setup_options)
143
144if __name__ == "__main__":
145    main()
146