Skip to content

Commit

Permalink
math/py-ambit: New port: Library for tensor product calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
yurivict committed May 21, 2023
1 parent ab88b4e commit e4464e7
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 0 deletions.
1 change: 1 addition & 0 deletions math/Makefile
Expand Up @@ -875,6 +875,7 @@
SUBDIR += py-affine
SUBDIR += py-algopy
SUBDIR += py-altgraph
SUBDIR += py-ambit
SUBDIR += py-amply
SUBDIR += py-animatplot
SUBDIR += py-animatplot-ng
Expand Down
44 changes: 44 additions & 0 deletions math/py-ambit/Makefile
@@ -0,0 +1,44 @@
PORTNAME= ambit
DISTVERSIONPREFIX= v
DISTVERSION= 0.7
CATEGORIES= math
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}

MAINTAINER= yuri@FreeBSD.org
COMMENT= Library for tensor product calculations
WWW= https://github.com/jturney/ambit

LICENSE= GPLv3
LICENSE_FILE= ${WRKSRC}/../COPYING

PY_DEPENDS= ${PYNUMPY}
BUILD_DEPENDS= pybind11>0:devel/pybind11 \
${PY_DEPENDS}
LIB_DEPENDS= libambit.so:math/ambit \
libhdf5.so:science/hdf5 \
libopenblas.so:math/openblas
RUN_DEPENDS= ${PY_DEPENDS}

USES= cmake compiler:c++17-lang python:build
USE_PYTHON= flavors pytest

USE_GITHUB= yes
GH_ACCOUNT= jturney

WRKSRC_SUBDIR= pyambit

CMAKE_ARGS= -DPYMOD_INSTALL_LIBDIR:STRING=/python${_PYTHON_VERSION}/site-packages \
-DFREEBSD_PYTHON_VER=${PYTHON_VER}

TEST_ENV= ${MAKE_ENV} PYTHONPATH=${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
TEST_WRKSRC= ${WRKSRC}

post-install: # remove share/cmake/ambit/ambitTargets-Python-%%CMAKE_BUILD_TYPE%%.cmake, and tests
@${RM} -r \
${STAGEDIR}${PREFIX}/share \
${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}/ambit/tests

pre-test:
@${RM} ${WRKSRC}/__init__.py # tests fail with __init__.py

.include <bsd.port.mk>
3 changes: 3 additions & 0 deletions math/py-ambit/distinfo
@@ -0,0 +1,3 @@
TIMESTAMP = 1684643393
SHA256 (jturney-ambit-v0.7_GH0.tar.gz) = 97a4360db5cad6c9d2bc0932fc8641a3feb34a809c192c99886880073e87f8c2
SIZE (jturney-ambit-v0.7_GH0.tar.gz) = 336129
11 changes: 11 additions & 0 deletions math/py-ambit/files/patch-CMakeLists.txt
@@ -0,0 +1,11 @@
--- CMakeLists.txt.orig 2023-05-21 04:59:24 UTC
+++ CMakeLists.txt
@@ -23,7 +23,7 @@ set(CMAKECONFIG_INSTALL_DIR "${ambit_INSTALL_CMAKEDIR}

#if (NOT TARGET Python::Module)
set(Python_ADDITIONAL_VERSIONS 3.11 3.10 3.9 3.8 3.7) # adjust with CMake minimum FindPythonInterp
- find_package(Python 3.7 COMPONENTS Interpreter Development NumPy REQUIRED)
+ find_package(Python ${FREEBSD_PYTHON_VER} EXACT COMPONENTS Interpreter Development NumPy REQUIRED)
message(STATUS "Found Python ${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}: ${Python_EXECUTABLE} (found version ${Python_VERSION})")
#endif()

2 changes: 2 additions & 0 deletions math/py-ambit/pkg-descr
@@ -0,0 +1,2 @@
Python bindings for the C++ library implementing the tensor product calculations
through a clean, concise user interface.
2 changes: 2 additions & 0 deletions math/py-ambit/pkg-plist
@@ -0,0 +1,2 @@
%%PYTHON_SITELIBDIR%%/ambit/__init__.py
%%PYTHON_SITELIBDIR%%/ambit/pyambit%%PYTHON_EXT_SUFFIX%%.so

0 comments on commit e4464e7

Please sign in to comment.