From d7f004ebec76c52ff501c315d2dba8d819e24e05 Mon Sep 17 00:00:00 2001 From: sylvain tricot Date: Fri, 22 Jan 2021 17:03:53 +0100 Subject: [PATCH] Changes on Makefile to be compatible with Docker. --- Makefile | 19 ++++++++++--------- src/Makefile | 4 +++- src/msspec.sh.template | 2 +- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 7767837..b96333b 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ ifndef PYTHON_EXE $(error Unable to find the $(PYTHON) executable!) 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!) endif @@ -19,19 +19,20 @@ endif .PHONY: pybinding install devel venv doc clean -pybinding: - @+$(MAKE) -C src pybinding +pybinding: venv + @+. $(VENV_PATH)/bin/activate && $(MAKE) -C src pybinding venv: - virtualenv --python=$(PYTHON_EXE) --prompt="(msspec-$(VERSION)) " $(VENV_PATH) - . $(VENV_PATH)/bin/activate && pip install --upgrade pip && pip install -r src/pip.freeze + @virtualenv --python=$(PYTHON_EXE) --prompt="(msspec-$(VERSION)) " $(VENV_PATH) + @. $(VENV_PATH)/bin/activate && pip install --upgrade pip && pip install -r src/pip.freeze -install: pybinding venv - @+$(MAKE) -C src sdist - @+$(MAKE) -C src frontend - @. $(VENV_PATH)/bin/activate && pip install src/dist/msspec-$(VERSION).tar.gz +install: pybinding + @+. $(VENV_PATH)/bin/activate && $(MAKE) -C src sdist + @+. $(VENV_PATH)/bin/activate && $(MAKE) -C src frontend + @+. $(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 diff --git a/src/Makefile b/src/Makefile index 3b2f40b..1e727c8 100644 --- a/src/Makefile +++ b/src/Makefile @@ -16,7 +16,9 @@ dist/msspec-$(VERSION).tar.gz: VERSION $(INSTALL_PREFIX)/bin/msspec: msspec.sh.template VERSION @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 $@ diff --git a/src/msspec.sh.template b/src/msspec.sh.template index b6cc2ea..22ef574 100644 --- a/src/msspec.sh.template +++ b/src/msspec.sh.template @@ -3,7 +3,7 @@ SCRIPT_PATH="$0" SCRIPT_NAME=$(basename "$SCRIPT_PATH") VERSION="__VERSION__" -VENV_PATH="$HOME/.local/src/msspec_venv_$VERSION" +VENV_PATH="__VENV_PATH__" # Check venv path if ! [ -d "$VENV_PATH" ]; then