From c22f86fe76746431f0b6756b77f21ee9e370b4ec Mon Sep 17 00:00:00 2001 From: Sylvain Tricot Date: Fri, 6 Dec 2019 13:26:22 +0100 Subject: [PATCH] Fix bug in install process. The *.so are now in the fortran folders, so the MANIFEST.in file was updated to include those shared objects in the pip source distribution --- Makefile | 9 ++- README.md | 104 +++++++++++++++++++++++++++++-- requirements.txt | 9 +++ src/MANIFEST.in | 4 +- src/Makefile | 4 +- src/msspec/spec/fortran/Makefile | 23 ++++--- 6 files changed, 135 insertions(+), 18 deletions(-) create mode 100644 requirements.txt diff --git a/Makefile b/Makefile index 4fe07c2..a7bdeb9 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ endif .PHONY: clean version selfex venv doc -selfex: clean +selfex: results purge @echo "Creating the self-extractible setup program... " # update the version @cp ./src/msspec/version.py ./src/msspec/version.py.bak @@ -58,6 +58,13 @@ clean: @+$(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: @virtualenv --python=python3 --system-site-packages ci_venv $(SUPPRESS_OUPUT) diff --git a/README.md b/README.md index 7a55563..8f5d6ac 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,107 @@ This is the Python MsSpec version with support for Python 3.x and dynamic memory -To install -========== +To work with the git repository +=============================== + +It is higly recommended to work in a Python virtual environment. +To create one, you can use: ```Bash -make selfex -./pymsspec-###.setup +virtualenv --python=python3 msspec_venv ``` + +or + +```Bash +virtualenv --python=python3 --system-site-packages msspec_venv +``` + +to activate the virtual environment (if you are in the folder where you created "msspec\_venv"): + +```Bash +source ./msspec_venv/bin/activate +``` + +To get the python package dependencies, you can install the requirements with the provided requirements.txt file. + +```Bash +pip install --upgrade -r requirements.txt +``` + +You also need to export the path to the msspec package in the PYTHONPATH variable (replace the whereisthegitrepo part +of the string with the actual absolute path of your repo. + +```Bash +export PYTHONPATH=/whereisthegitrepo/src:$PYTHONPATH +``` + +Finally you need to compile the fortran libs: + +```Bash +make pybinding +``` + +That's all. All you need to do each time you want to work with msspec is: + +- To activate the virtual environment +- Export the path to msspec package in the PYTHONPATH variable + + + +To create a self-extracible archive +=================================== + +If you want to create a setup program to install msspec: + +At the root of the repo, type in + +```Bash +make selfex +``` + +This will compile the code and create the results of unit tests, then it will create a self-extractible archive in the package folder + + +To install the \*.setup file +============================ + +Just execute the file with a shell + +```Bash +sh ./MsSpec-###.setup +``` + +Replace ### with the version number. + +To automatically accept the defaults you could type in + +```Bash +sh ./MsSpec-###.setup --accept -- -y +``` + +and to make the install process verbose: + +```Bash +sh ./MsSpec-###.setup -- -d +``` + + + + + + + + + + + + + + + + + + + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..2d89c58 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,9 @@ +numpy +ase +h5py +lxml +pint +terminaltables +pycairo +coverage +sphinx diff --git a/src/MANIFEST.in b/src/MANIFEST.in index 7d868e4..c3f5c6c 100644 --- a/src/MANIFEST.in +++ b/src/MANIFEST.in @@ -1,3 +1,3 @@ -include msspec/spec/*.so -include msspec/phagen/*.so +include msspec/spec/fortran/*.so +include msspec/phagen/fortran/*.so include msspec/results.txt diff --git a/src/Makefile b/src/Makefile index 66bcebc..92b4de1 100644 --- a/src/Makefile +++ b/src/Makefile @@ -21,7 +21,9 @@ pybinding: @+$(MAKE) -C msspec/spec/fortran pybinding $(SUPPRESS_OUPUT) @+$(MAKE) -C msspec/phagen/fortran pybinding $(SUPPRESS_OUPUT) -results: pybinding +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 1>/dev/null # create the html coverage report diff --git a/src/msspec/spec/fortran/Makefile b/src/msspec/spec/fortran/Makefile index c8dd069..2821840 100644 --- a/src/msspec/spec/fortran/Makefile +++ b/src/msspec/spec/fortran/Makefile @@ -39,6 +39,8 @@ objects_src += $(renormalization_src) $(phd_se_noso_nosp_nosym_src) objects_src += $(eig_common_src) $(eig_mi_src) $(eig_pw_src) objects:=$(patsubst %.f,%.o, $(objects_src)) +libs_targets := phd_se_noso_nosp_nosym.target eig_mi.target eig_pw.target + EXE=prog ifeq ($(DEBUG),1) @@ -53,22 +55,22 @@ export COMP_OPTS .PHONY: clean -pybinding: phd_se_noso_nosp_nosym eig_mi eig_pw +pybinding: $(libs_targets) -phd_se_noso_nosp_nosym: $(memalloc_obj) $(cluster_gen_obj) $(common_sub_obj) $(renormalization_obj) $(phd_se_noso_nosp_nosym_obj) +phd_se_noso_nosp_nosym.target: $(memalloc_obj) $(cluster_gen_obj) $(common_sub_obj) $(renormalization_obj) $(phd_se_noso_nosp_nosym_obj) @echo "building Python binding..." - @$(F2PY) $(includes) $^ $(F2PY_OPTS) -c -m $@ phd_se_noso_nosp_nosym/main.f -# @cp $@.cpython*.so ../ + @$(F2PY) $(includes) $^ $(F2PY_OPTS) -c -m $(patsubst %.target, %, $@) phd_se_noso_nosp_nosym/main.f + @touch $@ -eig_mi: $(memalloc_obj) $(cluster_gen_obj) $(common_sub_obj) $(renormalization_obj) $(eig_common_obj) $(eig_mi_obj) +eig_mi.target: $(memalloc_obj) $(cluster_gen_obj) $(common_sub_obj) $(renormalization_obj) $(eig_common_obj) $(eig_mi_obj) @echo "building Python binding..." - @$(F2PY) $(includes) $^ $(F2PY_OPTS) -c -m $@ eig/mi/main.f -# @cp $@.cpython*.so ../ + @$(F2PY) $(includes) $^ $(F2PY_OPTS) -c -m $(patsubst %.target, %, $@) eig/mi/main.f + @touch $@ -eig_pw: $(memalloc_obj) $(cluster_gen_obj) $(common_sub_obj) $(renormalization_obj) $(eig_common_obj) $(eig_pw_obj) +eig_pw.target: $(memalloc_obj) $(cluster_gen_obj) $(common_sub_obj) $(renormalization_obj) $(eig_common_obj) $(eig_pw_obj) @echo "building Python binding..." - @$(F2PY) $(includes) $^ $(F2PY_OPTS) -c -m $@ eig/pw/main.f -# @cp $@.cpython*.so ../ + @$(F2PY) $(includes) $^ $(F2PY_OPTS) -c -m $(patsubst %.target, %, $@) eig/pw/main.f + @touch $@ %.o: %.f @echo "compiling $@..." @@ -78,3 +80,4 @@ clean: @echo "cleaning..." @rm -rf *.o *.mod @rm -rf $(objects) + @rm -rf $(libs_targets)