Improved install and devel targets in Makefile.
epsi-builds/msspec_python3/pipeline/head This commit looks good Details

This commit is contained in:
Sylvain Tricot 2021-01-12 12:20:13 +01:00
parent 19cd231b21
commit b8876a7632
3 changed files with 28 additions and 18 deletions

View File

@ -24,19 +24,21 @@ pybinding:
@+$(MAKE) -C src pybinding @+$(MAKE) -C src pybinding
install: venv venv:
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 sdist
@+$(MAKE) -C src frontend @+$(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
devel: venv
@+$(MAKE) -C src pybinding devel: VENV_PATH = ./_venv
@+$(MAKE) -C src frontend devel: pybinding venv
@. $(VENV_PATH)/bin/activate && pip install -e src/ @. $(VENV_PATH)/bin/activate && pip install -e src/
venv:
virtualenv --python=$(PYTHON_EXE) --prompt="(msspec-$(VERSION)) " $(VENV_PATH)
. $(VENV_PATH)/bin/activate && pip install --upgrade pip && pip install -r src/pip.freeze
doc: doc:
@echo "Building pdf and html documentation..." @echo "Building pdf and html documentation..."
@ -46,6 +48,7 @@ doc:
@cp "doc/build/latex/MsSpec-python.pdf" "./package/MsSpec-$(VERSION).pdf" @cp "doc/build/latex/MsSpec-python.pdf" "./package/MsSpec-$(VERSION).pdf"
@+$(MAKE) -C doc/ html @+$(MAKE) -C doc/ html
clean:: clean::
@+$(MAKE) -C src/ clean @+$(MAKE) -C src/ clean

View File

@ -3,21 +3,20 @@ include options.mk
.PHONY: sdist frontend pybinding results clean .PHONY: sdist frontend pybinding results clean
foo:
echo $(VERSION)
sdist: dist/msspec-$(VERSION).tar.gz sdist: dist/msspec-$(VERSION).tar.gz
frontend: $(INSTALL_PREFIX)/bin/msspec frontend: $(INSTALL_PREFIX)/bin/msspec
dist/msspec-$(VERSION).tar.gz: pybinding dist/msspec-$(VERSION).tar.gz: VERSION
@echo "Creating Python source distribution..." @echo "Creating Python source distribution..."
@python setup.py sdist @python setup.py sdist
$(INSTALL_PREFIX)/bin/msspec:
@cat msspec.sh.template | sed 's/__VERSION__/$(VERSION)/' > $@ $(INSTALL_PREFIX)/bin/msspec: msspec.sh.template VERSION
@echo "Installing frontend command..."
@cat $< | sed 's/__VERSION__/$(VERSION)/' > $@
@chmod u+x $@ @chmod u+x $@
@ -27,8 +26,10 @@ pybinding:
@+$(MAKE) -C msspec/spec/fortran all @+$(MAKE) -C msspec/spec/fortran all
@echo "$(VERSION)" > VERSION @echo "$(VERSION)" > VERSION
results: msspec/results.txt results: msspec/results.txt
msspec/results.txt: pybinding msspec/results.txt: pybinding
@echo "Generating results for unittests" @echo "Generating results for unittests"
@coverage run --source=./ --omit=msspec/es/*,msspec/msspecgui/* msspec/create_tests_results.py @coverage run --source=./ --omit=msspec/es/*,msspec/msspecgui/* msspec/create_tests_results.py
@ -36,10 +37,12 @@ msspec/results.txt: pybinding
@coverage html -d ../doc/source/htmlcov @coverage html -d ../doc/source/htmlcov
@rm .coverage @rm .coverage
tests: pybinding tests: pybinding
@echo "Runing unittests" @echo "Runing unittests"
@python -m msspec.tests 1>/dev/null @python -m msspec.tests 1>/dev/null
clean:: clean::
@echo "Cleaning all..." @echo "Cleaning all..."
@find ./ -type f -name '*.pyc' -exec rm -f {} + @find ./ -type f -name '*.pyc' -exec rm -f {} +

View File

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
SCRIPT_NAME="$0" SCRIPT_PATH="$0"
SCRIPT_NAME=$(basename "$SCRIPT_PATH")
VERSION="__VERSION__" VERSION="__VERSION__"
VENV_PATH="$HOME/.local/src/msspec_venv_$VERSION" VENV_PATH="$HOME/.local/src/msspec_venv_$VERSION"
@ -30,6 +31,7 @@ show_help () {
echo " virtual environment." echo " virtual environment."
echo " -l Load and display a *.hdf5 data file in a graphical" echo " -l Load and display a *.hdf5 data file in a graphical"
echo " window." echo " window."
echo " -v Print the version."
echo " -h Show this help message." echo " -h Show this help message."
} }
@ -71,14 +73,14 @@ read_yes_no () {
uninstall() { uninstall() {
read_yes_no "This will completely remove msspec from your computer. Are you sure" "n" "$BYPASS" read_yes_no "This will completely remove msspec from your computer. Are you sure" "n" "$BYPASS"
case "${ANSWER}" in case "${ANSWER}" in
y) rm -rv "$VENV_PATH" && rm "$SCRIPT_NAME" && echo "MsSpec successfully uninstalled." ;; y) rm -rv "$VENV_PATH" && rm "$SCRIPT_PATH" && echo "MsSpec successfully uninstalled." ;;
n) echo "Uninstallation aborted." ;; n) echo "Uninstallation aborted." ;;
esac esac
} }
while getopts "hil:p:eu" option; do while getopts "hvil:p:eu" option; do
case $option in case $option in
p) shift; launch_script "$@" p) shift; launch_script "$@"
;; ;;
@ -90,6 +92,8 @@ while getopts "hil:p:eu" option; do
;; ;;
u) uninstall u) uninstall
;; ;;
v) echo $VERSION
;;
*|h) show_help *|h) show_help
;; ;;
esac esac