Skip to content

Commit

Permalink
[Makefile] Add compatibility for pypi version convention (#1774)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tankilevitch committed Feb 23, 2022
1 parent 80a788c commit d1ed8a1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ MLRUN_VERSION ?= unstable
# version for the python package with 0.0.0+
# if the provided version includes a "+" we replace it with "-" for the docker tag
MLRUN_DOCKER_TAG ?= $(shell echo "$(MLRUN_VERSION)" | sed -E 's/\+/\-/g')
MLRUN_PYTHON_PACKAGE_VERSION ?= $(MLRUN_VERSION)
# if the provided version is a semver and followed by a "-" we replace its first occurrence with "+" to align with PEP 404
ifneq ($(shell echo "$(MLRUN_VERSION)" | grep -E "^[0-9]+\.[0-9]+\.[0-9]-.*$$"),)
MLRUN_PYTHON_PACKAGE_VERSION := $(shell echo "$(MLRUN_VERSION)" | sed "s/\-/\+/")
ifneq ($(shell echo "$(MLRUN_VERSION)" | grep -E "^[0-9]+\.[0-9]+\.[0-9]+-" | grep -vE "^[0-9]+\.[0-9]+\.[0-9]+-(a|b|rc)[0-9]+$$"),)
MLRUN_PYTHON_PACKAGE_VERSION ?= $(shell echo "$(MLRUN_VERSION)" | sed "s/\-/\+/")
endif
ifeq ($(shell echo "$(MLRUN_VERSION)" | grep -E "^[0-9]+\.[0-9]+\.[0-9]+.*$$"),) # empty result from egrep
MLRUN_PYTHON_PACKAGE_VERSION := 0.0.0+$(MLRUN_VERSION)
MLRUN_PYTHON_PACKAGE_VERSION ?= 0.0.0+$(MLRUN_VERSION)
endif
MLRUN_PYTHON_PACKAGE_VERSION ?= $(MLRUN_VERSION)
MLRUN_DOCKER_REPO ?= mlrun
# empty by default (dockerhub), can be set to something like "quay.io/".
# This will be used to tag the images built using this makefile
Expand Down Expand Up @@ -68,6 +68,10 @@ help: ## Display available commands
all:
$(error please pick a target)

.PHONY: hedi
hedi:
echo $(MLRUN_VERSION) $(MLRUN_PYTHON_PACKAGE_VERSION)

.PHONY: install-requirements
install-requirements: ## Install all requirements needed for development
python -m pip install --upgrade $(MLRUN_PIP_NO_CACHE_FLAG) pip~=$(MLRUN_PIP_VERSION)
Expand Down

0 comments on commit d1ed8a1

Please sign in to comment.