-
Notifications
You must be signed in to change notification settings - Fork 78
/
setup.py
147 lines (124 loc) · 4.91 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# -*- coding: utf-8 -*-
#
# setup.py
#
# Author: Toke Høiland-Jørgensen ([email protected])
# Date: 4 December 2012
# Copyright (c) 2012-2016, Toke Høiland-Jørgensen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import absolute_import, division, print_function
import os
import sys
from setuptools import setup
from setuptools.command.build_py import build_py as _build_py
from setuptools.command.sdist import sdist as _sdist
from flent.build_info import VERSION
from glob import glob
version_string = VERSION
if sys.version_info[:3] < (3, 6, 0):
sys.stderr.write("Sorry, Flent requires v3.6 or later of Python.\n")
sys.exit(1)
def rewrite_build_info(module_file):
with open(module_file, 'w') as module_fp:
module_fp.write('# -*- coding: UTF-8 -*-\n\n')
module_fp.write("import os\n")
module_fp.write("VERSION='%s'\n" % (version_string))
module_fp.write("DATA_DIR=os.path.dirname(__file__)\n")
class build_py(_build_py):
"""build_py command
This specific build_py command will modify module
'flent.build_config' so that it contains information on
installation prefixes afterwards.
"""
def build_module(self, module, module_file, package):
orig_content = None
if module == 'build_info' and package == 'flent':
with open(module_file, 'rb') as module_fp:
orig_content = module_fp.read()
rewrite_build_info(module_file)
_build_py.build_module(self, module, module_file, package)
if orig_content is not None:
with open(module_file, 'wb') as module_fp:
module_fp.write(orig_content)
class sdist(_sdist):
def make_release_tree(self, base_dir, files):
if 'flent/build_info.py' in files and not self.dry_run:
files = [f for f in files if f != 'flent/build_info.py']
_sdist.make_release_tree(self, base_dir, files)
rewrite_build_info(os.path.join(base_dir, 'flent/build_info.py'))
else:
_sdist.make_release_tree(self, base_dir, files)
data_files = [('share/doc/flent',
['BUGS',
'README.rst',
'CHANGES.md',
'flent-paper.batch'] + glob("*.example")),
('share/man/man1',
['man/flent.1']),
('share/doc/flent/misc',
glob("misc/*")),
('share/mime/packages',
['flent-mime.xml']),
('share/applications',
['flent.desktop']),
('share/metainfo',
['flent.appdata.xml'])]
classifiers = [
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Environment :: MacOS X',
'Environment :: X11 Applications',
'Environment :: X11 Applications :: Qt',
'Intended Audience :: Developers',
'Intended Audience :: Education',
'Intended Audience :: Science/Research',
'Intended Audience :: System Administrators',
'Intended Audience :: Telecommunications Industry',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Operating System :: MacOS :: MacOS X',
'Operating System :: POSIX',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3 :: Only',
'Topic :: Internet',
'Topic :: System :: Benchmark',
'Topic :: System :: Networking',
'Topic :: Utilities',
]
with open("README.rst") as fp:
long_description = "\n" + fp.read()
setup(name="flent",
version=version_string,
description="The FLExible Network Tester",
long_description=long_description,
include_package_data=True,
author="Toke Høiland-Jørgensen <[email protected]>",
author_email="[email protected]",
url="http://flent.org",
license="GNU GPLv3",
classifiers=classifiers,
packages=["flent", "flent.scripts", "flent.tests", "flent.ui"],
entry_points={'console_scripts': ['flent = flent:run_flent'],
'gui_scripts': ['flent-gui = flent:run_flent_gui']},
zip_safe=False,
data_files=data_files,
cmdclass={'build_py': build_py, 'sdist': sdist},
extras_require={
'GUI': ['QtPy', 'PyQt5'],
'Plots': ['matplotlib>=1.5'],
},
)