[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Nicer layout for package_data



commit 2e296c02f69e239d043f00377988bda53dae9f58
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Tue Dec 6 11:00:03 2016 -0800

    Nicer layout for package_data
    
    In commit d2a0be8 I had to revert a small change for our setup.py's setup()
    layout. Reintroducing that tweak with a corrected test.
---
 setup.py                  |  8 ++++++--
 test/unit/installation.py | 16 ++++++++++++++--
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/setup.py b/setup.py
index 6b4922d..ac780d6 100644
--- a/setup.py
+++ b/setup.py
@@ -73,8 +73,12 @@ try:
     keywords = 'tor onion controller',
     scripts = ['tor-prompt'],
     provides = ['stem'],
-    package_data = {'stem': ['cached_tor_manual.cfg', 'settings.cfg'], 'stem.descriptor': ['fallback_directories.cfg'], 'stem.interpreter': ['settings.cfg'], 'stem.util': ['ports.cfg']},
-    classifiers = [
+    package_data = {
+      'stem': ['cached_tor_manual.cfg', 'settings.cfg'],
+      'stem.descriptor': ['fallback_directories.cfg'],
+      'stem.interpreter': ['settings.cfg'],
+      'stem.util': ['ports.cfg'],
+    }, classifiers = [
       'Development Status :: 5 - Production/Stable',
       'Intended Audience :: Developers',
       'License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)',
diff --git a/test/unit/installation.py b/test/unit/installation.py
index d1c5670..773e0f1 100644
--- a/test/unit/installation.py
+++ b/test/unit/installation.py
@@ -54,9 +54,21 @@ class TestInstallation(unittest.TestCase):
 
     # Checking that we have all non-source files. Data looks like...
     #
-    #   package_data = {'stem': ['cached_tor_manual.cfg', 'settings.cfg']},
+    #   package_data = {
+    #     'stem': ['cached_tor_manual.cfg', 'settings.cfg'],
+    #     'stem.descriptor': ['fallback_directories.cfg'],
+    #   },
+
+    package_data = {}
+
+    for line in self.setup_contents.split('package_data = {\n', 1)[1].splitlines():
+      if '},' in line:
+        break
+
+      directory = line.strip().split()[0][1:-2]
+      files = line.strip().split(' ', 1)[1][2:-3].split("', '")
+      package_data[directory] = files
 
-    package_data = json.loads(re.search('package_data = (\{.*\})', self.setup_contents).group(1).replace("'", '"'))
     data_files = []
 
     for module, files in package_data.items():

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits