diff --git a/Makefile b/Makefile index 20c8044..aabbbd9 100644 --- a/Makefile +++ b/Makefile @@ -24,19 +24,21 @@ 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 frontend @. $(VENV_PATH)/bin/activate && pip install src/dist/msspec-$(VERSION).tar.gz -devel: venv - @+$(MAKE) -C src pybinding - @+$(MAKE) -C src frontend + +devel: VENV_PATH = ./_venv +devel: pybinding venv @. $(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: @echo "Building pdf and html documentation..." @@ -46,6 +48,7 @@ doc: @cp "doc/build/latex/MsSpec-python.pdf" "./package/MsSpec-$(VERSION).pdf" @+$(MAKE) -C doc/ html + clean:: @+$(MAKE) -C src/ clean diff --git a/src/Makefile b/src/Makefile index 7091a4a..d2dda44 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,23 +1,22 @@ include options.mk -.PHONY: sdist frontend pybinding results clean +.PHONY: sdist frontend pybinding results clean -foo: - echo $(VERSION) - sdist: dist/msspec-$(VERSION).tar.gz - + frontend: $(INSTALL_PREFIX)/bin/msspec -dist/msspec-$(VERSION).tar.gz: pybinding +dist/msspec-$(VERSION).tar.gz: VERSION @echo "Creating Python source distribution..." @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 $@ @@ -27,8 +26,10 @@ pybinding: @+$(MAKE) -C msspec/spec/fortran all @echo "$(VERSION)" > VERSION + results: msspec/results.txt + msspec/results.txt: pybinding @echo "Generating results for unittests" @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 @rm .coverage + tests: pybinding @echo "Runing unittests" @python -m msspec.tests 1>/dev/null + clean:: @echo "Cleaning all..." @find ./ -type f -name '*.pyc' -exec rm -f {} + diff --git a/src/msspec.sh.template b/src/msspec.sh.template index 153d924..b6cc2ea 100644 --- a/src/msspec.sh.template +++ b/src/msspec.sh.template @@ -1,6 +1,7 @@ #!/bin/bash -SCRIPT_NAME="$0" +SCRIPT_PATH="$0" +SCRIPT_NAME=$(basename "$SCRIPT_PATH") VERSION="__VERSION__" VENV_PATH="$HOME/.local/src/msspec_venv_$VERSION" @@ -30,6 +31,7 @@ show_help () { echo " virtual environment." echo " -l Load and display a *.hdf5 data file in a graphical" echo " window." + echo " -v Print the version." echo " -h Show this help message." } @@ -71,14 +73,14 @@ read_yes_no () { uninstall() { read_yes_no "This will completely remove msspec from your computer. Are you sure" "n" "$BYPASS" 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." ;; esac } -while getopts "hil:p:eu" option; do +while getopts "hvil:p:eu" option; do case $option in p) shift; launch_script "$@" ;; @@ -90,6 +92,8 @@ while getopts "hil:p:eu" option; do ;; u) uninstall ;; + v) echo $VERSION + ;; *|h) show_help ;; esac