Skip to content

Commit

Permalink
readding a donfiguration file
Browse files Browse the repository at this point in the history
  • Loading branch information
Iximiel committed Oct 22, 2024
1 parent 34aeec9 commit ea2e77f
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 6 deletions.
1 change: 1 addition & 0 deletions docker/fedora39-pycv
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ RUN source /etc/bashrc \
&& cd plumed2 \
&& source ./sourceme.sh \
&& cd plugins/pycv \
&& ./configurePyCV.sh \
&& ln -s $(realpath ../../regtest/scripts) ./regtest/scripts \
&& make check
1 change: 1 addition & 0 deletions docker/rocky8-pycv
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ RUN . ./.bashrc \
&& cd plumed2 \
&& source ./sourceme.sh \
&& cd plugins/pycv \
&& ./configurePyCV.sh \
&& ln -s $(realpath ../../regtest/scripts) ./regtest/scripts \
&& make check
16 changes: 10 additions & 6 deletions plugins/pycv/Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@

PYTHON=python
#optional, just in case you want to override python with ./configurePyCV.sh
-include Makefile.conf
#this makefiles assume that pip and pytest are installed
.PHONY: clean check check_standalone check_python all

all: pycv_here

pycv_here: src/*.cpp src/*.h src/pycv/*.py
@echo installing pycv
pip3 install .
touch $@
$(PYTHON) -m pip install .
@touch $@

clean:
pip3 uninstall pycv
rm -fv pycv_here
@$(PYTHON) -m pip uninstall pycv -y
@rm -fv pycv_here

check_standalone: pycv_here
$(MAKE) -C regtest testclean
$(MAKE) -C regtest checkfail

#just in case pytest is still not installed we install it before the tests
check_python: pycv_here
pip3 install pytest
pytest -v
@$(PYTHON) -m pip install pytest
@$(PYTHON) -m pytest -v

check: check_standalone check_python
35 changes: 35 additions & 0 deletions plugins/pycv/configurePyCV.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

#formatted with shfmtv3.36.0 (https://github.com/mvdan/sh/releases)

#A simple script to configure PyCV if python does not work
PYTHON=""
if which plumed >/dev/null; then
echo "plumed found"
PYTHON=$(plumed --no-mpi info --configuration | grep 'python_bin=')
PYTHON=${PYTHON#python_bin=}
fi

if [ -z "$PYTHON" ]; then
echo "python not found using plumed"
echo "serching for available python with plumed module installed"

for python_bin in python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7; do
if $python_bin -c "import plumed" 2>/dev/null; then
if [ $python_bin != python ]; then
PYTHON=$python_bin
fi
return 1
fi
done

fi

if [ -z "$PYTHON" ]; then
echo "python not found"
exit 1
fi

cat <<EOF >Makefile.conf
PYTHON=$(which "$PYTHON")
EOF

0 comments on commit ea2e77f

Please sign in to comment.