diff --git a/openstack_releases/npmutils.py b/openstack_releases/npmutils.py index 4f38426510..701345ae8e 100644 --- a/openstack_releases/npmutils.py +++ b/openstack_releases/npmutils.py @@ -18,6 +18,8 @@ import os.path def looks_like_a_module(workdir, repo): "Does the directory look like it contains an npm module?" + if os.path.exists(os.path.join(workdir, repo, 'setup.py')): + return False return os.path.exists(os.path.join(workdir, repo, 'package.json')) diff --git a/openstack_releases/puppetutils.py b/openstack_releases/puppetutils.py index a319e83bf0..f9957e7ca0 100644 --- a/openstack_releases/puppetutils.py +++ b/openstack_releases/puppetutils.py @@ -18,6 +18,8 @@ import os.path def looks_like_a_module(workdir, repo): "Does the directory look like it contains a puppet module?" + if os.path.exists(os.path.join(workdir, repo, 'setup.py')): + return False if not os.path.exists(os.path.join(workdir, repo, 'metadata.json')): return False return any([ diff --git a/openstack_releases/tests/test_npmutils.py b/openstack_releases/tests/test_npmutils.py index 07f50c4b23..1bb74c0459 100644 --- a/openstack_releases/tests/test_npmutils.py +++ b/openstack_releases/tests/test_npmutils.py @@ -48,6 +48,19 @@ class TestModuleDetection(base.BaseTestCase): '.', 'openstack/monasca-kibana-plugin') self.assertTrue(is_mod) + def test_actually_python(self): + + def exists(name): + if name.endswith('package.json'): + return True + if name.endswith('setup.py'): + return True + + with mock.patch('os.path.exists', exists): + is_mod = npmutils.looks_like_a_module( + '.', 'openstack/monasca-kibana-plugin') + self.assertFalse(is_mod) + class TestGetMetadata(base.BaseTestCase): diff --git a/openstack_releases/tests/test_puppetutils.py b/openstack_releases/tests/test_puppetutils.py index 78a9b76ced..11d58d30db 100644 --- a/openstack_releases/tests/test_puppetutils.py +++ b/openstack_releases/tests/test_puppetutils.py @@ -77,6 +77,22 @@ class TestModuleDetection(base.BaseTestCase): '.', 'openstack/puppet-watcher') self.assertTrue(is_mod) + def test_actually_python(self): + + def exists(name): + if name.endswith('setup.py'): + return True + if name.endswith('metadata.json'): + return True + if name.endswith('manifests'): + return True + return False + + with mock.patch('os.path.exists', exists): + is_mod = puppetutils.looks_like_a_module( + '.', 'openstack/puppet-watcher') + self.assertFalse(is_mod) + class TestGetMetadata(base.BaseTestCase):