py-antspyx: new package (#30964)
* py-antspyx: new package Also adds required dependencies. Requires options to ITK to enable the right support libraries, and patches to remove tune the setup and provide resources rather than downloading libraries/"submodules" on the fly. * Fix patch URL * Style fixes. * bump version and re-include `git clone ...` as resource
This commit is contained in:
parent
96b205ce6c
commit
6add885bb2
5 changed files with 144 additions and 0 deletions
|
@ -38,6 +38,7 @@ class Itk(CMakePackage):
|
||||||
variant("review", default=False, description="enable modules under review")
|
variant("review", default=False, description="enable modules under review")
|
||||||
variant("rtk", default=False, description="build the RTK (Reconstruction Toolkit module")
|
variant("rtk", default=False, description="build the RTK (Reconstruction Toolkit module")
|
||||||
variant("minc", default=False, description="enable support for MINC files")
|
variant("minc", default=False, description="enable support for MINC files")
|
||||||
|
variant("antspy", default=False, description="enable support features for antspy")
|
||||||
|
|
||||||
# TODO: This will not work if the resource is pulled from a spack mirror.
|
# TODO: This will not work if the resource is pulled from a spack mirror.
|
||||||
# The build process will checkout the appropriate commit but it needs to be
|
# The build process will checkout the appropriate commit but it needs to be
|
||||||
|
@ -76,6 +77,9 @@ def cmake_args(self):
|
||||||
self.define_from_variant("Module_RTK", "rtk"),
|
self.define_from_variant("Module_RTK", "rtk"),
|
||||||
self.define_from_variant("Module_ITKIOMINC", "minc"),
|
self.define_from_variant("Module_ITKIOMINC", "minc"),
|
||||||
self.define_from_variant("Module_ITKIOTransformMINC", "minc"),
|
self.define_from_variant("Module_ITKIOTransformMINC", "minc"),
|
||||||
|
self.define_from_variant("Module_MGHIO", "antspy"),
|
||||||
|
self.define_from_variant("Module_GenericLabelInterpolator", "antspy"),
|
||||||
|
self.define_from_variant("Module_AdaptiveDenoising", "antspy"),
|
||||||
]
|
]
|
||||||
|
|
||||||
if not use_mkl:
|
if not use_mkl:
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
--- spack-src/ants/lib/CMakeLists.txt.orig 2021-11-17 20:09:44.586523746 +0100
|
||||||
|
+++ spack-src/ants/lib/CMakeLists.txt 2021-11-17 20:10:14.057924013 +0100
|
||||||
|
@@ -10,6 +10,9 @@
|
||||||
|
find_package(ITK REQUIRED)
|
||||||
|
include(${ITK_USE_FILE})
|
||||||
|
|
||||||
|
+# Somehow not passed through from ITK
|
||||||
|
+find_package(GTest REQUIRED)
|
||||||
|
+
|
||||||
|
|
||||||
|
## SETUP PYBIND11 ##
|
||||||
|
add_subdirectory(pybind11)
|
58
var/spack/repos/builtin/packages/py-antspyx/package.py
Normal file
58
var/spack/repos/builtin/packages/py-antspyx/package.py
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
|
||||||
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
|
from spack.package import *
|
||||||
|
|
||||||
|
|
||||||
|
class PyAntspyx(PythonPackage):
|
||||||
|
"""Advanced Normalization Tools in Python."""
|
||||||
|
|
||||||
|
homepage = "https://pypi.org/project/antspyx/"
|
||||||
|
pypi = "antspyx/antspyx-0.3.7.tar.gz"
|
||||||
|
|
||||||
|
version("0.3.7", sha256="cd831eb966d4ce82cc0afb65edddd8e2db6b439d418316e6356199f966104c1b")
|
||||||
|
|
||||||
|
depends_on("python@3.6:", type=("build", "run"))
|
||||||
|
depends_on("py-setuptools", type="build")
|
||||||
|
|
||||||
|
depends_on("cmake@3.10:", type="build")
|
||||||
|
depends_on("itk+review+antspy")
|
||||||
|
|
||||||
|
depends_on("pil", type=("build", "run"))
|
||||||
|
depends_on("py-pandas", type=("build", "run"))
|
||||||
|
depends_on("py-numpy", type=("build", "run"))
|
||||||
|
depends_on("py-scipy", type=("build", "run"))
|
||||||
|
depends_on("py-scikit-image", type=("build", "run"))
|
||||||
|
depends_on("py-scikit-learn", type=("build", "run"))
|
||||||
|
depends_on("py-statsmodels", type=("build", "run"))
|
||||||
|
depends_on("py-webcolors", type=("build", "run"))
|
||||||
|
depends_on("py-matplotlib", type=("build", "run"))
|
||||||
|
depends_on("py-pyyaml", type=("build", "run"))
|
||||||
|
depends_on("py-chart-studio", type=("build", "run"))
|
||||||
|
depends_on("py-nibabel", type=("build", "run"))
|
||||||
|
|
||||||
|
# from ITK, somehow does not get passed through. Required for building, together with
|
||||||
|
# the following patch
|
||||||
|
depends_on("googletest")
|
||||||
|
patch("fix-itk-gtest.diff")
|
||||||
|
|
||||||
|
patch("submodule-imposter.diff")
|
||||||
|
|
||||||
|
resource(
|
||||||
|
name="submodule-imposter-pybind11",
|
||||||
|
git="https://github.com/stnava/pybind11/",
|
||||||
|
destination="ants/lib",
|
||||||
|
)
|
||||||
|
|
||||||
|
resource(
|
||||||
|
name="submodule-imposter-antscore",
|
||||||
|
git="https://github.com/ANTsX/ANTs.git",
|
||||||
|
commit="871cad073908952b095e4b520335fc441e059264",
|
||||||
|
destination="ants/lib",
|
||||||
|
when="@0.3.7", # ANTs dependency needs updating for every version
|
||||||
|
)
|
||||||
|
|
||||||
|
def setup_build_environment(self, env):
|
||||||
|
env.set("ITK_DIR", self.spec["itk"].prefix)
|
|
@ -0,0 +1,52 @@
|
||||||
|
--- spack-src/scripts/configure_ANTsPy.sh.orig 2021-11-19 13:27:28.551737371 +0100
|
||||||
|
+++ spack-src/scripts/configure_ANTsPy.sh 2021-11-19 13:28:07.422251249 +0100
|
||||||
|
@@ -1,26 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# ---------------------------------------------
|
||||||
|
-# clone pybind11 into library directory
|
||||||
|
-
|
||||||
|
-cd ants/lib # go to lib dir
|
||||||
|
-if [[ ! -d ~/pybind11 ]]; then
|
||||||
|
- git clone https://github.com/stnava/pybind11.git
|
||||||
|
-# git clone https://github.com/ncullen93/pybind11.git
|
||||||
|
-fi
|
||||||
|
-cd ../../ # go back to main dir
|
||||||
|
-
|
||||||
|
-# ---------------------------------------------
|
||||||
|
-# create local ~/.antspy dir and move package data to it
|
||||||
|
-
|
||||||
|
-if [[ ! -d ~/.antspy ]]; then
|
||||||
|
- mkdir ~/.antspy
|
||||||
|
-fi
|
||||||
|
-
|
||||||
|
-cp data/* ~/.antspy/
|
||||||
|
-
|
||||||
|
-# ---------------------------------------------
|
||||||
|
-# clone ANTs and move all files into library directory
|
||||||
|
+# move all files from ANTs into library directory
|
||||||
|
|
||||||
|
antsgit=https://github.com/ANTsX/ANTs.git
|
||||||
|
antstag=4528978446c73ed09927ea5ae1721b280d534dc0 # 2020 n4 type
|
||||||
|
@@ -30,20 +11,11 @@
|
||||||
|
|
||||||
|
# if antscore doesnt exist, create it
|
||||||
|
if [[ ! -d antscore ]] ; then
|
||||||
|
- git clone $antsbranch $antsgit antsrepo
|
||||||
|
-
|
||||||
|
if [[ ! -d antscore ]] ; then
|
||||||
|
mkdir antscore
|
||||||
|
fi
|
||||||
|
|
||||||
|
- cd antsrepo # go to antscore
|
||||||
|
- # check out right branch
|
||||||
|
- if [[ -d .git ]]; then
|
||||||
|
- git checkout master
|
||||||
|
- git pull
|
||||||
|
- git checkout $antstag
|
||||||
|
- fi
|
||||||
|
- cd ..
|
||||||
|
+ ln -sf ANTs antsrepo
|
||||||
|
# copy antscore files into library
|
||||||
|
cp -r antsrepo/Examples/* antscore/
|
||||||
|
cp -r antsrepo/Examples/include/* antscore
|
18
var/spack/repos/builtin/packages/py-webcolors/package.py
Normal file
18
var/spack/repos/builtin/packages/py-webcolors/package.py
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
|
||||||
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
|
from spack.package import *
|
||||||
|
|
||||||
|
|
||||||
|
class PyWebcolors(PythonPackage):
|
||||||
|
"""Working with color names and values formats defined by HTML and CSS."""
|
||||||
|
|
||||||
|
homepage = "https://pypi.org/project/webcolors/"
|
||||||
|
pypi = "webcolors/webcolors-1.11.1.tar.gz"
|
||||||
|
|
||||||
|
version("1.11.1", sha256="76f360636957d1c976db7466bc71dcb713bb95ac8911944dffc55c01cb516de6")
|
||||||
|
|
||||||
|
depends_on("python@3.5:", type=("build", "run"))
|
||||||
|
depends_on("py-setuptools", type=("build"))
|
Loading…
Reference in a new issue