Skip to content

Commit

Permalink
science/{,py-}spglib: update 2.3.0 → 2.3.1
Browse files Browse the repository at this point in the history
Reported by:	portscout
  • Loading branch information
yurivict committed Feb 11, 2024
1 parent 7a95f29 commit e1e1584
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 31 deletions.
23 changes: 18 additions & 5 deletions science/py-spglib/Makefile
@@ -1,16 +1,18 @@
PORTNAME= spglib
DISTVERSIONPREFIX= v
DISTVERSION= 2.3.0
DISTVERSION= 2.3.1
CATEGORIES= science python
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}

MAINTAINER= yuri@FreeBSD.org
COMMENT= Library for finding and handling crystal symmetries (python binding)
WWW= https://atztogo.github.io/spglib/
WWW= https://spglib.readthedocs.io/en/stable/

LICENSE= BSD3CLAUSE

BUILD_DEPENDS= ${PYNUMPY}
BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}setuptools_scm>0:devel/py-setuptools_scm@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}scikit-build-core>0:devel/py-scikit-build-core@${PY_FLAVOR} \
${PYNUMPY}
LIB_DEPENDS= libsymspg.so:science/spglib
RUN_DEPENDS= ${PYNUMPY}

Expand All @@ -22,8 +24,19 @@ CMAKE_ARGS= -DPython3_EXECUTABLE=${PYTHON_CMD}

WRKSRC_SUBDIR= python

MAKE_ENV= SETUPTOOLS_SCM_PRETEND_VERSION=${DISTVERSION}

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

post-patch:
#@cd ${WRKSRC} && ${RLN} ../test .
@cd ${WRKSRC} && ${CP} -r ../test .
##@cd ${WRKSRC} && ${RLN} ../test .
#@cd ${WRKSRC} && ${CP} -r ../test .
# workaround for https://github.com/spglib/spglib/issues/429
@${REINPLACE_CMD} -i '' -e 's|^from ._version import|#&|' ${WRKSRC}/spglib/__init__.py
# patch in the correct symspg lib
@${REINPLACE_CMD} -i '' \
-e 's|, bundled_lib)|, "${LOCALBASE}/lib/libsymspg.so")|' \
${WRKSRC}/spglib/spglib.py

.include <bsd.port.mk>
6 changes: 3 additions & 3 deletions science/py-spglib/distinfo
@@ -1,3 +1,3 @@
TIMESTAMP = 1706473147
SHA256 (spglib-spglib-v2.3.0_GH0.tar.gz) = 2fc3b42867d12a41b952ffd5896426797a39564e129c04c9c626d880371614ad
SIZE (spglib-spglib-v2.3.0_GH0.tar.gz) = 2910603
TIMESTAMP = 1707671341
SHA256 (spglib-spglib-v2.3.1_GH0.tar.gz) = 6eb977053b35cd80eb2b5c3fa506a538ff2dad7092a43a612f4f0d4dc2069253
SIZE (spglib-spglib-v2.3.1_GH0.tar.gz) = 2910916
37 changes: 20 additions & 17 deletions science/py-spglib/files/patch-CMakeLists.txt
@@ -1,4 +1,4 @@
--- CMakeLists.txt.orig 2023-09-10 07:23:28 UTC
--- CMakeLists.txt.orig 2024-02-11 01:27:19 UTC
+++ CMakeLists.txt
@@ -1,8 +1,13 @@
+cmake_minimum_required(VERSION 3.15)
Expand All @@ -15,25 +15,28 @@
if (NOT Python_INSTALL_DIR)
if (SKBUILD)
# If built with scikit-build-core, let it handle the installation
@@ -12,7 +17,7 @@ if (NOT Python_INSTALL_DIR)
@@ -12,16 +17,16 @@ endif ()
set(Python_INSTALL_DIR ${Python3_SITEARCH}/spglib)
endif ()
endif ()
-if (SPGLIB_INSTALL)
+if (TRUE)
if (WIN32)
# Windows needs RUNTIME as well to install the .dll file to
install(TARGETS Spglib_symspg
@@ -22,9 +27,9 @@ if (SPGLIB_INSTALL)
else ()
# TODO: Cmake forces to install PUBLIC_HEADER when defined
# https://gitlab.kitware.com/cmake/cmake/-/issues/24326
- install(TARGETS Spglib_symspg
- LIBRARY DESTINATION ${Python_INSTALL_DIR} COMPONENT Spglib_Runtime
- PUBLIC_HEADER DESTINATION ${Python_INSTALL_DIR} COMPONENT Spglib_Runtime)
+ #install(TARGETS Spglib_symspg
+ # LIBRARY DESTINATION ${Python_INSTALL_DIR} COMPONENT Spglib_Runtime
+ # PUBLIC_HEADER DESTINATION ${Python_INSTALL_DIR} COMPONENT Spglib_Runtime)
endif ()
# TODO: Cmake forces to install PUBLIC_HEADER when defined
# https://gitlab.kitware.com/cmake/cmake/-/issues/24326
- install(TARGETS Spglib_symspg
- LIBRARY DESTINATION ${Python_INSTALL_DIR} COMPONENT Spglib_Runtime
- NAMELINK_COMPONENT Spglib_Development
- ARCHIVE DESTINATION ${Python_INSTALL_DIR} COMPONENT Spglib_Development
- PUBLIC_HEADER DESTINATION ${Python_INSTALL_DIR} COMPONENT Spglib_Development
- RUNTIME DESTINATION ${Python_INSTALL_DIR} COMPONENT Spglib_Runtime
- )
+ #install(TARGETS Spglib_symspg
+ # LIBRARY DESTINATION ${Python_INSTALL_DIR} COMPONENT Spglib_Runtime
+ # NAMELINK_COMPONENT Spglib_Development
+ # ARCHIVE DESTINATION ${Python_INSTALL_DIR} COMPONENT Spglib_Development
+ # PUBLIC_HEADER DESTINATION ${Python_INSTALL_DIR} COMPONENT Spglib_Development
+ # RUNTIME DESTINATION ${Python_INSTALL_DIR} COMPONENT Spglib_Runtime
+ #)
install(TARGETS Spglib_python
LIBRARY DESTINATION ${Python_INSTALL_DIR} COMPONENT Spglib_Runtime)
LIBRARY DESTINATION ${Python_INSTALL_DIR} COMPONENT Spglib_Runtime
)
31 changes: 31 additions & 0 deletions science/py-spglib/files/patch-spglib_spglib.py
@@ -0,0 +1,31 @@
--- spglib/spglib.py.orig 2024-02-11 17:45:53 UTC
+++ spglib/spglib.py
@@ -46,17 +46,17 @@ except ImportError:
import re
from ctypes import cdll

- bundled_lib = next(
- filter(
- lambda fl: re.match(".*symspg\\..*", fl),
- sorted(os.listdir(os.path.dirname(__file__))),
- ),
- None,
- )
- if not bundled_lib:
- raise FileNotFoundError(
- "Spglib C library is not installed and no bundled version was detected"
- )
+ #bundled_lib = next(
+ # filter(
+ # lambda fl: re.match(".*symspg\\..*", fl),
+ # sorted(os.listdir(os.path.dirname(__file__))),
+ # ),
+ # None,
+ #)
+ #if not bundled_lib:
+ # raise FileNotFoundError(
+ # "Spglib C library is not installed and no bundled version was detected"
+ # )
cdll.LoadLibrary(os.path.join(os.path.dirname(__file__), bundled_lib))
from spglib import _spglib as spg # type: ignore[attr-defined]

39 changes: 39 additions & 0 deletions science/py-spglib/files/quick-test.py
@@ -0,0 +1,39 @@
import numpy as np
import spglib

lattice = np.array([[0.0, 0.5, 0.5],
[0.5, 0.0, 0.5],
[0.5, 0.5, 0.0]]) * 5.4
positions = [[0.875, 0.875, 0.875],
[0.125, 0.125, 0.125]]
numbers= [1,] * 2
cell = (lattice, positions, numbers)
print(spglib.get_spacegroup(cell, symprec=1e-5))
mesh = [8, 8, 8]

#
# Gamma centre mesh
#
mapping, grid = spglib.get_ir_reciprocal_mesh(mesh, cell, is_shift=[0, 0, 0])

# All k-points and mapping to ir-grid points
for i, (ir_gp_id, gp) in enumerate(zip(mapping, grid)):
print("%3d ->%3d %s" % (i, ir_gp_id, gp.astype(float) / mesh))

# Irreducible k-points
print("Number of ir-kpoints: %d" % len(np.unique(mapping)))
print(grid[np.unique(mapping)] / np.array(mesh, dtype=float))

#
# With shift
#
mapping, grid = spglib.get_ir_reciprocal_mesh(mesh, cell, is_shift=[1, 1, 1])

# All k-points and mapping to ir-grid points
for i, (ir_gp_id, gp) in enumerate(zip(mapping, grid)):
print("%3d ->%3d %s" % (i, ir_gp_id, (gp + [0.5, 0.5, 0.5]) / mesh))

# Irreducible k-points
print("Number of ir-kpoints: %d" % len(np.unique(mapping)))
print((grid[np.unique(mapping)] + [0.5, 0.5, 0.5]) / mesh)

2 changes: 1 addition & 1 deletion science/spglib/Makefile
@@ -1,6 +1,6 @@
PORTNAME= spglib
DISTVERSIONPREFIX= v
DISTVERSION= 2.3.0
DISTVERSION= 2.3.1
CATEGORIES= science

MAINTAINER= yuri@FreeBSD.org
Expand Down
6 changes: 3 additions & 3 deletions science/spglib/distinfo
@@ -1,3 +1,3 @@
TIMESTAMP = 1706472993
SHA256 (spglib-spglib-v2.3.0_GH0.tar.gz) = 2fc3b42867d12a41b952ffd5896426797a39564e129c04c9c626d880371614ad
SIZE (spglib-spglib-v2.3.0_GH0.tar.gz) = 2910603
TIMESTAMP = 1707671227
SHA256 (spglib-spglib-v2.3.1_GH0.tar.gz) = 6eb977053b35cd80eb2b5c3fa506a538ff2dad7092a43a612f4f0d4dc2069253
SIZE (spglib-spglib-v2.3.1_GH0.tar.gz) = 2910916
5 changes: 3 additions & 2 deletions science/spglib/pkg-plist
Expand Up @@ -8,11 +8,12 @@ lib/cmake/Spglib/SpglibConfigVersion.cmake
%%FORTRAN%%lib/cmake/Spglib/SpglibTargets_fortran.cmake
lib/cmake/Spglib/SpglibTargets_shared-%%CMAKE_BUILD_TYPE%%.cmake
lib/cmake/Spglib/SpglibTargets_shared.cmake
%%FORTRAN%%lib/cmake/Spglib/try_compile.f90
%%FORTRAN%%lib/libspglib_f08.so
%%FORTRAN%%lib/libspglib_f08.so.2
%%FORTRAN%%lib/libspglib_f08.so.2.3.0
%%FORTRAN%%lib/libspglib_f08.so.2.3.1
lib/libsymspg.so
lib/libsymspg.so.2
lib/libsymspg.so.2.3.0
lib/libsymspg.so.2.3.1
libdata/pkgconfig/spglib.pc
%%FORTRAN%%libdata/pkgconfig/spglib_f08.pc

0 comments on commit e1e1584

Please sign in to comment.