[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [nyx/master] Cannot install when stem is unavailable
commit 55b1547eb9977dee76d749837b34f298fec1e36a
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Sun Nov 5 15:29:16 2017 -0800
Cannot install when stem is unavailable
Damn. Installing with pip fails with an ImportError because our setup.py
imports nyx/__init__.py which in turn imports stem. As such just reading our
file instead.
---
nyx/__init__.py | 2 +-
setup.py | 27 +++++++++++++++++++--------
2 files changed, 20 insertions(+), 9 deletions(-)
diff --git a/nyx/__init__.py b/nyx/__init__.py
index 4133c1d..65102b0 100644
--- a/nyx/__init__.py
+++ b/nyx/__init__.py
@@ -89,7 +89,7 @@ except ImportError:
sys.exit(1)
-__version__ = '2.0.0'
+__version__ = '2.0.1'
__release_date__ = 'November 5, 2017'
__author__ = 'Damian Johnson'
__contact__ = 'atagar@xxxxxxxxxxxxxx'
diff --git a/setup.py b/setup.py
index db63e61..511e29a 100644
--- a/setup.py
+++ b/setup.py
@@ -4,17 +4,15 @@
import gzip
import os
+import re
import stat
import sys
import sysconfig
-import nyx
-
from distutils import log
from distutils.core import setup
from distutils.command.install import install
-
if '--dryrun' in sys.argv:
DRY_RUN = True
sys.argv.remove('--dryrun')
@@ -54,6 +52,19 @@ 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)
+
class NyxInstaller(install):
"""
@@ -138,13 +149,13 @@ with open('MANIFEST.in', 'w') as manifest_file:
try:
setup(
name = 'nyx-dry-run' if DRY_RUN else 'nyx',
- version = nyx.__version__,
+ version = ATTR['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__,
+ 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.6.0'],
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits