Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support github vs. python product capitalization differences #173

Merged
merged 3 commits into from
Jun 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion doc/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
------------------
Expand Down
5 changes: 4 additions & 1 deletion py/desiutil/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I mentioned in #172, these are not the only possible combinations. This change also needs to be applied to the case where the package lives in a py/ directory. Finally, we need unit tests for all of these cases.

):
if dev:
module_keywords['needs_trunk_py'] = ''
module_keywords['trunk_py_dir'] = ''
Expand Down
29 changes: 29 additions & 0 deletions py/desiutil/test/test_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down