[tor-commits] [nyx/master] Include manifest when packaging

atagar at torproject.org atagar at torproject.org
Mon Nov 6 19:29:12 UTC 2017


commit 0be8024a819fd88812862ab8aa57beb3fd83a509
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Nov 5 14:41:15 2017 -0800

    Include manifest when packaging
    
    Stem dynamically generates a manifest to instruct distutil what to include and
    exclude. Doing the same here.
---
 setup.py | 72 +++++++++++++++++++++++++++++++++++++++++++---------------------
 1 file changed, 49 insertions(+), 23 deletions(-)

diff --git a/setup.py b/setup.py
index 5a24ca2..db63e61 100644
--- a/setup.py
+++ b/setup.py
@@ -25,7 +25,7 @@ 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/>`_
+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
 -----------
@@ -39,6 +39,22 @@ To install you can either use...
 ... 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_tests.py
+graft test
+graft web
+global-exclude __pycache__
+global-exclude *.orig
+global-exclude *.pyc
+global-exclude *.swp
+global-exclude *.swo
+global-exclude *~
+""".strip()
+
+
 class NyxInstaller(install):
   """
   Nyx installer. This adds the following additional options...
@@ -116,25 +132,35 @@ class NyxInstaller(install):
 setup_dir = os.path.dirname(os.path.join(os.getcwd(), __file__))
 os.chdir(setup_dir)
 
-setup(
-  name = 'nyx-dry-run' if DRY_RUN else 'nyx',
-  version = nyx.__version__,
-  description = DRY_RUN_SUMMARY if DRY_RUN else SUMMARY,
-  long_description = DESCRIPTION,
-  license = nyx.__license__,
-  author = nyx.__author__,
-  author_email = nyx.__contact__,
-  url = nyx.__url__,
-  packages = ['nyx', 'nyx.panel'],
-  keywords = 'tor onion controller',
-  install_requires = ['stem>=1.6.0'],
-  package_data = {'nyx': ['settings/*']},
-  cmdclass = {'install': NyxInstaller},
-  classifiers = [
-    'Development Status :: 5 - Production/Stable',
-    'Environment :: Console :: Curses',
-    'Intended Audience :: System Administrators',
-    'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
-    'Topic :: Security',
-  ],
-)
+with open('MANIFEST.in', 'w') as manifest_file:
+  manifest_file.write(MANIFEST)
+
+try:
+  setup(
+    name = 'nyx-dry-run' if DRY_RUN else 'nyx',
+    version = nyx.__version__,
+    description = DRY_RUN_SUMMARY if DRY_RUN else SUMMARY,
+    long_description = DESCRIPTION,
+    license = nyx.__license__,
+    author = nyx.__author__,
+    author_email = nyx.__contact__,
+    url = nyx.__url__,
+    packages = ['nyx', 'nyx.panel'],
+    keywords = 'tor onion controller',
+    install_requires = ['stem>=1.6.0'],
+    package_data = {'nyx': ['settings/*']},
+    cmdclass = {'install': NyxInstaller},
+    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')





More information about the tor-commits mailing list