1#!/usr/bin/env python 2# Copyright 2010-2019, Damian Johnson and The Tor Project 3# See LICENSE for licensing information 4 5import setuptools 6import os 7import re 8import sys 9 10if '--dryrun' in sys.argv: 11 DRY_RUN = True 12 sys.argv.remove('--dryrun') 13else: 14 DRY_RUN = False 15 16SUMMARY = 'Terminal status monitor for Tor (https://www.torproject.org/).' 17DRY_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).' 18 19DESCRIPTION = """ 20Nyx 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/>`_. 21 22Quick Start 23----------- 24 25To install you can either use... 26 27:: 28 29 pip install nyx 30 31... or install from the source tarball. Nyx supports both the python 2.x and 3.x series. 32""" 33 34MANIFEST = """ 35include LICENSE 36include MANIFEST.in 37include nyx.1 38include run_nyx 39include run_tests.py 40graft test 41graft web 42global-exclude __pycache__ 43global-exclude *.orig 44global-exclude *.pyc 45global-exclude *.swp 46global-exclude *.swo 47global-exclude *~ 48""".strip() 49 50# We cannot import our own modules since if they import stem it'll break 51# installation. As such, just reading our file for the parameters we need. 52 53ATTR = {} 54ATTR_LINE = re.compile("^__(\S+)__ = '(.+)'") 55 56with open('nyx/__init__.py') as init_file: 57 for line in init_file: 58 m = ATTR_LINE.match(line) 59 60 if m: 61 ATTR[m.group(1)] = m.group(2) 62 63# installation requires us to be in our setup.py's directory 64 65os.chdir(os.path.dirname(os.path.abspath(__file__))) 66 67with open('MANIFEST.in', 'w') as manifest_file: 68 manifest_file.write(MANIFEST) 69 70try: 71 setuptools.setup( 72 name = 'nyx-dry-run' if DRY_RUN else 'nyx', 73 version = ATTR['version'], 74 description = DRY_RUN_SUMMARY if DRY_RUN else SUMMARY, 75 long_description = DESCRIPTION, 76 license = ATTR['license'], 77 author = ATTR['author'], 78 author_email = ATTR['contact'], 79 url = ATTR['url'], 80 packages = ['nyx', 'nyx.panel'], 81 keywords = 'tor onion controller', 82 install_requires = ['stem>=1.7.0'], 83 package_data = {'nyx': ['settings/*']}, 84 entry_points = {'console_scripts': ['nyx = nyx.__init__:main']}, 85 classifiers = [ 86 'Development Status :: 5 - Production/Stable', 87 'Environment :: Console :: Curses', 88 'Intended Audience :: System Administrators', 89 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', 90 'Topic :: Security', 91 ], 92 ) 93finally: 94 if os.path.exists('MANIFEST.in'): 95 os.remove('MANIFEST.in') 96 97 if os.path.exists('MANIFEST'): 98 os.remove('MANIFEST') 99