Changes on Makefile to be compatible with Docker.

This commit is contained in:
sylvain tricot 2021-01-22 17:03:53 +01:00
parent 527ad80b03
commit d7f004ebec
3 changed files with 14 additions and 11 deletions

View File

@ -11,7 +11,7 @@ ifndef PYTHON_EXE
$(error Unable to find the $(PYTHON) executable!) $(error Unable to find the $(PYTHON) executable!)
endif endif
ifeq ($(shell python -c "import sys; exit(sys.version_info >= ($(PYMAJ),$(PYMIN)))"; echo $$?),0) ifeq ($(shell $(PYTHON_EXE) -c "import sys; exit(sys.version_info >= ($(PYMAJ),$(PYMIN)))"; echo $$?),0)
$(error Python version >= $(PYMAJ).$(PYMIN) is needed!) $(error Python version >= $(PYMAJ).$(PYMIN) is needed!)
endif endif
@ -19,19 +19,20 @@ endif
.PHONY: pybinding install devel venv doc clean .PHONY: pybinding install devel venv doc clean
pybinding: pybinding: venv
@+$(MAKE) -C src pybinding @+. $(VENV_PATH)/bin/activate && $(MAKE) -C src pybinding
venv: venv:
virtualenv --python=$(PYTHON_EXE) --prompt="(msspec-$(VERSION)) " $(VENV_PATH) @virtualenv --python=$(PYTHON_EXE) --prompt="(msspec-$(VERSION)) " $(VENV_PATH)
. $(VENV_PATH)/bin/activate && pip install --upgrade pip && pip install -r src/pip.freeze @. $(VENV_PATH)/bin/activate && pip install --upgrade pip && pip install -r src/pip.freeze
install: pybinding venv install: pybinding
@+$(MAKE) -C src sdist @+. $(VENV_PATH)/bin/activate && $(MAKE) -C src sdist
@+$(MAKE) -C src frontend @+. $(VENV_PATH)/bin/activate && $(MAKE) -C src frontend
@. $(VENV_PATH)/bin/activate && pip install src/dist/msspec-$(VERSION).tar.gz @+. $(VENV_PATH)/bin/activate && pip install src/dist/msspec-$(VERSION).tar.gz
@echo "Do not forget to check that $(INSTALL_PREFIX)/bin is set in your \$$PATH"
devel: VENV_PATH = ./_venv devel: VENV_PATH = ./_venv

View File

@ -16,7 +16,9 @@ dist/msspec-$(VERSION).tar.gz: VERSION
$(INSTALL_PREFIX)/bin/msspec: msspec.sh.template VERSION $(INSTALL_PREFIX)/bin/msspec: msspec.sh.template VERSION
@echo "Installing frontend command..." @echo "Installing frontend command..."
@cat $< | sed 's/__VERSION__/$(VERSION)/' > $@ @mkdir -p $(dir $@)
@cat $< | sed -e 's/__VERSION__/$(VERSION)/' -e 's#__VENV_PATH__#$(VENV_PATH)#' > $@
#@cat $< | sed 's/__VERSION__/$(VERSION)/' > $@
@chmod u+x $@ @chmod u+x $@

View File

@ -3,7 +3,7 @@
SCRIPT_PATH="$0" SCRIPT_PATH="$0"
SCRIPT_NAME=$(basename "$SCRIPT_PATH") SCRIPT_NAME=$(basename "$SCRIPT_PATH")
VERSION="__VERSION__" VERSION="__VERSION__"
VENV_PATH="$HOME/.local/src/msspec_venv_$VERSION" VENV_PATH="__VENV_PATH__"
# Check venv path # Check venv path
if ! [ -d "$VENV_PATH" ]; then if ! [ -d "$VENV_PATH" ]; then