Skip to content

Commit dadad11

Browse files
authored
Update Spack recipe (v2.3.0.1, release documentation, sync packages) (#133)
* [update] Bump the package to the current version included in Spack * [doc] Explain the release cycle of spack packages better * [new version] add v2.3.0.1 to Spack recipe * [ci][fix] update CI workflow for testing the bindings * [ci] print binding version at end of workflow
1 parent d65d39b commit dadad11

4 files changed

Lines changed: 61 additions & 66 deletions

File tree

.github/workflows/build-spack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ jobs:
2626
cp -r spack/repo/packages/py-pyprecice/ /py-pyprecice-repo/packages/
2727
- name: Try to build py-pyprecice with spack and test it
2828
run: |
29-
. /opt/spack/share/spack/setup-env.sh && spack env activate ci && spack arch && spack find && spack dev-build pyprecice.test.py-pyprecice@develop target=x86_64 && spack load precice py-numpy py-mpi4py py-cython openssh openmpi && mkdir runner && cd runner && python3 -c "import precice; print(precice.__version__)"
29+
. /opt/spack/share/spack/setup-env.sh && spack env activate ci && spack arch && spack find && spack dev-build pyprecice.test.py-pyprecice@develop target=x86_64 && spack load precice py-numpy py-mpi4py py-cython openssh openmpi && export PYTHONPATH=${PWD}/build/$(ls build | grep lib.):${PYTHONPATH} && mkdir runner && cd runner && BINDINGS_VERSION=$(python3 -c "import precice; print(precice.__version__)") && echo "Installed version of bindings is ${BINDINGS_VERSION}"

spack/README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,40 @@ The workflow `build-spack-pyprecice-deps` in `.github/workflows/build-env.yml` c
88

99
The workflow `build_spack` in `.github/workflows/build-spack.yml` uses the image `precice/ci-spack-pyprecice-deps-1804` to reduce build time. The workflow uses the `package.py` from this repository to build the latest version of the bindings and run a small test on this version.
1010

11-
## When a new spack release is necessary
11+
## When a new Spack release is necessary
1212

1313
* Add checksum of newest version(s) to https://github.com/precice/python-bindings/blob/develop/spack/repo/packages/py-pyprecice/package.py. You can get checksum for any released version by running `spack checksum py-pyprecice`.
14+
* Check whether the new release works locally. You can add the Spack repo in this repository and do the following:
15+
1. Add the repository to your Spack installation if you have not done that before. You can check the repositories available with your Spack installation via `spack repo list`. If there is a repository called `pyprecice.test`, check whether it points to the correct path. The correct path is the `spack/repo` directory of python-bindings repository. If the repository is missing, add it via
16+
```bash
17+
spack repo add ${REPOSITORY_ROOT}/spack/repo
18+
```
19+
2. Build the new python bindings. Usually, we use a new Spack environment. This is created and loaded via
20+
```
21+
spack env create pyprecicetest-VERSIONNUMBER
22+
spack env activate -p pyprecicetest-VERSIONNUMBER
23+
spack
24+
```
25+
Note that the dots `.` in the version number must be replaced by underscores or similar.
26+
3. We add the `py-pyprecice` package from our repository to the environment via
27+
```
28+
spack add pyprecice.test.py-pyprecice@VERSIONNUMBER
29+
```
30+
This ensures that one uses the local repository which has the namespace `pyprecice.test` when installing `py-precice`.
31+
4. Concretize the software packages
32+
```
33+
spack concretize -f
34+
```
35+
and check whether everything looks good. You might want to edit the environment of the Spack environment (the `spack.yaml` file) and enforce combined concretization by adding `concretization: together` at the end of the file. You might want to double check whether the correct repository is used by calling
36+
```
37+
spack spec -N py-pyprecice@VERSIONNUMBER
38+
```
39+
It will print the concretization and prefixes each packages with the repository it will be installed from.
40+
5. Run `spack install` to actually install the package.
41+
6. If the installation went through, check the installation by running `python3 -c "import precice; print(precice.__version__)"`. This should print the version number of the Python bindings you have installed. *Note*: In order to make the bindings available one might have to reload the environment via ```
42+
despacktivate
43+
spack env activate -p pyprecicetest-VERSIONNUMBER
44+
```
45+
7. Ideally one runs the solverdummy with the freshly installed Python bindings.
1446
* Use `package.py` together with the patches provided in `python-bindings/spack/repo/packages/py-pyprecice` to [create a pull request for Spack](https://github.com/spack/spack/compare) and submit the new release.
47+
* After the pull request in the Spack repository is merged, merge the current package configuration into the repository of the Python bindings if necessery.

spack/repo/packages/py-pyprecice/deactivate-version-check-via-pip.patch

Lines changed: 0 additions & 32 deletions
This file was deleted.

spack/repo/packages/py-pyprecice/package.py

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,17 @@ class PyPyprecice(PythonPackage):
1212
C++ library preCICE.
1313
"""
1414

15-
homepage = "https://www.precice.org"
15+
homepage = "https://precice.org"
1616
git = "https://github.com/precice/python-bindings.git"
1717
url = "https://github.com/precice/python-bindings/archive/v2.0.0.1.tar.gz"
18-
maintainers = ["ajaust", "BenjaminRodenberg"]
18+
maintainers = ["ajaust", "BenjaminRodenberg", "IshaanDesai"]
1919

2020
# Always prefer final version of release candidate
2121
version("develop", branch="develop")
22-
version('2.2.0.1', sha256='032fa58193cfa69e3be37557977056e8f507d89b40c490a351d17271269b25ad')
22+
version('2.3.0.1', sha256='ed4e48729b662680beaa4ee2a9aff724a79e760534c6c58181be739988da2789')
23+
version('2.2.1.1', sha256='139bac5077c3807e1b7b83d8d0da5ca0fc8c17393fd0df4bc5999cd63a351b78')
24+
version('2.2.0.2', sha256='2287185f9ad7500dced53459543d27bb66bd2438c2e4bf81ee3317e6a00513d5')
25+
version('2.2.0.1', sha256='229625e2e6df03987ababce5abe2021b0974cbe5a588b936a9cba653f4908d4b')
2326
version('2.1.1.2', sha256='363eb3eeccf964fd5ee87012c1032353dd1518662868f2b51f04a6d8a7154045')
2427
version("2.1.1.1", sha256="972f574549344b6155a8dd415b6d82512e00fa154ca25ae7e36b68d4d2ed2cf4")
2528
version("2.1.0.1", sha256="ac5cb7412c6b96b08a04fa86ea38e52d91ea739a3bd1c209baa93a8275e4e01a")
@@ -28,35 +31,26 @@ class PyPyprecice(PythonPackage):
2831
version("2.0.0.2", sha256="5f055d809d65ec2e81f4d001812a250f50418de59990b47d6bcb12b88da5f5d7")
2932
version("2.0.0.1", sha256="96eafdf421ec61ad6fcf0ab1d3cf210831a815272984c470b2aea57d4d0c9e0e")
3033

31-
# Older versions of the bindings checked versions via pip. This patch
32-
# removes the pip dependency.
33-
# See also https://github.com/spack/spack/pull/19558
34-
patch("deactivate-version-check-via-pip.patch", when="@:2.1.1.1")
35-
3634
depends_on("precice@develop", when="@develop")
37-
depends_on("precice@2.2.0", when="@2.2.0.1:2.2.0.99")
38-
depends_on("precice@2.1.1", when="@2.1.1.1:2.1.1.99")
39-
depends_on("precice@2.1.0", when="@2.1.0.1:2.1.0.99")
40-
depends_on("precice@2.0.2", when="@2.0.2.1:2.0.2.99")
41-
depends_on("precice@2.0.1", when="@2.0.1.1:2.0.1.99")
42-
depends_on("precice@2.0.0", when="@2.0.0.1:2.0.0.99")
43-
44-
depends_on("python@3:", type=("build", "run"))
35+
depends_on("precice@2.3.0", when="@2.3.0.1:2.3.1")
36+
depends_on("precice@2.2.1", when="@2.2.1.1:2.2.1")
37+
depends_on("precice@2.2.0", when="@2.2.0.1:2.2.0")
38+
depends_on("precice@2.1.1", when="@2.1.1.1:2.1.1")
39+
depends_on("precice@2.1.0", when="@2.1.0.1:2.1.0")
40+
depends_on("precice@2.0.2", when="@2.0.2.1:2.0.2")
41+
depends_on("precice@2.0.1", when="@2.0.1.1:2.0.1")
42+
depends_on("precice@2.0.0", when="@2.0.0.1:2.0.0")
43+
44+
depends_on("python@3:", type=("build", "link", "run"))
4545
depends_on("py-setuptools", type="build")
46-
depends_on("py-numpy", type=("build", "run"))
46+
depends_on("py-numpy", type=("build", "link", "run"))
4747
depends_on("py-mpi4py", type=("build", "run"))
48-
depends_on("py-cython@0.29:", type=("build"))
49-
50-
phases = ['install_lib', 'build_ext', 'install']
51-
52-
def build_ext_args(self, spec, prefix):
53-
return [
54-
"--include-dirs=" + spec["precice"].headers.directories[0],
55-
"--library-dirs=" + spec["precice"].libs.directories[0]
56-
]
57-
58-
def install(self, spec, prefix):
59-
# Older versions of the bindings had a non-standard installation routine
60-
# See also https://github.com/spack/spack/pull/19558#discussion_r513123239
61-
if self.version <= Version("2.1.1.1"):
62-
self.setup_py("install", "--prefix={0}".format(prefix))
48+
depends_on("py-cython@0.29:", type="build")
49+
depends_on("py-packaging", when="@:2.1", type="build")
50+
depends_on("py-pip", when="@:2.1", type="build")
51+
52+
@when("@:2.1")
53+
def patch(self):
54+
filter_file(
55+
"distutils.command.install", "setuptools.command.install", "setup.py"
56+
)

0 commit comments

Comments
 (0)