Skip to content

Commit

Permalink
bug: Fix install from source will lose version information (#1024)
Browse files Browse the repository at this point in the history
* fix

Signed-off-by: Jinjing.Zhou <allenzhou@tensorchord.ai>

* lint

Signed-off-by: Jinjing.Zhou <allenzhou@tensorchord.ai>

* lint

Signed-off-by: Jinjing.Zhou <allenzhou@tensorchord.ai>

* add

Signed-off-by: Jinjing.Zhou <allenzhou@tensorchord.ai>

* fix

Signed-off-by: Jinjing.Zhou <allenzhou@tensorchord.ai>

* fix

Signed-off-by: Jinjing.Zhou <allenzhou@tensorchord.ai>

* fix

Signed-off-by: Jinjing.Zhou <allenzhou@tensorchord.ai>

Signed-off-by: Jinjing.Zhou <allenzhou@tensorchord.ai>
  • Loading branch information
VoVAllen committed Oct 14, 2022
1 parent a58197c commit bcd8029
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,6 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST
.GIT_TAG_INFO

test.tar
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ include Makefile
include .goreleaser.yaml .goreleaser/*.Dockerfile
include pkg/* cmd/*
include go.mod go.sum
include .GIT_TAG_INFO
prune examples
prune docs
prune .github
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ BUILD_DIR := ./build
VERSION ?= $(shell git describe --match 'v[0-9]*' --always --tags --abbrev=0)
BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
GIT_COMMIT=$(shell git rev-parse HEAD)
GIT_TAG=$(shell if [ -z "`git status --porcelain`" ]; then git describe --exact-match --tags HEAD 2>/dev/null; fi)
GIT_TAG ?= $(shell if [ -z "`git status --porcelain`" ]; then git describe --exact-match --tags HEAD 2>/dev/null; fi)
GIT_TREE_STATE=$(shell if [ -z "`git status --porcelain`" ]; then echo "clean" ; else echo "dirty"; fi)
GITSHA ?= $(shell git rev-parse --short HEAD)
GIT_LATEST_TAG ?= $(shell git describe --tags --abbrev=0)
Expand Down Expand Up @@ -110,6 +110,7 @@ build-release:
-X $(ROOT)/pkg/version.gitTag=$(GIT_TAG)" \
$(CMD_DIR)/$${target}; \
done
@[[ ! -z "$(GIT_TAG)" ]] && echo "$(GIT_TAG)" > .GIT_TAG_INFO

help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
Expand Down
10 changes: 9 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,15 @@
def build_envd_if_not_found():
if not os.path.exists("bin/envd"):
logging.info("envd not found. Build from scratch")
errno = subprocess.call(["make", "build-release"])
try:
with open(".GIT_TAG_INFO") as f:
logging.info("Use build_tag from envd._version")
tag = f.read().strip()
errno = subprocess.call(
["make", "build-release", "GIT_TAG={}".format(tag)]
)
except:
errno = subprocess.call(["make", "build-release"])
assert errno == 0, "Failed to build envd"


Expand Down

0 comments on commit bcd8029

Please sign in to comment.