Skip to content

Commit

Permalink
feat: Add a --no-frozen option to all commands
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed May 24, 2023
1 parent b051012 commit 2bd3dab
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 6 deletions.
5 changes: 3 additions & 2 deletions docs/changelog.rst
@@ -1,9 +1,10 @@
Changelog
=========

Unreleased
----------
0.2.1 (2023-05-24)
------------------

- feat: Add a ``--no-frozen`` option to all commands.
- Drop Python 3.7 support.

0.2.0 (2022-10-29)
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Expand Up @@ -26,7 +26,7 @@
author = "Open Contracting Partnership"

# The short X.Y version
version = "0.2.0"
version = "0.2.1"
# The full version, including alpha/beta/rc tags
release = version

Expand Down
6 changes: 6 additions & 0 deletions docs/translation.rst
Expand Up @@ -21,6 +21,12 @@ Generate POT files for all versions of all extensions:
ocdsextensionregistry generate-pot-files build/locale
Or, generate POT files for only live versions of extensions:

.. code-block:: bash
ocdsextensionregistry generate-pot-files --no-frozen build/locale
Or, generate POT files for the versions of extensions you want to translate, for example:

.. code-block:: bash
Expand Down
8 changes: 6 additions & 2 deletions ocdsextensionregistry/commands/base.py
Expand Up @@ -10,6 +10,7 @@ def __init__(self, subparsers):
Initializes the subparser and adds arguments.
"""
self.subparser = subparsers.add_parser(self.name, description=self.help)
self.add_argument('--no-frozen', action='store_true', help='exclude frozen versions')
self.add_arguments()

def add_arguments(self):
Expand Down Expand Up @@ -39,6 +40,9 @@ def versions(self):
versions[value]

for version in registry:
if ((not self.args.versions or version.id in versions) and
(not versions[version.id] or version.version in versions[version.id])):
if (
(not self.args.versions or version.id in versions)
and (not versions[version.id] or version.version in versions[version.id])
and (not self.args.no_frozen or not version.date)
):
yield version
2 changes: 1 addition & 1 deletion setup.cfg
@@ -1,6 +1,6 @@
[metadata]
name = ocdsextensionregistry
version = 0.2.0
version = 0.2.1
author = Open Contracting Partnership
author_email = data@open-contracting.org
license = BSD
Expand Down
11 changes: 11 additions & 0 deletions tests/commands/test_download.py
Expand Up @@ -71,6 +71,17 @@ def test_command_versions_invalid(capsys, monkeypatch, tmpdir, caplog):
assert excinfo.value.code == 1


def test_command_versions_no_frozen(capsys, monkeypatch, tmpdir):
monkeypatch.setattr(sys, 'argv', args + ['--no-frozen', str(tmpdir), 'location'])
main()

assert capsys.readouterr().out == ''

tree = list(os.walk(tmpdir))

assert len(tree[1][1]) == 1


# Require the user to decide what to overwrite.
def test_command_repeated(capsys, monkeypatch, tmpdir, caplog):
caplog.set_level(logging.INFO, logger='ocdsextensionregistry')
Expand Down

0 comments on commit 2bd3dab

Please sign in to comment.