diff --git a/doc/changes.rst b/doc/changes.rst index ef3bf1d..0fc8189 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -5,7 +5,10 @@ Change Log 3.2.2 (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.2.1 (2021-05-13) ------------------ diff --git a/py/desiutil/modules.py b/py/desiutil/modules.py index 33a2ca9..4accae3 100644 --- a/py/desiutil/modules.py +++ b/py/desiutil/modules.py @@ -199,7 +199,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'] = '' diff --git a/py/desiutil/test/test_modules.py b/py/desiutil/test/test_modules.py index 3b5233b..4c710f0 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.