Skip to content

Commit

Permalink
Merge 1c709b5 into e0c4f02
Browse files Browse the repository at this point in the history
  • Loading branch information
jacebrowning committed Dec 6, 2019
2 parents e0c4f02 + 1c709b5 commit 8a9dc45
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 121 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,8 @@
# 3.0 (unreleased)

- Removed `versions` in favor of `version` option.
- Removed `|` in favor of `||` for checking multiple versions.

# 2.0.1 (2019-10-13)

- Restore compatibility layer to unofficially support legacy Python.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -45,7 +45,7 @@ DEPENDENCIES := $(VIRTUAL_ENV)/.poetry-$(shell bin/checksum pyproject.toml poetr
install: $(DEPENDENCIES) .cache

$(DEPENDENCIES): poetry.lock
@ poetry config settings.virtualenvs.in-project true || poetry config virtualenvs.in-project true
@ poetry config virtualenvs.in-project true || poetry config settings.virtualenvs.in-project true
poetry install
@ touch $@

Expand Down
2 changes: 1 addition & 1 deletion examples/verchew.ini
Expand Up @@ -6,7 +6,7 @@ version = 1.2
[Newer Working Program]

cli = working-program
versions = 4.1 | 4.2
version = 4.1 || 4.2
message = Version 4.x is required to get the special features.

[Broken Program]
Expand Down
121 changes: 55 additions & 66 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
@@ -1,7 +1,7 @@
[tool.poetry]

name = "verchew"
version = "2.0.1" # also update verchew/script.py
version = "3.0b1" # also update verchew/script.py
description = "System dependency version checker."

license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cli.py
Expand Up @@ -131,7 +131,7 @@ def it_displays_help_information(cli):
def it_displays_version_information(cli):
cmd = cli('--version')

expect(cmd.stdout or cmd.stderr).contains("verchew v2.")
expect(cmd.stdout).startswith("verchew v")
expect(cmd.returncode) == 0


Expand Down
19 changes: 2 additions & 17 deletions verchew/script.py
Expand Up @@ -34,7 +34,6 @@
import os
import re
import sys
import warnings
from collections import OrderedDict
from subprocess import PIPE, STDOUT, Popen
from typing import Any, Dict
Expand All @@ -47,7 +46,7 @@
else:
import configparser # type: ignore

__version__ = '2.0.1'
__version__ = '3.0b1'

CONFIG_FILENAMES = ['verchew.ini', '.verchew.ini', '.verchewrc', '.verchew']

Expand Down Expand Up @@ -197,21 +196,7 @@ def parse_config(path):
data[section][name] = value

for name in data:
if 'versions' in data[name]:
warnings.warn(
"'versions' is deprecated, use 'version' instead", DeprecationWarning
)
version = data[name].pop('versions') or ""
else:
version = data[name].get('version') or ""

if ' | ' in version:
warnings.warn(
"'|' is deprecated, use '||' to separate multiple versions",
DeprecationWarning,
)
version = version.replace(' | ', ' || ')

version = data[name].get('version') or ""
data[name]['version'] = version
data[name]['patterns'] = [v.strip() for v in version.split('||')]

Expand Down
34 changes: 0 additions & 34 deletions verchew/tests/test_script.py
Expand Up @@ -92,40 +92,6 @@ def with_multiple_versions(config):
'Foobar': {'version': '2 || 3 || 4', 'patterns': ['2', '3', '4']}
}

def with_legacy_versions_option(config):
write(
config,
"""
[Foobar]
cli = foobar
versions = v1.2.3
""",
)

expect(parse_config(str(config))) == {
'Foobar': {'cli': 'foobar', 'version': 'v1.2.3', 'patterns': ['v1.2.3']}
}

def with_legacy_versions_separator(config):
write(
config,
"""
[Foobar]
cli = foobar
version = v1.2.3 | v1.2.4
""",
)

expect(parse_config(str(config))) == {
'Foobar': {
'cli': 'foobar',
'version': 'v1.2.3 || v1.2.4',
'patterns': ['v1.2.3', 'v1.2.4'],
}
}


def describe_get_version():
def when_missing():
Expand Down

0 comments on commit 8a9dc45

Please sign in to comment.