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
This commit is contained in:
Sylvain Tricot 2019-12-06 13:26:22 +01:00
parent 93782236b0
commit c22f86fe76
6 changed files with 135 additions and 18 deletions

View File

@ -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)

104
README.md
View File

@ -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
```

9
requirements.txt Normal file
View File

@ -0,0 +1,9 @@
numpy
ase
h5py
lxml
pint
terminaltables
pycairo
coverage
sphinx

View File

@ -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

View File

@ -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

View File

@ -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)