From d911d3e51380a0c29c414b80e5ec61f94601d29e Mon Sep 17 00:00:00 2001 From: Stephen Bailey Date: Thu, 3 Jun 2021 15:30:09 -0700 Subject: [PATCH 1/2] support github vs. python product capitalization differences --- py/desiutil/modules.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/py/desiutil/modules.py b/py/desiutil/modules.py index a3caf687..4db049c4 100644 --- a/py/desiutil/modules.py +++ b/py/desiutil/modules.py @@ -194,7 +194,10 @@ def configure_module(product, version, product_root, working_dir=None, dev=False module_keywords['needs_ld_lib'] = '' if isdir(join(working_dir, 'pro')): module_keywords['needs_idl'] = '' - if (exists(join(working_dir, 'setup.py')) and isdir(join(working_dir, product))): + if (exists(join(working_dir, 'setup.py')) and + (isdir(join(working_dir, product)) or + isdir(join(working_dir, product.lower()))) + ): if dev: module_keywords['needs_trunk_py'] = '' module_keywords['trunk_py_dir'] = '' From 21fbe6273d199715405168ccd051d0be6a7cbf92 Mon Sep 17 00:00:00 2001 From: Stephen Bailey Date: Thu, 3 Jun 2021 20:00:49 -0700 Subject: [PATCH 2/2] add unit test --- doc/changes.rst | 5 ++++- py/desiutil/test/test_modules.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/doc/changes.rst b/doc/changes.rst index 8362d74c..a011030d 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -5,7 +5,10 @@ Change Log 3.1.3 (unreleased) ------------------ -* No changes yet +* Add module config support for packages like QuasarNP where the GitHub + name is capitalized by the python package isn't (PR `#173`_). + +.. _`#173`: https://github.com/desihub/desiutil/pull/173 3.1.2 (2021-02-15) ------------------ diff --git a/py/desiutil/test/test_modules.py b/py/desiutil/test/test_modules.py index 3b5233bb..4c710f09 100644 --- a/py/desiutil/test/test_modules.py +++ b/py/desiutil/test/test_modules.py @@ -222,6 +222,35 @@ def test_configure_module(self): rmdir(join(self.data_dir, t)) for t in test_files: remove(join(self.data_dir, t)) + # + # Test mixed case product directory (Blat) vs. python package (blat) + # + test_dirs = ('blat',) + test_files = {'setup.py': '#!/usr/bin/env python\n'} + for t in test_dirs: + mkdir(join(self.data_dir, t)) + for t in test_files: + with open(join(self.data_dir, t), 'w') as s: + s.write(test_files[t]) + results['name'] = 'Blat' + results['version'] = '1.2.3' + results['needs_bin'] = '# ' + results['needs_python'] = '' + results['needs_trunk_py'] = '# ' + results['trunk_py_dir'] = '/py' + results['needs_ld_lib'] = '# ' + results['needs_idl'] = '# ' + + conf = configure_module('Blat', '1.2.3', '/my/product/root', + working_dir=self.data_dir) + + for key in results: + self.assertEqual(conf[key], results[key], key) + for t in test_dirs: + rmdir(join(self.data_dir, t)) + for t in test_files: + remove(join(self.data_dir, t)) + def test_process_module(self): """Test processing of module file templates.