-
Notifications
You must be signed in to change notification settings - Fork 26
/
setup.py
98 lines (79 loc) · 2.68 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
#!/usr/bin/env python
# Copyright 2010-2020, Damian Johnson and The Tor Project
# See LICENSE for licensing information
import setuptools
import os
import re
import sys
if '--dryrun' in sys.argv:
DRY_RUN = True
sys.argv.remove('--dryrun')
else:
DRY_RUN = False
SUMMARY = 'Terminal status monitor for Tor (https://www.torproject.org/).'
DRY_RUN_SUMMARY = 'Ignore this package. This is dry-run release creation to work around PyPI limitations (https://github.com/pypa/packaging-problems/issues/74#issuecomment-260716129).'
DESCRIPTION = """
Nyx is a command-line monitor for Tor. With this you can get detailed real-time information about your relay such as bandwidth usage, connections, logs, and much more. For more information see `Nyx's homepage <https://nyx.torproject.org/>`_.
Quick Start
-----------
To install you can either use...
::
pip install nyx
... or install from the source tarball. Nyx supports both the python 2.x and 3.x series.
"""
MANIFEST = """
include LICENSE
include MANIFEST.in
include nyx.1
include run_nyx
include run_tests.py
graft test
graft web
global-exclude __pycache__
global-exclude *.orig
global-exclude *.pyc
global-exclude *.swp
global-exclude *.swo
global-exclude *~
""".strip()
# We cannot import our own modules since if they import stem it'll break
# installation. As such, just reading our file for the parameters we need.
ATTR = {}
ATTR_LINE = re.compile("^__(\\S+)__ = '(.+)'")
with open('nyx/__init__.py') as init_file:
for line in init_file:
m = ATTR_LINE.match(line)
if m:
ATTR[m.group(1)] = m.group(2)
# installation requires us to be in our setup.py's directory
os.chdir(os.path.dirname(os.path.abspath(__file__)))
with open('MANIFEST.in', 'w') as manifest_file:
manifest_file.write(MANIFEST)
try:
setuptools.setup(
name = 'nyx-dry-run' if DRY_RUN else 'nyx',
version = ATTR['version'],
description = DRY_RUN_SUMMARY if DRY_RUN else SUMMARY,
long_description = DESCRIPTION,
license = ATTR['license'],
author = ATTR['author'],
author_email = ATTR['contact'],
url = ATTR['url'],
packages = ['nyx', 'nyx.panel'],
keywords = 'tor onion controller',
install_requires = ['stem>=1.7.0'],
package_data = {'nyx': ['settings/*']},
entry_points = {'console_scripts': ['nyx = nyx.__init__:main']},
classifiers = [
'Development Status :: 5 - Production/Stable',
'Environment :: Console :: Curses',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Topic :: Security',
],
)
finally:
if os.path.exists('MANIFEST.in'):
os.remove('MANIFEST.in')
if os.path.exists('MANIFEST'):
os.remove('MANIFEST')