Skip to content

Commit a0900b7

Browse files
authored
Merge pull request #65 from jacebrowning/release/v3.0
Release v3.0
2 parents 799cd52 + 8b47f22 commit a0900b7

File tree

11 files changed

+90
-129
lines changed

11 files changed

+90
-129
lines changed

.python-version

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
3.7.5
2+
2.7.14

.verchew.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ version = Python 3
1616
[Poetry]
1717

1818
cli = poetry
19-
version = 0.12
19+
version = 1.0 || 0.12
2020

2121
[Graphviz]
2222

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 3.0 (2019-12-07)
2+
3+
- Removed `versions` in favor of `version` option.
4+
- Removed `|` in favor of `||` for checking multiple versions.
5+
- Added support for matching **any** version when `version` is not specified.
6+
17
# 2.0.1 (2019-10-13)
28

39
- Restore compatibility layer to unofficially support legacy Python.

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ run: install
2828
poetry run python $(PACKAGE)/__main__.py
2929

3030
.PHONY: demo ## Run the example
31-
demo: install
32-
make doctor -C examples
31+
demo:
32+
cd examples && make doctor
3333

3434
# SYSTEM DEPENDENCIES ##########################################################
3535

@@ -45,13 +45,15 @@ DEPENDENCIES := $(VIRTUAL_ENV)/.poetry-$(shell bin/checksum pyproject.toml poetr
4545
install: $(DEPENDENCIES) .cache
4646

4747
$(DEPENDENCIES): poetry.lock
48-
@ poetry config settings.virtualenvs.in-project true || poetry config virtualenvs.in-project true
48+
@ poetry config virtualenvs.in-project true || poetry config settings.virtualenvs.in-project true
4949
poetry install
5050
@ touch $@
5151

52+
ifndef CI
5253
poetry.lock: pyproject.toml
5354
poetry lock
5455
@ touch $@
56+
endif
5557

5658
.cache:
5759
@ mkdir -p .cache

examples/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ all: doctor
55
doctor:
66
@ echo
77
@ echo "$$ verchew"
8-
@ PATH=bin:$(PATH) ../verchew/script.py
8+
@ ../verchew/script.py

examples/verchew.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ version = 1.2
66
[Newer Working Program]
77

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

1212
[Broken Program]

poetry.lock

Lines changed: 55 additions & 66 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tool.poetry]
22

33
name = "verchew"
4-
version = "2.0.1" # also update verchew/script.py
4+
version = "3.0" # also update verchew/script.py
55
description = "System dependency version checker."
66

77
license = "MIT"

tests/test_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def it_displays_help_information(cli):
131131
def it_displays_version_information(cli):
132132
cmd = cli('--version')
133133

134-
expect(cmd.stdout or cmd.stderr).contains("verchew v2.")
134+
expect(cmd.stdout).startswith("verchew v")
135135
expect(cmd.returncode) == 0
136136

137137

verchew/script.py

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import os
3535
import re
3636
import sys
37-
import warnings
3837
from collections import OrderedDict
3938
from subprocess import PIPE, STDOUT, Popen
4039
from typing import Any, Dict
@@ -43,11 +42,11 @@
4342
PY2 = sys.version_info[0] == 2
4443

4544
if PY2:
46-
import ConfigParser as configparser
45+
import ConfigParser as configparser # pylint: disable=import-error
4746
else:
4847
import configparser # type: ignore
4948

50-
__version__ = '2.0.1'
49+
__version__ = '3.0'
5150

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

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

199198
for name in data:
200-
if 'versions' in data[name]:
201-
warnings.warn(
202-
"'versions' is deprecated, use 'version' instead", DeprecationWarning
203-
)
204-
version = data[name].pop('versions') or ""
205-
else:
206-
version = data[name].get('version') or ""
207-
208-
if ' | ' in version:
209-
warnings.warn(
210-
"'|' is deprecated, use '||' to separate multiple versions",
211-
DeprecationWarning,
212-
)
213-
version = version.replace(' | ', ' || ')
214-
199+
version = data[name].get('version') or ""
215200
data[name]['version'] = version
216201
data[name]['patterns'] = [v.strip() for v in version.split('||')]
217202

@@ -227,7 +212,7 @@ def check_dependencies(config):
227212

228213
for pattern in settings['patterns']:
229214
if match_version(pattern, output):
230-
show(_("~") + " MATCHED: {0}".format(pattern))
215+
show(_("~") + " MATCHED: {0}".format(pattern or "<anything>"))
231216
success.append(_("~"))
232217
break
233218
else:
@@ -237,9 +222,14 @@ def check_dependencies(config):
237222
else:
238223
if QUIET:
239224
print(
240-
"Unmatched {0} version: {1}".format(name, settings['version'])
225+
"Unmatched {0} version: {1}".format(
226+
name, settings['version'] or "<anything>"
227+
)
241228
)
242-
show(_("x") + " EXPECTED: {0}".format(settings['version']))
229+
show(
230+
_("x")
231+
+ " EXPECTED: {0}".format(settings['version'] or "<anything>")
232+
)
243233
success.append(_("x"))
244234
if settings.get('message'):
245235
show(_("*") + " MESSAGE: {0}".format(settings['message']))
@@ -266,6 +256,9 @@ def get_version(program, argument=None):
266256

267257

268258
def match_version(pattern, output):
259+
if "not found" in output:
260+
return False
261+
269262
regex = pattern.replace('.', r'\.') + r'(\b|/)'
270263

271264
log.debug("Matching %s: %s", regex, output)

0 commit comments

Comments
 (0)