Skip to content

Commit

Permalink
adjust module_file command
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverba137 committed Apr 7, 2023
1 parent 7098eeb commit a60d792
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
19 changes: 10 additions & 9 deletions py/desiutil/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def finalize_options(self):
pass

def run(self):
self.announce("This functionality is deprecated and will be removed from a future version of desiutil.", level=WARN)
self.announce("Use the command-line script desi_api_file instead.", level=WARN)
self.announce("WARNING: This functionality is deprecated and will be removed from a future version of desiutil.", level=WARN)
self.announce("WARNING: Use the command-line script desi_api_file instead.", level=WARN)
n = self.distribution.metadata.get_name()
productroot = find_version_directory(n)
modules = []
Expand Down Expand Up @@ -123,14 +123,15 @@ def finalize_options(self):
exit(1)

def run(self):
self.announce("This functionality is deprecated and will be removed from a future version of desiutil.", level=WARN)
self.announce("Use the command-line script desi_module_file instead.", level=WARN)
self.announce("WARNING: This functionality is deprecated and will be removed from a future version of desiutil.", level=WARN)
self.announce("WARNING: Use the command-line script desi_module_file instead.", level=WARN)
meta = self.distribution.metadata
name = meta.get_name()
version = meta.get_version()
dev = 'dev' in version
working_dir = os.path.abspath('.')
module_keywords = configure_module(name, version, dev=dev)
product_root = os.path.join(os.path.dirname(self.modules), 'code')
module_keywords = configure_module(name, version, product_root, dev=dev)
module_file = os.path.join(working_dir, 'etc', '{0}.module'.format(name))
if os.path.exists(module_file):
process_module(module_file, module_keywords, self.modules)
Expand Down Expand Up @@ -175,8 +176,8 @@ def run_tests(self):
# Purge modules under test from sys.modules. The test loader will
# re-import them from the build location. Required when 2to3 is used
# with namespace packages.
self.announce("This functionality is deprecated and will be removed from a future version of desiutil.", level=WARN)
self.announce("Use pytest or pytest --cov (for test coverage) instead.", level=WARN)
self.announce("WARNING: This functionality is deprecated and will be removed from a future version of desiutil.", level=WARN)
self.announce("WARNING: Use pytest or pytest --cov (for test coverage) instead.", level=WARN)
if getattr(self.distribution, 'use_2to3', False):
module = self.test_args[-1].split('.')[0]
if module in _namespace_packages:
Expand Down Expand Up @@ -230,8 +231,8 @@ def finalize_options(self):
pass

def run(self):
self.announce("This functionality is deprecated and will be removed from a future version of desiutil.", level=WARN)
self.announce("Use the command-line script desi_update_version instead.", level=WARN)
self.announce("WARNING: This functionality is deprecated and will be removed from a future version of desiutil.", level=WARN)
self.announce("WARNING: Use the command-line script desi_update_version instead.", level=WARN)
meta = self.distribution.metadata
update_version(meta.get_name(), tag=self.tag)
ver = get_version(meta.get_name())
Expand Down
8 changes: 4 additions & 4 deletions py/desiutil/test/test_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ def test_version(self):
self.run_setup('setup.py', ['version'])
self.assertTrue(os.path.exists(v_file))
self.assertListEqual(mock_announce.mock_calls,
[call('This functionality is deprecated and will be removed from a future version of desiutil.', level=WARN),
call('Use the command-line script desi_update_version instead.', level=WARN),
[call('WARNING: This functionality is deprecated and will be removed from a future version of desiutil.', level=WARN),
call('WARNING: Use the command-line script desi_update_version instead.', level=WARN),
call('Version is now 0.0.1.dev0.', level=INFO)])
self.assertListEqual(mock_info.mock_calls, [call('running %s', 'version')])
with patch('distutils.cmd.Command.announce') as mock_announce:
Expand All @@ -103,8 +103,8 @@ def test_version(self):
data = v.read()
self.assertEqual(data, "__version__ = '1.2.3'\n")
self.assertListEqual(mock_announce.mock_calls,
[call('This functionality is deprecated and will be removed from a future version of desiutil.', level=WARN),
call('Use the command-line script desi_update_version instead.', level=WARN),
[call('WARNING: This functionality is deprecated and will be removed from a future version of desiutil.', level=WARN),
call('WARNING: Use the command-line script desi_update_version instead.', level=WARN),
call('Version is now 1.2.3.', level=INFO)])
self.assertListEqual(mock_info.mock_calls, [call('running %s', 'version')])

Expand Down

0 comments on commit a60d792

Please sign in to comment.