diff --git a/science/silo/Makefile b/science/silo/Makefile index c17e6b68d35e..5b4c5b58e662 100644 --- a/science/silo/Makefile +++ b/science/silo/Makefile @@ -1,63 +1,50 @@ PORTNAME= silo -PORTVERSION= 4.10.2 -DISTVERSIONSUFFIX= -bsd -PORTREVISION= 15 +DISTVERSION= 4.11-68 +DISTVERSIONSUFFIX= -g819658e CATEGORIES= science -MASTER_SITES= http://wci.llnl.gov/content/assets/docs/simulation/computer-codes/${PORTNAME}/silo-${PORTVERSION}/ -MAINTAINER= dbaio@FreeBSD.org +MAINTAINER= yuri@FreeBSD.org COMMENT= Mesh and field I/O library and scientific database WWW= https://wci.llnl.gov/simulation/computer-codes/silo LICENSE= BSD3CLAUSE LICENSE_FILE= ${WRKSRC}/COPYRIGHT -USES= gmake libtool readline +USES= cmake:testing perl5 readline +USE_PERL5= build USE_LDCONFIG= yes -GNU_CONFIGURE= yes -CONFIGURE_ARGS= --enable-shared --disable-static -INSTALL_TARGET= install-strip +USE_GITHUB= yes +GH_ACCOUNT= LLNL +GH_PROJECT= Silo + +CMAKE_TESTING_ON= SILO_ENABLE_TESTS # 3 tests fail, see https://github.com/LLNL/Silo/issues/289 +CMAKE_TESTING_TARGET= check + +FFLAGS+= -fallow-argument-mismatch # needed only for tests CONFLICTS_INSTALL= deforaos-browser # bin/browser -OPTIONS_DEFINE= FORTRAN HDF5 PYTHON -OPTIONS_DEFAULT= HDF5 +OPTIONS_DEFINE= BROWSER FORTRAN HDF5 PYTHON SILOCK +OPTIONS_DEFAULT= BROWSER FORTRAN HDF5 PYTHON SILOCK OPTIONS_SUB= yes -FORTRAN_CONFIGURE_ENABLE= fortran +BROWSER_DESC= Enable building of browser +BROWSER_CMAKE_BOOL= SILO_ENABLE_BROWSER + +FORTRAN_CMAKE_BOOL= SILO_ENABLE_FORTRAN FORTRAN_USES= fortran -HDF5_LIB_DEPENDS= libhdf5.so:science/hdf5 +HDF5_CMAKE_BOOL= SILO_ENABLE_HDF5 HDF5_CFLAGS= -DH5_USE_110_API=1 -HDF5_CONFIGURE_ON= --with-hdf5=${LOCALBASE}/include,${LOCALBASE}/lib +HDF5_LIB_DEPENDS= libhdf5.so:science/hdf5 HDF5_PLIST_SUB= SUFX_HDF5="h5" HDF5_PLIST_SUB_OFF= SUFX_HDF5="" -PYTHON_CONFIGURE_ENABLE= pythonmodule +PYTHON_CMAKE_BOOL= SILO_ENABLE_PYTHON_MODULE PYTHON_USES= python -post-patch: - @${REINPLACE_CMD} -e \ - 's|\(_Qt_dir/include\)"|\1/qt4"| ; \ - s|\(_Qt_dir/lib\)"|\1/qt4"| ; \ - s|\(/uic\)"|\1-qt4"| ; \ - s|\(/moc\)"|\1-qt4"| ; \ - s|\(/lrelease\)"|\1-qt4"| ; \ - s|\(/lupdate\)"|\1-qt4"|' ${WRKSRC}/configure - @${REINPLACE_CMD} -e \ - '/-avoid-version/s|^|#| ; \ - /^install-data-am/s|:.*|:|' ${WRKSRC}/src/Makefile.in - @${REINPLACE_CMD} -e \ - '/-ldl/s|^|#|' ${WRKSRC}/tests/Makefile.in - @${REINPLACE_CMD} -e \ - 's|@libdir@|@pythondir@|' ${WRKSRC}/tools/python/Makefile.in - @${REINPLACE_CMD} -e \ - 's|\(INBUILD\));|\1, me);|' ${WRKSRC}/src/hdf5_drv/silo_hdf5.c - -.if defined(MAINTAINER_MODE) -regression-test: build - @cd ${WRKSRC}/tests && ${SETENV} ${MAKE_ENV} ${MAKE_CMD} check -.endif +SILOCK_DESC= Enable building of silock +SILOCK_CMAKE_BOOL= SILO_ENABLE_SILOCK .include diff --git a/science/silo/distinfo b/science/silo/distinfo index 65ee1162a92f..a3cf26715bd2 100644 --- a/science/silo/distinfo +++ b/science/silo/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1472243085 -SHA256 (silo-4.10.2-bsd.tar.gz) = 4b901dfc1eb4656e83419a6fde15a2f6c6a31df84edfad7f1dc296e01b20140e -SIZE (silo-4.10.2-bsd.tar.gz) = 13067837 +TIMESTAMP = 1670041617 +SHA256 (LLNL-Silo-4.11-68-g819658e_GH0.tar.gz) = 3a7a75e196c9e39922998054378efa02b2d24dc57ab126ab15a631e2645bd0ce +SIZE (LLNL-Silo-4.11-68-g819658e_GH0.tar.gz) = 14028123 diff --git a/science/silo/files/patch-configure b/science/silo/files/patch-configure deleted file mode 100644 index ddcf3501f05a..000000000000 --- a/science/silo/files/patch-configure +++ /dev/null @@ -1,11 +0,0 @@ ---- configure.orig 2020-09-25 00:15:00 UTC -+++ configure -@@ -30346,7 +30346,7 @@ $as_echo "$am_cv_python_pyexecdir" >&6; } - $as_echo_n "checking for Python include path... " >&6; } - if test -z "$PYTHON_CPPFLAGS"; then - python_path=`$PYTHON -c "import distutils.sysconfig; \ -- print distutils.sysconfig.get_python_inc();"` -+ print(distutils.sysconfig.get_python_inc());"` - if test -n "${python_path}"; then - python_path="-I$python_path" - fi diff --git a/science/silo/files/patch-python3 b/science/silo/files/patch-python3 deleted file mode 100644 index 3eeecfe6837c..000000000000 --- a/science/silo/files/patch-python3 +++ /dev/null @@ -1,768 +0,0 @@ -Author: Alastair McKinstry -Description: Changes needed for Python3 support. - TODO: Changes to the C interface still needed. -Last-Upated: 2014-05-02 -Forwarded: no - -Index: tests/test_error.py -=================================================================== ---- tests/test_error.py -+++ tests/test_error.py -@@ -47,6 +47,7 @@ - # reflect those of the United States Government or Lawrence Livermore - # National Security, LLC, and shall not be used for advertising or - # product endorsement purposes. -+from __future__ import print_function - import os - import Silo - -@@ -56,33 +57,33 @@ elif os.access("multi_ucd3d.h5",os.R_OK) - file = "multi_ucd3d.h5" - - db = Silo.Open(file) --print "db = ",db -+print( "db = ",db) - - try: -- print "Trying to set a bad directory" -+ print ("Trying to set a bad directory") - db.SetDir("Magrathea") - except: -- print " -- Caught error" -+ print (" -- Caught error") - - try: -- print "Trying to read a bad variable" -+ print ("Trying to read a bad variable") - db.GetVar("Arkleseizure") - except: -- print " -- Caught error" -+ print (" -- Caught error") - --print "Closing...." -+print ("Closing....") - db.Close() - --print "db = ",db -+print ("db = ",db) - - try: -- print "Trying to set a directory on a closed file" -+ print ("Trying to set a directory on a closed file") - db.SetDir("domain0") - except: -- print " -- Caught error" -+ print (" -- Caught error") - - try: -- print "Trying to read a variable on a closed file" -+ print ("Trying to read a variable on a closed file") - db.SetDir("dtime") - except: -- print " -- Caught error" -+ print (" -- Caught error") -Index: tests/test_read.py -=================================================================== ---- tests/test_read.py -+++ tests/test_read.py -@@ -47,6 +47,7 @@ - # reflect those of the United States Government or Lawrence Livermore - # National Security, LLC, and shall not be used for advertising or - # product endorsement purposes. -+from __future__ import print_function - import os - import Silo - -@@ -57,31 +58,31 @@ elif os.access("multi_ucd3d.h5",os.R_OK) - file = "multi_ucd3d.h5" - - db = Silo.Open(file) --print "db = ",db --print "db.filename = '%s'"%db.filename -+print ("db = ",db) -+print ("db.filename = '%s'"%db.filename) - - toc = db.GetToc() --print "\n-- TOC --\n",toc -+print ("\n-- TOC --\n",toc) - --print "cycle='%d'"%db.GetVar("cycle") --print "dtime='%f'"%db.GetVar("dtime") --print "_fileinfo='%s'"%db.GetVar("_fileinfo") --print "d_vartypes=",db.GetVar("d_vartypes") --print "d_varnames=",db.GetVar("d_varnames") -+print ("cycle='%d'"%db.GetVar("cycle")) -+print ("dtime='%f'"%db.GetVar("dtime")) -+print ("_fileinfo='%s'"%db.GetVar("_fileinfo")) -+print ("d_vartypes=",db.GetVar("d_vartypes")) -+print ("d_varnames=",db.GetVar("d_varnames")) - - db.SetDir("block0") - toc = db.GetToc() --print "mesh1_coord0=",db.GetVar("mesh1_coord0")[1:10] --print "v_data=",db.GetVar("v_data")[1:10] -+print ("mesh1_coord0=",db.GetVar("mesh1_coord0")[1:10]) -+print ("v_data=",db.GetVar("v_data")[1:10]) - - db.SetDir("../block7") - toc = db.GetToc() --print "mesh1_coord0=",db.GetVar("mesh1_coord0")[1:10] --print "v_data=",db.GetVar("v_data")[1:10] -+print ("mesh1_coord0=",db.GetVar("mesh1_coord0")[1:10]) -+print ("v_data=",db.GetVar("v_data")[1:10]) - - db.Close() - --print "\n" -+print ("\n") - - # ---- file 2 ---- - if os.access("multi_rect3d.pdb",os.R_OK): -@@ -90,23 +91,23 @@ elif os.access("multi_rect3d.h5",os.R_OK - file = "multi_rect3d.h5" - - db = Silo.Open(file) --print "db = ",db -+print ("db = ",db) - - toc = db.GetToc() --print "\n-- TOC --\n",toc -+print ("i\n-- TOC --\n",toc) - --print "cycle='%d'"%db.GetVar("cycle") --print "time='%f'"%db.GetVar("time") --print "_fileinfo='%s'"%db.GetVar("_fileinfo") --print "defvars_defns='%s'"%db.GetVar("defvars_defns") -+print ("cycle='%d'"%db.GetVar("cycle")) -+print ("time='%f'"%db.GetVar("time")) -+print ("_fileinfo='%s'"%db.GetVar("_fileinfo")) -+print ("defvars_defns='%s'"%db.GetVar("defvars_defns")) - - db.SetDir("block0") - toc = db.GetToc() --print "mesh1_coord0=",db.GetVar("mesh1_coord0") -+print ("mesh1_coord0=",db.GetVar("mesh1_coord0")) - - db.SetDir("/block7") - toc = db.GetToc() --print "mesh1_coord0=",db.GetVar("mesh1_coord0") -+print ("mesh1_coord0=",db.GetVar("mesh1_coord0")) - - db.SetDir("/") - toc = db.GetToc() -Index: tests/test_write.py -=================================================================== ---- tests/test_write.py -+++ tests/test_write.py -@@ -47,6 +47,7 @@ - # reflect those of the United States Government or Lawrence Livermore - # National Security, LLC, and shall not be used for advertising or - # product endorsement purposes. -+from __future__ import silo - import Silo - - db = Silo.Create("foo.silo", "test file") -Index: tools/python/pydbtoc.cpp -=================================================================== ---- tools/python/pydbtoc.cpp -+++ tools/python/pydbtoc.cpp -@@ -48,6 +48,10 @@ - // National Security, LLC, and shall not be used for advertising or - // product endorsement purposes. - -+// #if PY_MAJOR_VERSION >= 3 -+#define PyString_FromString(x) PyUnicode_FromString(x) -+// #endif -+ - #include "pydbtoc.h" - - // **************************************************************************** -@@ -200,7 +204,7 @@ static int DBtoc_print(PyObject *self, F - static PyObject *DBtoc_GetN ## nm(PyObject *self, PyObject *args) \ - { \ - DBtoc *toc = ((DBtocObject*)self)->toc; \ -- PyObject *retval = PyInt_FromLong(toc->n ## nm); \ -+ PyObject *retval = PyLong_FromLong(toc->n ## nm); \ - return retval; \ - } \ - static PyObject *DBtoc_Get ## nm ## names(PyObject *self, PyObject *args) \ -@@ -341,46 +345,60 @@ PyTypeObject DBtocType = - // Type header - // - PyObject_HEAD_INIT(&PyType_Type) -- 0, // ob_size -- "DBtoc", // tp_name -- sizeof(DBtocObject), // tp_basicsize -- 0, // tp_itemsize -+#if PY_MAJOR_VERSION < 3 -+ ob_size : 0, -+#endif -+ tp_name : "DBtoc", -+ tp_basicsize : sizeof(DBtocObject), -+ tp_itemsize : 0, - // - // Standard methods - // -- (destructor)DBtoc_dealloc, // tp_dealloc -- (printfunc)DBtoc_print, // tp_print -- (getattrfunc)DBtoc_getattr, // tp_getattr -- 0,//(setattrfunc)DBtoc_setattr, // tp_setattr -- this object is read-only -- (cmpfunc)DBtoc_compare, // tp_compare -- (reprfunc)0, // tp_repr -+ tp_dealloc : (destructor)DBtoc_dealloc, -+ tp_print : (printfunc)DBtoc_print, -+#if PY_MAJOR_VERSION >= 3 -+ tp_getattr : 0, -+#else -+ tp_getattr : (getattrfunc)DBtoc_getattr, -+#endif -+ tp_setattr : 0, // object is read-only -+#if PY_MAJOR_VERSION >= 3 -+ tp_as_async : (PyAsyncMethods*) NULL, -+#else -+ tp_compare : (cmpfunc)DBtoc_compare, -+#endif -+ tp_repr : (reprfunc)0, - // - // Type categories - // -- 0, // tp_as_number -- 0, // tp_as_sequence -- 0, // tp_as_mapping -+ tp_as_number : 0, -+ tp_as_sequence : 0, -+ tp_as_mapping : 0, - // - // More methods - // -- 0, // tp_hash -- 0, // tp_call -- (reprfunc)DBtoc_str, // tp_str -- 0, // tp_getattro -- 0, // tp_setattro -- 0, // tp_as_buffer -- Py_TPFLAGS_CHECKTYPES, // tp_flags -- "This class wraps a Silo DBtoc object.", // tp_doc -- 0, // tp_traverse -- 0, // tp_clear -- 0, // tp_richcompare -- 0 // tp_weaklistoffset -+ -+ tp_hash : 0, -+ tp_call : 0, -+ tp_str : (reprfunc)DBtoc_str, -+ tp_getattro : 0, -+ tp_setattro : 0, -+ tp_as_buffer : 0, -+#if PY_MAJOR_VERSION < 3 -+ tp_flags : Py_TPFLAGS_CHECKTYPES, -+#else -+ tp_flags : Py_TPFLAGS_DEFAULT, -+#endif -+ tp_doc : "This class wraps a Silo DBtoc object.", -+ tp_traverse : 0, -+ tp_clear : 0, -+ tp_richcompare : 0, -+ tp_weaklistoffset : 0, - // PYTHON 2.2 FROM HERE -- , - 0, - 0, - 0, -- -+ 0, - }; - - // **************************************************************************** -Index: tools/python/pydbfile.cpp -=================================================================== ---- tools/python/pydbfile.cpp -+++ tools/python/pydbfile.cpp -@@ -56,6 +56,19 @@ - - using std::string; - -+#if PY_MAJOR_VERSION >= 3 -+#define PyInt_FromLong(x) (PyLong_FromLong(x)) -+#define PyInt_Check(x) (PyLong_Check(x)) -+#define PyString_Check(x) PyUnicode_Check(x) -+#define PyInt_AS_LONG(x) PyLong_AsLong(x) -+#define PyString_FromStringAndSize(x,y) PyUnicode_FromStringAndSize(x,y) -+#define PyString_FromString(x) PyUnicode_FromString(x) -+#define PyString_AsString(x) PyUnicode_AsUTF8(x) -+ -+#else -+#define Py_RETURN_NOTIMPLEMENTED return NULL -+#endif -+ - // **************************************************************************** - // Method: DBfile_DBGetToc - // -@@ -75,8 +88,8 @@ static PyObject *DBfile_DBGetToc(PyObjec - - if (!obj->db) - { -- SiloErrorFunc("This file has been closed."); -- return NULL; -+ SiloErrorFunc(self, "This file has been closed."); -+ return NULL; - } - - DBtoc *toc = DBGetToc(obj->db); -@@ -122,7 +135,7 @@ static PyObject *DBfile_DBGetVar(PyObjec - - if (!db) - { -- SiloErrorFunc("This file has been closed."); -+ SiloErrorFunc(self, "This file has been closed."); - return NULL; - } - -@@ -162,7 +175,7 @@ static PyObject *DBfile_DBGetVar(PyObjec - return PyString_FromStringAndSize((char*)var, len); - } - default: -- SiloErrorFunc("Unknown variable type."); -+ SiloErrorFunc(self, "Unknown variable type."); - return NULL; - } - } -@@ -193,7 +206,7 @@ static PyObject *DBfile_DBGetVar(PyObjec - tmp = PyInt_FromLong(((char*)var)[i]); - break; - default: -- SiloErrorFunc("Unknown variable type."); -+ SiloErrorFunc(self, "Unknown variable type."); - return NULL; - } - PyTuple_SET_ITEM(retval, i, tmp); -@@ -220,7 +233,7 @@ static PyObject *DBfile_DBGetVarInfo(PyO - - if (!db) - { -- SiloErrorFunc("This file has been closed."); -+ SiloErrorFunc(self, "This file has been closed."); - return NULL; - } - -@@ -247,7 +260,7 @@ static PyObject *DBfile_DBGetVarInfo(PyO - { - char msg[256]; - snprintf(msg, sizeof(msg), "Unable to get object \"%s\"", str); -- SiloErrorFunc(msg); -+ SiloErrorFunc(self, msg); - return NULL; - } - -@@ -263,7 +276,7 @@ static PyObject *DBfile_DBGetVarInfo(PyO - { - char msg[256]; - snprintf(msg, sizeof(msg), "Unable to get component \"%s\" for object \%s\"", compname.c_str(), str); -- SiloErrorFunc(msg); -+ SiloErrorFunc(self, msg); - continue; - } - int type = DBGetComponentType(db, str, compname.c_str()); -@@ -371,7 +384,7 @@ static PyObject *DBfile_DBWrite(PyObject - - if (!db) - { -- SiloErrorFunc("This file has been closed."); -+ SiloErrorFunc(self, "This file has been closed."); - return NULL; - } - -@@ -495,8 +508,8 @@ static PyObject *DBfile_DBWriteObject(Py - - if (!db) - { -- SiloErrorFunc("This file has been closed."); -- return NULL; -+ SiloErrorFunc(self, "This file has been closed."); -+ return NULL; - } - - char *objname; -@@ -591,7 +604,7 @@ static PyObject *DBfile_DBMkDir(PyObject - - if (!db) - { -- SiloErrorFunc("This file has been closed."); -+ SiloErrorFunc(self, "This file has been closed."); - return NULL; - } - -@@ -601,7 +614,7 @@ static PyObject *DBfile_DBMkDir(PyObject - - if (DBMkDir(db, str)) - { -- SiloErrorFunc("Could not make the directory."); -+ SiloErrorFunc(self, "Could not make the directory."); - return NULL; - } - else -@@ -630,7 +643,7 @@ static PyObject *DBfile_DBSetDir(PyObjec - - if (!db) - { -- SiloErrorFunc("This file has been closed."); -+ SiloErrorFunc(self, "This file has been closed."); - return NULL; - } - -@@ -640,7 +653,7 @@ static PyObject *DBfile_DBSetDir(PyObjec - - if (DBSetDir(db, str)) - { -- SiloErrorFunc("Could not change directories."); -+ SiloErrorFunc(self, "Could not change directories."); - return NULL; - } - else -@@ -669,7 +682,7 @@ static PyObject *DBfile_DBClose(PyObject - - if (!db) - { -- SiloErrorFunc("This file has been closed."); -+ SiloErrorFunc(self, "This file has been closed."); - return NULL; - } - -@@ -678,7 +691,7 @@ static PyObject *DBfile_DBClose(PyObject - - if (DBClose(db)) - { -- SiloErrorFunc("Could not close the file."); -+ SiloErrorFunc(self, "Could not close the file."); - return NULL; - } - else -@@ -804,13 +817,15 @@ static int DBfile_print(PyObject *self, - // Creation: July 12, 2005 - // - // **************************************************************************** -+ -+#if PY_MAJOR_VERSION < 3 - static PyObject *DBfile_getattr(PyObject *self, char *name) - { - DBfileObject *obj = (DBfileObject*)self; - - if (!obj->db) - { -- SiloErrorFunc("This file has been closed."); -+ SiloErrorFunc(self, "This file has been closed."); - return NULL; - } - -@@ -828,6 +843,7 @@ static PyObject *DBfile_getattr(PyObject - - return Py_FindMethod(DBfile_methods, self, name); - } -+#endif - - // **************************************************************************** - // Method: DBfile_compare -@@ -849,6 +865,17 @@ static int DBfile_compare(PyObject *v, P - return (a= 3 -+ tp_getattr : 0, -+#else -+ tp_getattr : (getattrfunc)DBfile_getattr, -+#endif -+ tp_setattr : 0, // object is read-only -+#if PY_MAJOR_VERSION >= 3 -+ tp_as_async : (PyAsyncMethods*) NULL, -+#else -+ tp_compare : (cmpfunc)DBfile_compare, -+#endif -+ tp_repr : (reprfunc)0, -+ // -+ // Type categories -+ // -+ tp_as_number : 0, -+ tp_as_sequence : 0, -+ tp_as_mapping : 0, - // - // More methods - // -- 0, // tp_hash -- 0, // tp_call -- (reprfunc)DBfile_str, // tp_str -- 0, // tp_getattro -- 0, // tp_setattro -- 0, // tp_as_buffer -- Py_TPFLAGS_CHECKTYPES, // tp_flags -- "This class wraps a Silo DBfile object.", // tp_doc -- 0, // tp_traverse -- 0, // tp_clear -- 0, // tp_richcompare -- 0 // tp_weaklistoffset -+ tp_hash : 0, -+ tp_call : 0, -+ tp_str : (reprfunc)DBfile_str, -+ tp_getattro : 0, -+ tp_setattro : 0, -+ tp_as_buffer : 0, -+#if PY_MAJOR_VERSION >= 3 -+ tp_flags : Py_TPFLAGS_DEFAULT, -+#else -+ tp_flags : Py_TPFLAGS_CHECKTYPES, -+#endif -+ tp_doc : "This class wraps a Silo DBfile object.", -+ tp_traverse : 0, -+ tp_clear : 0, -+ tp_richcompare : (richcmpfunc)DBfile_richcompare, -+ tp_weaklistoffset : 0, - }; - - // **************************************************************************** -Index: tools/python/pysilo.h -=================================================================== ---- tools/python/pysilo.h -+++ tools/python/pysilo.h -@@ -65,6 +65,6 @@ - ((PY_MAJOR_VERSION==Maj) && (PY_MINOR_VERSION>Min)) || \ - (PY_MAJOR_VERSION>Maj)) - --void SiloErrorFunc(const char *errString); -+void SiloErrorFunc(PyObject *self, const char *errString); - - #endif -Index: tools/python/pysilo.cpp -=================================================================== ---- tools/python/pysilo.cpp -+++ tools/python/pysilo.cpp -@@ -57,14 +57,16 @@ - #include - using namespace std; - --static PyObject *SiloError; --static PyObject *siloModule = 0; -- --// --// Method table --// -- --std::vector SiloMethods; -+struct silo_state { -+ PyObject *error; -+}; -+ -+#if PY_MAJOR_VERSION >= 3 -+#define GETSTATE(m) ((struct silo_state*)PyModule_GetState(m)) -+#else -+#define GETSTATE(m) (&_state) -+static struct silo_state _state; -+#endif - - - // **************************************************************************** -@@ -85,38 +87,10 @@ std::vector SiloMethods; - // **************************************************************************** - - void --SiloErrorFunc(const char *errString) --{ -- PyErr_SetString(SiloError, errString); --} -- --// **************************************************************************** --// Function: AddMethod --// --// Purpose: --// This function adds a method to the Silo module's Python method table. --// --// Arguments: --// methodName : The name of the method. --// cb : The Python callback function. --// doc : The documentation string for the method. --// --// Programmer: Brad Whitlock --// Creation: Tue Sep 4 15:36:47 PST 2001 --// --// Modifications: --// --// **************************************************************************** --static void --AddMethod(const char *methodName, PyObject *(cb)(PyObject *, PyObject *), -- const char *doc = NULL) -+SiloErrorFunc(PyObject *self, const char *errString) - { -- PyMethodDef newMethod; -- newMethod.ml_name = (char *)methodName; -- newMethod.ml_meth = cb; -- newMethod.ml_flags = METH_VARARGS; -- newMethod.ml_doc = (char *)doc; -- SiloMethods.push_back(newMethod); -+ struct silo_state *st = GETSTATE(self); -+ PyErr_SetString(st->error, errString); - } - - -@@ -208,6 +182,47 @@ PyObject *silo_Create(PyObject *self, Py - return DBfile_NEW(db); - } - -+static PyMethodDef silo_methods[] = { -+ {"Open", silo_Open, METH_VARARGS, NULL}, -+ {"Create", silo_Create, METH_VARARGS, NULL }, -+ {NULL, NULL} -+}; -+ -+ -+#if PY_MAJOR_VERSION >= 3 -+ -+static int silo_Traverse(PyObject *m, visitproc visit, void *arg) { -+ Py_VISIT(GETSTATE(m)->error); -+ return 0; -+} -+ -+static int silo_Clear(PyObject *m) { -+ Py_CLEAR(GETSTATE(m)->error); -+ return 0; -+} -+ -+static struct PyModuleDef moduledef = { -+ m_base : PyModuleDef_HEAD_INIT, -+ m_name : "Silo", -+ m_doc : NULL, -+ m_size : sizeof(struct silo_state), -+ m_methods : silo_methods, -+ m_slots : NULL, -+ m_traverse : silo_Traverse, -+ m_clear : silo_Clear, -+ m_free : NULL -+}; -+ -+#define ADD_CONSTANT(C) PyDict_SetItemString(d, #C, PyLong_FromLong(C)) -+#define INITERROR return NULL -+ -+#else // Python2.* -+ -+#define ADD_CONSTANT(C) PyDict_SetItemString(d, #C, PyInt_FromLong(C)) -+#define INITERROR return -+ -+#endif -+ - // **************************************************************************** - // Method: initSilo - // -@@ -226,23 +241,39 @@ PyObject *silo_Create(PyObject *self, Py - // contents returned by GetVarInfo method. - // - // **************************************************************************** --#define ADD_CONSTANT(C) PyDict_SetItemString(d, #C, PyInt_FromLong(C)) -+ -+ -+ -+#if PY_MAJOR_VERSION >= 3 -+PyMODINIT_FUNC PyInit_Silo(void) -+#else - extern "C" void initSilo() -+#endif - { -- AddMethod("Open", silo_Open, -- "Usage: Open(filename [, DB_READ|DB_APPEND]])"); -- AddMethod("Create", silo_Create, -- "Usage: Create(filename , info [, DB_PDB|DB_HDF5 [, DB_CLOBBER|DB_NOCLOBBER]])"); -- AddMethod(NULL, NULL); - - -- siloModule = Py_InitModule("Silo", &SiloMethods[0]); -- -- PyObject *d; -- d = PyModule_GetDict(siloModule); -- SiloError = PyErr_NewException("Silo.SiloException", NULL, NULL); -- PyDict_SetItemString(d, "SiloException", SiloError); - -+ struct silo_state *st; -+ PyObject *d; -+ -+#if PY_MAJOR_VERSION >= 3 -+ PyObject *module = PyModule_Create(&moduledef); -+#else -+ PyObject *module = Py_InitModule("Silo", silo_methods); -+#endif -+ -+ if (module == NULL) -+ INITERROR; -+ -+ st = GETSTATE(module); -+ st->error = PyErr_NewException("Silo.SiloException", NULL, NULL); -+ // PyDict_SetItemString(d, "SiloException", SiloError); -+ if (st->error == NULL) { -+ Py_DECREF(module); -+ INITERROR; -+ } -+ d = PyModule_GetDict(module); -+ - // File Drivers - ADD_CONSTANT(DB_PDB); - ADD_CONSTANT(DB_HDF5); -@@ -322,4 +353,8 @@ extern "C" void initSilo() - ADD_CONSTANT(DB_VARTYPE_MATERIAL); - ADD_CONSTANT(DB_VARTYPE_SPECIES); - ADD_CONSTANT(DB_VARTYPE_LABEL); -+ -+#if PY_MAJOR_VERSION >=3 -+ return module; -+#endif - } diff --git a/science/silo/files/patch-python3.8 b/science/silo/files/patch-python3.8 deleted file mode 100644 index 3b4f744b9ef0..000000000000 --- a/science/silo/files/patch-python3.8 +++ /dev/null @@ -1,45 +0,0 @@ -Description: Fix for API change with python3.8 -Author: Alastair McKinstry -Last-Updated: 2019-10-25 -Forwarded: no - -Index: tools/python/pydbfile.cpp -=================================================================== ---- tools/python/pydbfile.cpp -+++ tools/python/pydbfile.cpp -@@ -69,6 +69,7 @@ using std::string; - #define Py_RETURN_NOTIMPLEMENTED return NULL - #endif - -+ - // **************************************************************************** - // Method: DBfile_DBGetToc - // -@@ -900,7 +901,11 @@ PyTypeObject DBfileType = - // Standard methods - // - tp_dealloc : (destructor)DBfile_dealloc, -+#if (PY_MAJOR_VERSION <= 3) && (PY_MINOR_VERSION <= 7) - tp_print : (printfunc)DBfile_print, -+#else -+ tp_vectorcall_offset : (printfunc)DBfile_print, -+#endif - #if PY_MAJOR_VERSION >= 3 - tp_getattr : 0, - #else -Index: tools/python/pydbtoc.cpp -=================================================================== ---- tools/python/pydbtoc.cpp -+++ tools/python/pydbtoc.cpp -@@ -355,7 +355,11 @@ PyTypeObject DBtocType = - // Standard methods - // - tp_dealloc : (destructor)DBtoc_dealloc, -+#if (PY_MAJOR_VERSION <= 3) && (PY_MINOR_VERSION <= 7) - tp_print : (printfunc)DBtoc_print, -+#else -+ tp_vectorcall_offset : (printfunc)DBtoc_print, -+#endif - #if PY_MAJOR_VERSION >= 3 - tp_getattr : 0, - #else diff --git a/science/silo/files/patch-src_hdf5__drv_H5FDsilo.c b/science/silo/files/patch-src_hdf5__drv_H5FDsilo.c deleted file mode 100644 index 7b05cc0a87fc..000000000000 --- a/science/silo/files/patch-src_hdf5__drv_H5FDsilo.c +++ /dev/null @@ -1,81 +0,0 @@ ---- src/hdf5_drv/H5FDsilo.c.orig 2014-10-14 00:22:32 UTC -+++ src/hdf5_drv/H5FDsilo.c -@@ -160,27 +160,15 @@ product endorsement purposes. - * xxx64 versions if available. - */ - #if !defined(HDfstat) || !defined(HDstat) -- #if H5_SIZEOF_OFF_T!=8 && H5_SIZEOF_OFF64_T==8 && defined(H5_HAVE_STAT64) -- #ifndef HDfstat -- #define HDfstat(F,B) fstat64(F,B) -- #endif /* HDfstat */ -- #ifndef HDstat -- #define HDstat(S,B) stat64(S,B) -- #endif /* HDstat */ -- typedef struct stat64 h5_stat_t; -- typedef off64_t h5_stat_size_t; -- #define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF64_T -- #else /* H5_SIZEOF_OFF_T!=8 && ... */ -- #ifndef HDfstat -- #define HDfstat(F,B) fstat(F,B) -- #endif /* HDfstat */ -- #ifndef HDstat -- #define HDstat(S,B) stat(S,B) -- #endif /* HDstat */ -- typedef struct stat h5_stat_t; -- typedef off_t h5_stat_size_t; -- #define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T -- #endif /* H5_SIZEOF_OFF_T!=8 && ... */ -+ #ifndef HDfstat -+ #define HDfstat(F,B) fstat(F,B) -+ #endif /* HDfstat */ -+ #ifndef HDstat -+ #define HDstat(S,B) stat(S,B) -+ #endif /* HDstat */ -+ typedef struct stat h5_stat_t; -+ typedef off_t h5_stat_size_t; -+ #define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T - #endif /* !defined(HDfstat) || !defined(HDstat) */ - #ifndef HDlseek - #ifdef H5_HAVE_LSEEK64 -@@ -255,13 +243,13 @@ static const char *flavors(H5F_mem_t m) - snprintf(msg, sizeof(msg), Msg "(errno=%d, \"%s\")", \ - Errno, strerror(Errno)); \ - ret_value = Ret; \ -- H5Epush_ret(Func, Cls, Maj, Min, msg, Ret) \ -+ H5Epush_ret(Func, Cls, Maj, Min, msg, Ret); \ - } - #else - #define H5E_PUSH_HELPER(Func,Cls,Maj,Min,Msg,Ret,Errno) \ - { \ - ret_value = Ret; \ -- H5Epush_ret(Func, Cls, Maj, Min, Msg, Ret) \ -+ H5Epush_ret(Func, Cls, Maj, Min, Msg, Ret); \ - } - #endif - -@@ -1308,7 +1296,7 @@ H5FD_silo_sb_encode(H5FD_t *_file, char *name/*out*/, - assert(sizeof(hsize_t)<=8); - memcpy(p, &file->block_size, sizeof(hsize_t)); - if (H5Tconvert(H5T_NATIVE_HSIZE, H5T_STD_U64LE, 1, buf+8, NULL, H5P_DEFAULT)<0) -- H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1) -+ H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1); - - return 0; - } -@@ -1336,14 +1324,14 @@ H5FD_silo_sb_decode(H5FD_t *_file, const char *name, c - - /* Make sure the name/version number is correct */ - if (strcmp(name, "LLNLsilo")) -- H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "invalid silo superblock", -1) -+ H5Epush_ret(func, H5E_ERR_CLS, H5E_FILE, H5E_BADVALUE, "invalid silo superblock", -1); - - buf += 8; - /* Decode block size */ - assert(sizeof(hsize_t)<=8); - memcpy(x, buf, 8); - if (H5Tconvert(H5T_STD_U64LE, H5T_NATIVE_HSIZE, 1, x, NULL, H5P_DEFAULT)<0) -- H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1) -+ H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1); - ap = (hsize_t*)x; - /*file->block_size = *ap; ignore stored value for now */ - diff --git a/science/silo/files/patch-src_silo_silo.c b/science/silo/files/patch-src_silo_silo.c index 3dc31c5c2579..d20855c5ca9b 100644 --- a/science/silo/files/patch-src_silo_silo.c +++ b/science/silo/files/patch-src_silo_silo.c @@ -1,39 +1,39 @@ ---- src/silo/silo.c.orig 2014-10-14 00:22:33 UTC +--- src/silo/silo.c.orig 2022-12-03 02:30:10 UTC +++ src/silo/silo.c -@@ -226,12 +226,8 @@ typedef struct db_silo_stat_t { +@@ -238,12 +238,8 @@ typedef struct db_silo_stat_t { #ifndef SIZEOF_OFF64_T #error missing definition for SIZEOF_OFF64_T in silo_private.h #else -#if SIZEOF_OFF64_T > 4 - struct stat64 s; -#else struct stat s; #endif -#endif #ifdef _WIN32 DWORD fileindexlo; DWORD fileindexhi; -@@ -2283,11 +2279,7 @@ db_silo_stat_one_file(const char *name, +@@ -2121,11 +2117,7 @@ db_silo_stat_one_file(const char *name, db_silo_stat_t errno = 0; memset(&(statbuf->s), 0, sizeof(statbuf->s)); -#if SIZEOF_OFF64_T > 4 - retval = stat64(name, &(statbuf->s)); -#else retval = stat(name, &(statbuf->s)); -#endif /* #if SIZEOF_OFF64_T > 4 */ #ifdef _WIN32 if (retval == 0) -@@ -4225,11 +4217,7 @@ DBOpenReal(const char *name, int type, i +@@ -4136,11 +4128,7 @@ DBOpenReal(const char *name, int type, int mode) /********************************/ /* System level error occured. */ /********************************/ -#if SIZEOF_OFF64_T > 4 - printf("stat64() failed with error: "); -#else printf("stat() failed with error: "); -#endif switch (errno) { case EACCES: printf("EACCES\n"); break; diff --git a/science/silo/files/patch-src_silo_silo__json.c b/science/silo/files/patch-src_silo_silo__json.c index 39fbe59bbae4..576f7eea757f 100644 --- a/science/silo/files/patch-src_silo_silo__json.c +++ b/science/silo/files/patch-src_silo_silo__json.c @@ -1,15 +1,14 @@ ---- src/silo/silo_json.c.orig 2014-10-14 00:22:33 UTC +--- src/silo/silo_json.c.orig 2022-12-03 02:30:10 UTC +++ src/silo/silo_json.c -@@ -441,12 +441,8 @@ json_object_from_binary_file(char const +@@ -441,11 +441,7 @@ json_object_from_binary_file(char const *filename) #ifndef SIZEOF_OFF64_T #error missing definition for SIZEOF_OFF64_T in silo_private.h #else -#if SIZEOF_OFF64_T > 4 - struct stat64 s; -#else struct stat s; - #endif -#endif + #endif errno = 0; - memset(&s, 0, sizeof(s)); diff --git a/science/silo/files/patch-tests_CMake_SiloMakeCheckRunner.cmake b/science/silo/files/patch-tests_CMake_SiloMakeCheckRunner.cmake new file mode 100644 index 000000000000..c25272a9a103 --- /dev/null +++ b/science/silo/files/patch-tests_CMake_SiloMakeCheckRunner.cmake @@ -0,0 +1,13 @@ +- workaround for https://github.com/LLNL/Silo/issues/288 + +--- tests/CMake/SiloMakeCheckRunner.cmake.orig 2022-12-03 06:53:38 UTC ++++ tests/CMake/SiloMakeCheckRunner.cmake +@@ -72,7 +72,7 @@ function(silo_add_make_check_runner) + message(WARNING "silo_add_make_check_runner: NAME argument is required.") + return() + endif() +- set(test_cmd ${samcr_NAME}) ++ set(test_cmd "./${samcr_NAME}") + if("ARGS" IN_LIST samcr_KEYWORDS_MISSING_VALUES) + message(WARNING "silo_add_make_check_runner: ARGS argument provided without a value.") + return() diff --git a/science/silo/pkg-plist b/science/silo/pkg-plist index 16b6f58b50e2..c55c7a873580 100644 --- a/science/silo/pkg-plist +++ b/science/silo/pkg-plist @@ -1,15 +1,20 @@ -bin/browser -bin/silock -bin/silodiff -bin/silofile -include/ioperf.h +%%BROWSER%%bin/browser +%%PYTHON%%bin/s2ex.py +%%SILOCK%%bin/silock +%%BROWSER%%bin/silodiff +%%BROWSER%%bin/silofile +cmake/SiloConfig.cmake +cmake/SiloConfigVersion.cmake +cmake/SiloTargets-%%CMAKE_BUILD_TYPE%%.cmake +cmake/SiloTargets.cmake +include/lite_pdb.h +include/lite_score.h +include/pdform.h include/pmpio.h include/silo.h +include/silo.inc +%%FORTRAN%%include/silo_FC.h include/silo_exports.h -include/silo_f77.inc include/silo_f9x.inc -include/silo.inc -%%PYTHON%%%%PYTHON_SITELIBDIR%%/Silo.so +%%PYTHON%%lib/Silo.so lib/libsilo%%SUFX_HDF5%%.so -lib/libsilo%%SUFX_HDF5%%.so.0 -lib/libsilo%%SUFX_HDF5%%.so.0.0.0