Skip to content

Commit ccb6117

Browse files
authored
Merge pull request #90 from jacebrowning/handle-no-output
Fix handling of programs with no output
2 parents 345a3cf + 49ddc6d commit ccb6117

File tree

6 files changed

+18
-9
lines changed

6 files changed

+18
-9
lines changed

.vscode/settings.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"DIRENV",
44
"printenv",
55
"pyenv",
6-
"USERPROFILE"
6+
"USERPROFILE",
7+
"verchewrc"
78
]
89
}

CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Release Notes
22

3+
## 3.4.1 (2022-06-13)
4+
5+
- Fixed handling of programs with no output.
6+
7+
## 3.4 (2023-06-03)
8+
9+
- Added support for matching version not in the first line of output.
10+
311
## 3.3 (2022-04-18)
412

513
- Added a `verchew-wrapper` alongside the vendored script to support systems not following [PEP 394](https://peps.python.org/pep-0394/).

Makefile

+2-5
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ VIRTUAL_ENV ?= .venv
1414
# MAIN TASKS ##################################################################
1515

1616
.PHONY: all
17-
all: install
18-
19-
.PHONY: ci
20-
ci: format check test mkdocs ## Run all tasks that determine CI status
17+
all: format check test mkdocs ## Run all tasks that determine CI status
2118

2219
.PHONY: dev
2320
dev: install .clean-test ## Continuously run all CI tasks when files chanage
@@ -204,7 +201,7 @@ clean-all: clean
204201
# HELP ########################################################################
205202

206203
.PHONY: help
207-
help: all
204+
help: install
208205
@ grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
209206

210207
.DEFAULT_GOAL := help

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tool.poetry]
22

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

77
license = "MIT"

verchew/script.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
import configparser
4848
from urllib.request import urlretrieve
4949

50-
__version__ = '3.4'
50+
__version__ = '3.4.1'
5151

5252
SCRIPT_URL = (
5353
"https://raw.githubusercontent.com/jacebrowning/verchew/main/verchew/script.py"
@@ -311,7 +311,7 @@ def get_version(program, argument=None):
311311

312312
def match_version(pattern, output):
313313
lines = output.splitlines()
314-
if "not found" in lines[0]:
314+
if not lines or "not found" in lines[0]:
315315
return False
316316

317317
regex = pattern.replace('.', r'\.') + r'(\b|/)'

verchew/tests/test_script.py

+3
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ def when_mismatch_with_missing_program():
212212
def when_match_with_multiple_lines():
213213
expect(match_version("1.2", "Foobar\nVersion 1.2.3")) == True
214214

215+
def when_mismatch_with_no_output():
216+
expect(match_version("1.2.3", "")) == False
217+
215218

216219
def describe_format():
217220
def default():

0 commit comments

Comments
 (0)