git: 46b92799b345 - main - science/py-ncrystal: New port: Library for thermal neutron transport in crystals and other materials

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Wed, 08 Nov 2023 22:05:09 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=46b92799b3455f7ff955e032b914facfff791d6b

commit 46b92799b3455f7ff955e032b914facfff791d6b
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2023-11-08 22:04:04 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2023-11-08 22:05:07 +0000

    science/py-ncrystal: New port: Library for thermal neutron transport in crystals and other materials
---
 science/Makefile                               |  1 +
 science/py-ncrystal/Makefile                   | 36 ++++++++++++++++++++++++++
 science/py-ncrystal/distinfo                   |  3 +++
 science/py-ncrystal/files/patch-pyproject.toml | 10 +++++++
 science/py-ncrystal/pkg-descr                  |  7 +++++
 5 files changed, 57 insertions(+)

diff --git a/science/Makefile b/science/Makefile
index b4b719897c39..2c091da790bd 100644
--- a/science/Makefile
+++ b/science/Makefile
@@ -369,6 +369,7 @@
     SUBDIR += py-mp-api
     SUBDIR += py-mpcontribs-client
     SUBDIR += py-mrchem
+    SUBDIR += py-ncrystal
     SUBDIR += py-netCDF4
     SUBDIR += py-netcdf-flattener
     SUBDIR += py-nglview
diff --git a/science/py-ncrystal/Makefile b/science/py-ncrystal/Makefile
new file mode 100644
index 000000000000..30c4fcf6b840
--- /dev/null
+++ b/science/py-ncrystal/Makefile
@@ -0,0 +1,36 @@
+PORTNAME=	ncrystal
+DISTVERSIONPREFIX=	v
+DISTVERSION=	3.7.1
+CATEGORIES=	science # physics
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Library for thermal neutron transport in crystals and other materials
+WWW=		https://mctools.github.io/ncrystal/
+
+LICENSE=	APACHE20
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+BUILD_DEPENDS=	${PY_SETUPTOOLS} \
+		${PYNUMPY} \
+		${PYTHON_PKGNAMEPREFIX}scikit-build>0:devel/py-scikit-build@${PY_FLAVOR} \
+		cmake:devel/cmake-core
+
+USES=		python
+USE_PYTHON=	pep517 autoplist
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	mctools
+
+POST_PLIST=	fix-plist
+
+post-install:
+	# delete scripts (they are installed by science/ncrystal)
+	@${RM} ${STAGEDIR}${PREFIX}/bin/*
+	# strip binary
+	@${STRIP_CMD} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/NCrystal/ncrystal_pyinst_data/lib/libNCrystal.so
+
+fix-plist: # see post-install
+	@${REINPLACE_CMD} -e "s|^bin/.*$$||" ${TMPPLIST}
+
+.include <bsd.port.mk>
diff --git a/science/py-ncrystal/distinfo b/science/py-ncrystal/distinfo
new file mode 100644
index 000000000000..6e0e9a659c6a
--- /dev/null
+++ b/science/py-ncrystal/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1699390662
+SHA256 (mctools-ncrystal-v3.7.1_GH0.tar.gz) = ce523dd3aca1d0fd1989cd4d48cc3e2ce90590c47e219e2f2394677c63a87076
+SIZE (mctools-ncrystal-v3.7.1_GH0.tar.gz) = 1839587
diff --git a/science/py-ncrystal/files/patch-pyproject.toml b/science/py-ncrystal/files/patch-pyproject.toml
new file mode 100644
index 000000000000..477838aab7bb
--- /dev/null
+++ b/science/py-ncrystal/files/patch-pyproject.toml
@@ -0,0 +1,10 @@
+--- pyproject.toml.orig	2023-11-07 22:10:54 UTC
++++ pyproject.toml
+@@ -23,7 +23,6 @@
+ requires = [
+     "setuptools>=42",
+     "scikit-build>=0.13",
+-    "cmake>=3.18",
+     "numpy"
+ ]
+ build-backend = "setuptools.build_meta"
diff --git a/science/py-ncrystal/pkg-descr b/science/py-ncrystal/pkg-descr
new file mode 100644
index 000000000000..11f0f875bc5d
--- /dev/null
+++ b/science/py-ncrystal/pkg-descr
@@ -0,0 +1,7 @@
+NCrystal is a library and associated tools which enables calculations for
+Monte Carlo simulations of thermal neutrons in crystals and other materials,
+supporting a range of physics including both coherent, incoherent, elastic and
+inelastic scatterings in a wide range of materials, including crystal powders,
+mosaic single crystals, layered single crystals, amorphous solids, liquids, and
+gasses. Multiphase materials or isotopically enriched materials are supported as
+well, and the framework furthermore supports phase-contrast (SANS) physics.