Skip to content

Commit 464a024

Browse files
committed
fixed version sorting bug in makefile
1 parent 826bc4d commit 464a024

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Makefile

+5-4
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ publish: distclean version package test
3535

3636
$(generatedcode): dist/$(sdistname)*.tar.gz
3737

38-
docs: latest := $(shell git tag | sort -r | head -n 1)
38+
docs: latest := $(shell git tag | sort -t. -k 1,1nr -k 2,2nr -k 3,3nr -k 4,4nr | head -n 1)
3939
docs: VERSION $(generatedcode)
4040
rm -rf docs
4141
pip install --upgrade -r requirements.txt
@@ -83,8 +83,9 @@ increase_dev = $(call macro,$(1)).$(call micro,$(1)).$(call patch,$(1)).dev$$(($
8383
devversion: VERSION.dev VERSION; cat VERSION
8484
version: VERSION; cat VERSION
8585

86-
VERSION.dev: devver := $(shell curl --silent "https://api.github.com/repos/clamsproject/mmif-python/git/refs/tags" | grep '"ref":' | sed -E 's/.+refs\/tags\/([0-9.]+)",/\1/g' | sort | tail -n 1)
87-
VERSION.dev: specver := $(shell curl --silent "https://api.github.com/repos/clamsproject/mmif/git/refs/tags" | grep '"ref":' | grep -v 'py-' | sed -E 's/.+refs\/tags\/(spec-)?([0-9.]+)",/\2/g' | sort | tail -n 1)
86+
# since the GH api will return tags in chronological order, we can just grab the last one without sorting
87+
VERSION.dev: devver := $(shell curl --silent "https://api.github.com/repos/clamsproject/mmif-python/git/refs/tags" | grep '"ref":' | sed -E 's/.+refs\/tags\/([0-9.]+)",/\1/g' | tail -n 1)
88+
VERSION.dev: specver := $(shell curl --silent "https://api.github.com/repos/clamsproject/mmif/git/refs/tags" | grep '"ref":' | grep -v 'py-' | sed -E 's/.+refs\/tags\/(spec-)?([0-9.]+)",/\2/g' | tail -n 1)
8889
VERSION.dev:
8990
@echo DEVVER: $(devver)
9091
@echo SPECVER: $(specver)
@@ -94,7 +95,7 @@ VERSION.dev:
9495
else echo $(call add_dev,$(specver)) ; fi \
9596
> VERSION.dev
9697

97-
VERSION: version := $(shell git tag | sort -r | head -n 1)
98+
VERSION: version := $(shell git tag | sort -t. -k 1,1nr -k 2,2nr -k 3,3nr -k 4,4nr | head -n 1)
9899
VERSION:
99100
@if [ -e VERSION.dev ] ; \
100101
then cp VERSION.dev VERSION; \

0 commit comments

Comments
 (0)