Work on topmost Makefile (unittests and install targets)
epsi-builds/msspec_python3/pipeline/head This commit looks good Details

Just began to rewrite the topmost Makefile which will provide
targets for:
  * runing the tests
  * creating the Python venv
  * building and installing the code
  * building the manual and the website

Makefiles in subfolder were also upgraded to fix some issues in
target filenames.
This commit is contained in:
Sylvain Tricot 2020-11-30 16:39:29 +01:00
parent d7b6ca5b84
commit 50219b9f45
7 changed files with 48 additions and 82 deletions

View File

@ -1,78 +1,28 @@
MAKESELF:=makeself include src/options.mk
VERSION:=$(shell git describe|sed 's/-\([[:digit:]]\+\)-.*/\.post\1/')
SETUPFILE:=MsSpec-$(VERSION).setup
PYTHON = python
VERBOSE:=0 # Checking Python version
ifeq ($(VERBOSE),0) PYTHON_EXE := $(shell command -v $(PYTHON) 2> /dev/null)
SUPPRESS_OUPUT:=1>/dev/null 2>/dev/null
MAKEFLAGS += --no-print-directory ifndef PYTHON_EXE
else $(error Unable to find the $(PYTHON) executable!)
SUPPRESS_OUPUT:= endif
PYTHON_VERSION_MAJOR := $(shell $(PYTHON_EXE) --version 2>&1 | cut -d" " -f2 | cut -d. -f1)
PYTHON_VERSION_MINOR := $(shell $(PYTHON_EXE) --version 2>&1 | cut -d" " -f2 | cut -d. -f2)
ifneq ($(shell test $(PYTHON_VERSION_MAJOR) -ge 3 -a $(PYTHON_VERSION_MINOR) -ge 6; echo $$?),0)
$(error Python version >= 3.6 is needed!)
endif endif
.PHONY: clean version selfex venv doc .PHONY: venv doc
selfex: results
@echo "Creating the self-extractible setup program... "
# copy the src folder and purge it
@cp -r src src_
@+$(MAKE) -C ./src_ purge
# update the version
@echo "$(VERSION)" > ./src_/VERSION
# distribute the README.md file
@cp README.md ./src_/
# create the package folder
@mkdir -p package
# create the *.lsm file
@echo "Begin4" > msspec.lsm
@echo "Title: Python MsSpec" >> msspec.lsm
@echo "Version: $(VERSION)" >> msspec.lsm
@echo "Entered-date: `date +%Y-%m-%d`" >> msspec.lsm
@echo "Description: A multiple scattering package for spectroscopies using electrons to probe materials" >> msspec.lsm
@echo "Keywords: " >> msspec.lsm
@echo "Author: sylvain.tricot@univ-rennes1.fr (Sylvain Tricot), didier.sebilleau@univ-rennes1.fr (Didier Sébilleau)" >> msspec.lsm
@echo "Maintained-by: sylvain.tricot@univ-rennes1.fr (Sylvain Tricot)" >> msspec.lsm
@echo "Primary-site: https://msspec.cnrs.fr" >> msspec.lsm
@echo "Alternate-site:" >> msspec.lsm
@echo "Original-site:" >> msspec.lsm
@echo "Platforms:" >> msspec.lsm
@echo "Copying-policy: Gnu Library General Public License (GLPL) 2.0" >> msspec.lsm
@echo "End" >> msspec.lsm
# create the self-extractible archive
@$(MAKESELF) --license "./license.txt" --lsm ./msspec.lsm ./src_ package/$(SETUPFILE) "Python MsSpec" ./install.sh $(SUPPRESS_OUPUT)
# remove *.lsm file and src_
@rm ./msspec.lsm
@rm -rf ./src_
version:
@python ./CI/update_version.py
clean:
@echo "Cleaning all..."
@find ./src -type f -name '*.pyc' -exec rm -f {} +
@find ./src -type d -name '__pycache__' -exec rm -rf {} +
@rm -rf src/dist
@rm -rf src/*.egg*
@+$(MAKE) -C src/ clean $(SUPPRESS_OUPUT)
@+$(MAKE) -C doc/ clean $(SUPPRESS_OUPUT)
@rm -rf package
purge: clean
@echo "Removing also shared objects..."
@find ./src -type f -name '*.so' -exec rm -f {} +
results:
@+$(MAKE) -C src results
venv: venv:
@virtualenv --python=python3 --system-site-packages ci_venv $(SUPPRESS_OUPUT) virtualenv --python=python$(PYTHON_VERSION_MAJOR).$(PYTHON_VERSION_MINOR) --system-site-packages --prompt="(msspec-$(VERSION)) " venv
@. "./ci_venv/bin/activate" && pip install --upgrade pip && pip install --upgrade -r requirements.txt $(SUPPRESS_OUPUT) . ./venv/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..."

View File

@ -20,7 +20,7 @@ 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 {} +
@find ./ -type d -name '__pycache__' -exec rm -rf {} + @find ./ -type d -name '__pycache__' -exec rm -rf {} +

View File

@ -17,7 +17,7 @@ eig_pw:
comp_curve: comp_curve:
@+$(MAKE) -f comp_curve.mk all @+$(MAKE) -f comp_curve.mk all
clean: clean::
@+$(MAKE) -f phd_se_noso_nosp_nosym.mk $@ @+$(MAKE) -f phd_se_noso_nosp_nosym.mk $@
@+$(MAKE) -f phd_mi_noso_nosp_nosym.mk $@ @+$(MAKE) -f phd_mi_noso_nosp_nosym.mk $@
@+$(MAKE) -f eig_mi.mk $@ @+$(MAKE) -f eig_mi.mk $@

View File

@ -1,5 +1,5 @@
SRCS = treatment/comp_curves.f SRCS = treatment/comp_curves.f
MAIN_F = treatment/main.f MAIN_F = treatment/main.f
SO = comp_curves.so SO = _comp_curves.so
include ../../../options.mk include ../../../options.mk

View File

@ -7,6 +7,6 @@ eig_mi_src := $(wildcard eig/mi/*.f)
SRCS = $(memalloc_src) $(cluster_gen_src) $(common_sub_src) $(renormalization_src) $(eig_mi_src) SRCS = $(memalloc_src) $(cluster_gen_src) $(common_sub_src) $(renormalization_src) $(eig_mi_src)
MAIN_F = eig/mi/main.f MAIN_F = eig/mi/main.f
SO = _eig_pw.so SO = _eig_mi.so
include ../../../options.mk include ../../../options.mk

View File

@ -35,7 +35,8 @@ F2PYFLAGS_DBG = --debug-capi --debug
# /!\ DO NOT EDIT BELOW THAT LINE (unlesss you know what you're doing...) # # /!\ DO NOT EDIT BELOW THAT LINE (unlesss you know what you're doing...) #
# CORE CONFIGURATION # # CORE CONFIGURATION #
################################################################################ ################################################################################
VERSION:=$(shell python -c "import msspec; print(msspec.__version__)") #VERSION:=$(shell python -c "import msspec; print(msspec.__version__)")
VERSION:=$(shell git describe|sed 's/-\([[:digit:]]\+\)-.*/\.post\1/')
ifeq ($(VERBOSE),0) ifeq ($(VERBOSE),0)
OUPUT_REDIRECTION := 1>/dev/null 2>/dev/null OUPUT_REDIRECTION := 1>/dev/null 2>/dev/null
@ -64,12 +65,13 @@ FFLAGS = $($(PREFIX)_FFLAGS$(SUFFIX))
OBJS = $(addprefix $(BUILDDIR)/, $(patsubst %.f,%.o, $(filter-out $(MAIN_F), $(SRCS)))) OBJS = $(addprefix $(BUILDDIR)/, $(patsubst %.f,%.o, $(filter-out $(MAIN_F), $(SRCS))))
.PHONY: clean obj all compilation_info .PHONY: clean obj all info
compilation_info: info:
@echo "Compiler used: $(FC)" @echo "Compilation information for msspec $(VERSION)"
@echo "fortran flags: $(FFLAGS)" @echo "FC : $(FC)"
@echo "f2py flags: $(FFLAGS)" @echo "FFLAGS:"
@for flag in $(FFLAGS); do echo "\t$$flag"; done
all: $(SO) all: $(SO)
@ -78,10 +80,24 @@ all: $(SO)
obj: $(OBJS) obj: $(OBJS)
clean: clean::
@echo "Cleaning..." @for objfile in $(OBJS); do \
rm -rf $(BUILDDIR) if test -f $$objfile; then \
rm -rf $(SO) echo "Removing $$objfile..."; \
rm $$objfile; \
fi;\
done
@if test -d $(abspath $(BUILDDIR)); then \
if test `find $(abspath $(BUILDDIR)) -type f|wc -l` -eq 0; then \
echo "Removing empty folder $(abspath $(BUILDDIR))..."; \
rm -r $(abspath $(BUILDDIR)); \
fi; \
fi
@if test x$(SO) != x; then \
if test -f $(SO); then \
echo "Removing $(SO)..."; rm $(SO); \
fi; \
fi
$(BUILDDIR)/%.o: %.f $(BUILDDIR)/%.o: %.f

View File

@ -54,4 +54,4 @@ traitlets==4.3.3
urllib3==1.25.8 urllib3==1.25.8
wcwidth==0.1.9 wcwidth==0.1.9
wheel==0.34.2 wheel==0.34.2
wxPython@https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04/wxPython-4.0.7.post2-cp36-cp36m-linux_x86_64.whl #wxPython@https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-18.04/wxPython-4.0.7.post2-cp36-cp36m-linux_x86_64.whl