Skip to content

Commit cf535d4

Browse files
committed
Makefile: extract regexp to a variable
1 parent b2f4c1f commit cf535d4

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,17 @@ dist.tar: dist
6666
dist:
6767
pipenv run python setup.py bdist_wheel
6868

69+
RE_SEMVER = [0-9]+.[0-9]+.[0-9]+(-[a-z0-9]+)?
70+
6971
.PHONY: bump-version
7072
bump-version:
7173
ifndef V
7274
$(error V is not defined)
7375
endif
74-
sed -E -i 's/__version__ = "[0-9]+.[0-9]+.[0-9]+"/__version__ = "$(V)"/g' src/enapter/__init__.py
76+
sed -E -i 's/__version__ = "$(RE_SEMVER)"/__version__ = "$(V)"/g' src/enapter/__init__.py
7577

76-
grep -E --files-with-matches --recursive 'enapter==[0-9]+.[0-9]+.[0-9]+' README.md examples \
77-
| xargs -n 1 sed -E -i 's/enapter==[0-9]+.[0-9]+.[0-9]+/enapter==$(V)/g'
78+
grep -E --files-with-matches --recursive "enapter==$(RE_SEMVER)" README.md examples \
79+
| xargs -n 1 sed -E -i "s/enapter==$(RE_SEMVER)/enapter==$(V)/g"
7880

7981
DOCKER_IMAGE_TAG ?= latest
8082

0 commit comments

Comments
 (0)