diff options
-rw-r--r-- | .SRCINFO | 35 | ||||
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | .gitlab-ci.yml | 4 | ||||
-rw-r--r-- | Dockerfile.build_and_test | 2 | ||||
-rw-r--r-- | PKGBUILD | 61 | ||||
-rw-r--r-- | gdl-graphicsmagick.patch | 14 | ||||
-rw-r--r-- | gdl-mallinfo2.patch | 69 | ||||
-rw-r--r-- | gdl-python3.patch | 332 | ||||
-rw-r--r-- | gdl-tiff.patch | 199 |
9 files changed, 320 insertions, 400 deletions
@@ -1,33 +1,32 @@ pkgbase = gnudatalanguage pkgdesc = An IDL (Interactive Data Language) compatible incremental compiler (ie. runs IDL programs) - pkgver = 0.9.9 - pkgrel = 5 + pkgver = 1.0.0_rc.3 + pkgrel = 1 url = https://github.com/gnudatalanguage/gdl arch = i686 arch = x86_64 license = GPL makedepends = cmake - depends = python-numpy - depends = plplot - depends = gsl - depends = hdf4 - depends = netcdf-cxx - depends = wxgtk2 - depends = fftw - depends = pslib depends = eccodes - depends = udunits depends = eigen + depends = fftw + depends = glpk depends = graphicsmagick + depends = gsl + depends = hdf4 depends = libgeotiff - source = https://github.com/gnudatalanguage/gdl/archive/v0.9.9.tar.gz + depends = plplot + depends = python-numpy + depends = shapelib + depends = udunits + depends = wxgtk2 + source = gnudatalanguage-1.0.0_rc.3.tar.gz::https://github.com/gnudatalanguage/gdl/archive/v1.0.0-rc.3.tar.gz source = gdl.profile - source = gdl-python3.patch - source = gdl-graphicsmagick.patch - sha512sums = 41709c4951bbf71f7494eb339b6760756301b89b591020cb5a30c47d3b6f6228671a7d75b817e77f3ff6f1380505d27949e2900eb2577167de995f4941f288ee + source = gdl-mallinfo2.patch + source = gdl-tiff.patch + sha512sums = 3fde22c7e709b9cdc72a23d2317c043037379c7903418211a699c7e5caa2ed17e78e32e6d2f9b4aa89200e729fc21555821140dfdd58a5a636a858e2841f6335 sha512sums = b3a3589d2ce8eb5d49c902aa9bc43df0a0fcc369d17deb060026d34fa821881a212ce6aa02edc7ea6c0476b2faacc7455e467af7b5baf672e2653b71b162190f - sha512sums = 0155857c3fe00cefc8f078a57105aae4b26a5aa93b6b44327f78861041c51a14e6581499021ad64bff24ac514a535a1340a690f135aa5ab38e19e98e5f32eb5e - sha512sums = 08aa02df5b15325a3bb9e0086063ea39bcef667b947952c1c16dfe94fb13a45beb280b3dc38e772169a78f25b2a782c1c02e073b7ec9f3d395e6ec0071e441a6 + sha512sums = e57a1d75039ac7c0654fb03bd0c95b6efb7beb605ea0a303af964fe7408f5d9497abd408fabb38fdb1d8b8dff86c2beefec0bb16df399b39284ddb4e22672f68 + sha512sums = d55b2970c9ddfb0b78790e7fa876bf28ebef9e936d56c77105572b85095337cb65c7b564515b42afeafe5fa03d8faa562183ecb3c04fe592f6775cce5d4662bc pkgname = gnudatalanguage - diff --git a/.gitignore b/.gitignore index 298ce9caa4b3..feda2b54720f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,8 @@ /* !.gitignore !gdl.profile -!gdl-python3.patch -!gdl-graphicsmagick.patch +!gdl-mallinfo2.patch +!gdl-tiff.patch !PKGBUILD !.SRCINFO !.gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a89f0bdaf0ba..8f3a04d10c82 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -61,11 +61,11 @@ test-gnudatalanguage: image: ${CI_REGISTRY_IMAGE}/${BUILD_AND_TEST_IMAGE}:${CI_COMMIT_REF_NAME} needs: ["build-gnudatalanguage"] script: + # Try to install package + - sudo pacman -U --noconfirm gnudatalanguage*.pkg.tar.zst # Recommended checks - namcap -m PKGBUILD - namcap -m gnudatalanguage*.pkg.tar.zst - # Try to install package - - sudo pacman -U --noconfirm gnudatalanguage*.pkg.tar.zst deploy-gnudatalanguage: stage: deploy diff --git a/Dockerfile.build_and_test b/Dockerfile.build_and_test index 0945f26e9ee9..af87d051bf6f 100644 --- a/Dockerfile.build_and_test +++ b/Dockerfile.build_and_test @@ -3,7 +3,7 @@ ARG REGISTRY FROM "$REGISTRY/common/gitlab-helper/archlinux-yay:master" RUN (\ - yay -Syuq --noconfirm --needed python-numpy plplot gsl hdf4 netcdf-cxx wxgtk2 fftw pslib eccodes udunits eigen graphicsmagick libgeotiff \ + yay -Syuq --noconfirm --needed python-numpy eigen plplot gsl hdf4 wxgtk2 fftw pslib eccodes udunits graphicsmagick libgeotiff glpk shapelib \ && yes | yay -Scc --noconfirm \ && rm -rf ~/.cache/yay \ && sudo rm -rf /var/cache/pacman/pkg/* \ @@ -4,57 +4,56 @@ # Contributor: Orlando Garcia Feal <rodland at gmail dot com> pkgname=gnudatalanguage -pkgver=0.9.9 -pkgrel=5 +pkgver=1.0.0_rc.3 +pkgrel=1 pkgdesc="An IDL (Interactive Data Language) compatible incremental compiler (ie. runs IDL programs)" -arch=('i686' 'x86_64') +arch=("i686" "x86_64") url="https://github.com/gnudatalanguage/gdl" -license=('GPL') -depends=('python-numpy' 'plplot' 'gsl' 'hdf4' 'netcdf-cxx' 'wxgtk2' 'fftw' - 'pslib' 'eccodes' 'udunits' 'eigen' 'graphicsmagick' 'libgeotiff') -makedepends=('cmake') -source=("https://github.com/gnudatalanguage/gdl/archive/v${pkgver}.tar.gz" - 'gdl.profile' - 'gdl-python3.patch' - 'gdl-graphicsmagick.patch') -sha512sums=('41709c4951bbf71f7494eb339b6760756301b89b591020cb5a30c47d3b6f6228671a7d75b817e77f3ff6f1380505d27949e2900eb2577167de995f4941f288ee' - 'b3a3589d2ce8eb5d49c902aa9bc43df0a0fcc369d17deb060026d34fa821881a212ce6aa02edc7ea6c0476b2faacc7455e467af7b5baf672e2653b71b162190f' - '0155857c3fe00cefc8f078a57105aae4b26a5aa93b6b44327f78861041c51a14e6581499021ad64bff24ac514a535a1340a690f135aa5ab38e19e98e5f32eb5e' - '08aa02df5b15325a3bb9e0086063ea39bcef667b947952c1c16dfe94fb13a45beb280b3dc38e772169a78f25b2a782c1c02e073b7ec9f3d395e6ec0071e441a6') +license=("GPL") +depends=("eccodes" "eigen" "fftw" "glpk" "graphicsmagick" "gsl" "hdf4" + "libgeotiff" "plplot" "python-numpy" "shapelib" "udunits" "wxgtk2") +makedepends=("cmake") +source=("$pkgname-$pkgver.tar.gz::https://github.com/gnudatalanguage/gdl/archive/v${pkgver//_/-}.tar.gz" + "gdl.profile" + "gdl-mallinfo2.patch" + "gdl-tiff.patch") +sha512sums=("3fde22c7e709b9cdc72a23d2317c043037379c7903418211a699c7e5caa2ed17e78e32e6d2f9b4aa89200e729fc21555821140dfdd58a5a636a858e2841f6335" + "b3a3589d2ce8eb5d49c902aa9bc43df0a0fcc369d17deb060026d34fa821881a212ce6aa02edc7ea6c0476b2faacc7455e467af7b5baf672e2653b71b162190f" + "e57a1d75039ac7c0654fb03bd0c95b6efb7beb605ea0a303af964fe7408f5d9497abd408fabb38fdb1d8b8dff86c2beefec0bb16df399b39284ddb4e22672f68" + "d55b2970c9ddfb0b78790e7fa876bf28ebef9e936d56c77105572b85095337cb65c7b564515b42afeafe5fa03d8faa562183ecb3c04fe592f6775cce5d4662bc") prepare() { - cp gdl-python3.patch gdl-graphicsmagick.patch ${srcdir}/gdl-${pkgver}/ - cd ${srcdir}/gdl-${pkgver} - patch -p1 -l -i gdl-python3.patch - patch -p1 -i gdl-graphicsmagick.patch + cd "${srcdir}/gdl-${pkgver//_/-}" + patch -p1 -l -N -i "${srcdir}"/gdl-mallinfo2.patch + patch -p1 -l -N -i "${srcdir}"/gdl-tiff.patch } build() { - cd ${srcdir}/gdl-${pkgver} + cd "${srcdir}/gdl-${pkgver//_/-}" if [[ -d build ]]; then rm -r build fi mkdir build cd build - cmake -DCMAKE_INSTALL_PREFIX=/usr -DPYTHON=ON -DPYTHONVERSION=3 \ + cmake -Wno-dev -DCMAKE_INSTALL_PREFIX=/usr -DPYTHON=ON -DPYTHONVERSION=3 \ -DPYTHON_MODULE=OFF -DPYTHON_EXECUTABLE=/usr/bin/python3 \ -DGRAPHICSMAGICK=ON -DMAGICK=OFF -DFFTW=ON -DHDF=ON \ - -DHDFDIR=/opt/hdf4 -DHDF5=ON -DGRIB=ON -DUDUNITS=ON -DEIGEN3=ON \ - -DNETCDF=ON -DREADLINE=ON -DEDITLINE=OFF .. + -DHDFDIR=/opt/hdf4 -DHDF5=ON -DGRIB=ON -DUDUNITS2=ON -DEIGEN3=ON \ + -DNETCDF=ON -DREADLINE=ON -DLIBPROJ4=OFF -DGLPK=ON -DSHAPELIB=ON .. make } -# Currently some tests fails, so we don't (yet) activate this -#check() { -# cd ${srcdir}/gdl-${pkgver}/build -# make test -#} +check() { + cd "${srcdir}/gdl-${pkgver//_/-}/build" + make check +} package() { - cd ${srcdir}/gdl-${pkgver}/build - make DESTDIR=${pkgdir} install + cd "${srcdir}/gdl-${pkgver//_/-}/build" + make DESTDIR="${pkgdir}" install install -D -m755 ../../gdl.profile "${pkgdir}/etc/profile.d/gdl.sh" - install -D -m644 -t "${pkgdir}/usr/share/doc/${pkgname}" ../{AUTHORS,ChangeLog,HACKING,NEWS,README} + install -D -m644 -t "${pkgdir}/usr/share/doc/${pkgname}" ../{AUTHORS,HACKING,NEWS,README} + install -D -m644 -t "${pkgdir}/usr/share/applications" ../doc/gdl.desktop } diff --git a/gdl-graphicsmagick.patch b/gdl-graphicsmagick.patch deleted file mode 100644 index 1c305e63974e..000000000000 --- a/gdl-graphicsmagick.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -ru gdl-0.9.9_old/src/magick_cl.cpp gdl-0.9.9/src/magick_cl.cpp ---- gdl-0.9.9_old/src/magick_cl.cpp 2018-12-01 15:19:52.000000000 +0100 -+++ gdl-0.9.9/src/magick_cl.cpp 2021-02-15 07:54:39.271235632 +0100 -@@ -65,6 +65,10 @@ - unsigned int gValid[40]; - unsigned int gCount = 0; - static bool notInitialized = true; -+ -+ __attribute__((constructor)) static void init(void) { -+ START_MAGICK; -+ } - - void magick_setup() { - int i; diff --git a/gdl-mallinfo2.patch b/gdl-mallinfo2.patch new file mode 100644 index 000000000000..bb629ba96d87 --- /dev/null +++ b/gdl-mallinfo2.patch @@ -0,0 +1,69 @@ +diff -U 3 -dHrN -- gdl-1.0.0-rc.3_orig/CMakeLists.txt gdl-1.0.0-rc.3/CMakeLists.txt +--- gdl-1.0.0-rc.3_orig/CMakeLists.txt 2020-06-19 18:03:33.000000000 +0200 ++++ gdl-1.0.0-rc.3/CMakeLists.txt 2021-07-31 21:36:40.184567405 +0200 +@@ -162,6 +162,7 @@ + check_function_exists(malloc_zone_statistics HAVE_MALLOC_ZONE_STATISTICS) + check_function_exists(sbrk HAVE_SBRK) + check_function_exists(mallinfo HAVE_MALLINFO) ++check_function_exists(mallinfo2 HAVE_MALLINFO2) + + # mallocs + check_include_file(malloc.h HAVE_MALLOC_H) +diff -U 3 -dHrN -- gdl-1.0.0-rc.3_orig/config.h.cmake gdl-1.0.0-rc.3/config.h.cmake +--- gdl-1.0.0-rc.3_orig/config.h.cmake 2020-06-19 18:03:33.000000000 +0200 ++++ gdl-1.0.0-rc.3/config.h.cmake 2021-07-31 21:36:40.184567405 +0200 +@@ -22,6 +22,7 @@ + #cmakedefine HAVE_LOCALE_H 1 + #cmakedefine HAVE_SBRK 1 + #cmakedefine HAVE_MALLINFO 1 ++#cmakedefine HAVE_MALLINFO2 1 + #cmakedefine HAVE_MALLOC_H 1 + #cmakedefine HAVE_MALLOC_MALLOC_H 1 + #cmakedefine HAVE_MALLOC_ZONE_STATISTICS 1 +diff -U 3 -dHrN -- gdl-1.0.0-rc.3_orig/src/basegdl.cpp gdl-1.0.0-rc.3/src/basegdl.cpp +--- gdl-1.0.0-rc.3_orig/src/basegdl.cpp 2020-06-19 18:03:33.000000000 +0200 ++++ gdl-1.0.0-rc.3/src/basegdl.cpp 2021-07-31 22:10:51.046521975 +0200 +@@ -769,7 +769,7 @@ + SizeT MemStats::HighWater = 0; + SizeT MemStats::Current = 0; + +-#if !defined(HAVE_MALLINFO) ++#if (!defined(HAVE_MALLINFO) && !defined(HAVE_MALLINFO2)) + # if (!defined(HAVE_MALLOC_ZONE_STATISTICS) || !defined(HAVE_MALLOC_MALLOC_H)) + # if defined(HAVE_SBRK) + char* MemStats::StartOfMemory = reinterpret_cast<char*>(::sbrk(0)); +diff -U 3 -dHrN -- gdl-1.0.0-rc.3_orig/src/basegdl.hpp gdl-1.0.0-rc.3/src/basegdl.hpp +--- gdl-1.0.0-rc.3_orig/src/basegdl.hpp 2021-07-31 21:12:27.366570216 +0200 ++++ gdl-1.0.0-rc.3/src/basegdl.hpp 2021-07-31 22:13:46.689456377 +0200 +@@ -37,7 +37,7 @@ + #ifdef HAVE_MALLOC_MALLOC_H + # include <malloc/malloc.h> + #endif +-#if !defined(HAVE_MALLINFO) ++#if (!defined(HAVE_MALLINFO) && !defined(HAVE_MALLINFO2)) + # if (!defined(HAVE_MALLOC_ZONE_STATISTICS) || !defined(HAVE_MALLOC_MALLOC_H)) + # if defined(HAVE_SBRK) + # include <unistd.h> +@@ -292,7 +292,7 @@ + // SizeT has architecture-dependant size (32/64 bit) + static SizeT NumAlloc, NumFree, HighWater, Current; + +-#if !defined(HAVE_MALLINFO) ++#if (!defined(HAVE_MALLINFO) && !defined(HAVE_MALLINFO2)) + # if (!defined(HAVE_MALLOC_ZONE_STATISTICS) || !defined(HAVE_MALLOC_MALLOC_H)) + # if defined(HAVE_SBRK) + static char* StartOfMemory; +@@ -340,7 +340,12 @@ + // - the LLVM project (lib/System/Unix/Process.inc) see http://llvm.org/ + // - the Squid cache project (src/tools.cc) see http://squid-cache.org/ + // TODO (TOCHECK): Squid considers also gnumalloc.h - ? +-#if defined(HAVE_MALLINFO) ++#if defined(HAVE_MALLINFO2) ++ // Docs see below, newer versions of glibc deprecated mallinfo() ++ static struct mallinfo2 mi; ++ mi = mallinfo2(); ++ Current = mi.arena+mi.hblkhd; ++#elif defined(HAVE_MALLINFO) + // Linux case for example + static struct mallinfo mi; + mi = mallinfo(); diff --git a/gdl-python3.patch b/gdl-python3.patch deleted file mode 100644 index 9c311dbea2c3..000000000000 --- a/gdl-python3.patch +++ /dev/null @@ -1,332 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index fb9a509f..060f22b2 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -860,9 +860,9 @@ if(PYTHON OR PYTHON_MODULE) - endif() - else() - if(NOT PYTHONVERSION) -- set(PYTHONVERSION 2) -+ set(PYTHONVERSION 3) - endif() -- find_package(PythonInterp) -+ find_package(PythonInterp ${PYTHONVERSION}) - find_package(PythonLibs ${PYTHONVERSION}) - if (NOT PYTHON_VERSION_STRING VERSION_EQUAL PYTHONLIBS_VERSION_STRING) - message(STATUS "PYTHON_EXECUTABLE: " ${PYTHON_EXECUTABLE}) -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index e4590be8..27f35ae4 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -212,7 +212,7 @@ target_link_libraries(gdl ${LIBRARIES}) - add_definitions(-DHAVE_CONFIG_H) - - if(PYTHON_MODULE) -- find_package( PythonInterp REQUIRED ) -+ find_package( PythonInterp ${PYTHONVERSION} REQUIRED ) - execute_process(COMMAND ${PYTHON_EXECUTABLE} -c - "import site, sys; sys.stdout.write(site.PREFIXES[-1])" - OUTPUT_VARIABLE PYTHON_PREFIX) -diff --git a/src/gdlpython.cpp b/src/gdlpython.cpp -index 981a3fbe..819acde3 100644 ---- a/src/gdlpython.cpp -+++ b/src/gdlpython.cpp -@@ -34,18 +34,32 @@ - - using namespace std; - -+#if PY_MAJOR_VERSION >= 3 -+int PythonInit() -+{ -+ if( Py_IsInitialized()) return NULL; -+#else - void PythonInit() - { - if( Py_IsInitialized()) return; -+#endif - Py_Initialize(); // signal handlers? - - static int argc = 1; -+#if PY_MAJOR_VERSION >= 3 -+ static wchar_t* arg0 = Py_DecodeLocale("./py/python.exe",NULL); -+ static wchar_t* argv[] = {arg0}; -+#else - static char* arg0 = (char*)"./py/python.exe"; - static char* argv[] = {arg0}; -+#endif - PySys_SetArgv(argc, argv); - - // http://docs.scipy.org/doc/numpy/reference/c-api.array.html#miscellaneous - import_array(); -+#if PY_MAJOR_VERSION >= 3 -+ return NULL; -+#endif - } - - void PythonEnd() -@@ -73,6 +87,12 @@ BaseGDL* FromPython( PyObject* pyObj) - { - if( !PyArray_Check( pyObj)) - { -+#if PY_MAJOR_VERSION >= 3 -+ if( PyUnicode_Check( pyObj)) -+ { -+ return new DStringGDL( PyUnicode_AsUTF8( pyObj)); -+ } -+#else - if( PyString_Check( pyObj)) - { - return new DStringGDL( PyString_AsString( pyObj)); -@@ -81,6 +101,7 @@ BaseGDL* FromPython( PyObject* pyObj) - { - return new DLongGDL( PyInt_AsLong( pyObj)); - } -+#endif - if( PyLong_Check( pyObj)) - { - return new DLongGDL( PyLong_AsLong( pyObj)); -@@ -176,11 +197,19 @@ namespace lib { - e->Throw( "ARGV keyword must be of type STRING."); - - int argc = argvS->N_Elements(); -+#if PY_MAJOR_VERSION >= 3 -+ wchar_t** argv = new wchar_t*[ argc]; -+#else - char** argv = new char*[ argc]; -+#endif - -- // pyhton copies the value -> threats it as const -+ // python copies the value -> treats it as const - for( int i=0; i<argc; ++i) -+#if PY_MAJOR_VERSION >= 3 -+ argv[i] = Py_DecodeLocale(const_cast<char*>((*argvS)[ i].c_str()), NULL); -+#else - argv[i] = const_cast<char*>((*argvS)[ i].c_str()); -+#endif - - PySys_SetArgv(argc, argv); - delete[] argv; -diff --git a/src/gdlpython.hpp b/src/gdlpython.hpp -index 45ef4366..cb53bd74 100644 ---- a/src/gdlpython.hpp -+++ b/src/gdlpython.hpp -@@ -18,7 +18,11 @@ - #ifndef GDLPYTHON_HPP_ - #define GDLPYTHON_HPP_ - -+#if PY_MAJOR_VERSION >= 3 -+int PythonInit(); -+#else - void PythonInit(); -+#endif - void PythonEnd(); - BaseGDL* FromPython( PyObject* pyObj); - -diff --git a/src/pythongdl.cpp b/src/pythongdl.cpp -index d2496f78..4150e5d9 100644 ---- a/src/pythongdl.cpp -+++ b/src/pythongdl.cpp -@@ -185,14 +185,22 @@ bool CopyArgFromPython( vector<BaseGDL*>& parRef, - for( SizeT k=0; k<nKW; ++k) - { - PyDict_Next( kwDict, &dictPos, &key, &value); -+#if PY_MAJOR_VERSION >= 3 -+ int keyIsString = PyUnicode_Check( key); -+#else - int keyIsString = PyString_Check( key); -+#endif - if( !keyIsString) - { - PyErr_SetString( gdlError, - "Keywords must be of type string"); - return false; - } -+#if PY_MAJOR_VERSION >= 3 -+ const char* keyChar = PyUnicode_AsUTF8( key); -+#else - const char* keyChar = PyString_AsString( key); -+#endif - string keyString = StrUpCase( keyChar); - int kwIx = e.GetPro()->FindKey( keyString); - if( kwIx == -1) -@@ -519,9 +527,42 @@ extern "C" { - {NULL, NULL, 0, NULL} // Sentinel - }; - -+#if PY_MAJOR_VERSION >= 3 -+ struct module_state { -+ PyObject *error; -+ }; -+ -+ #define GETSTATE(m) ((struct module_state*)PyModule_GetState(m)) -+ -+ static int GDL_traverse(PyObject *m, visitproc visit, void *arg) { -+ Py_VISIT(GETSTATE(m)->error); -+ return 0; -+ } -+ -+ static int GDL_clear(PyObject *m) { -+ Py_CLEAR(GETSTATE(m)->error); -+ return 0; -+ } -+ -+ static struct PyModuleDef moduledef = { -+ PyModuleDef_HEAD_INIT, -+ "GDL", -+ NULL, -+ sizeof(struct module_state), -+ GDLMethods, -+ NULL, -+ GDL_traverse, -+ GDL_clear, -+ NULL -+ }; -+#endif - - // python GDL module init function -- PyMODINIT_FUNC initGDL() -+#if PY_MAJOR_VERSION >= 3 -+ PyMODINIT_FUNC PyInit_GDL(void) -+#else -+ PyMODINIT_FUNC initGDL(void) -+#endif - { - // http://docs.scipy.org/doc/numpy/reference/c-api.array.html#miscellaneous - import_array(); -@@ -548,7 +589,11 @@ extern "C" { - } - SysVar::SetGDLPath( gdlPath); - -+#if PY_MAJOR_VERSION >= 3 -+ PyObject* m = PyModule_Create(&moduledef); -+#else - PyObject* m = Py_InitModule("GDL", GDLMethods); -+#endif - - gdlError = PyErr_NewException((char*)"GDL.error", NULL, NULL); - Py_INCREF(gdlError); -@@ -557,6 +602,9 @@ extern "C" { - // GDL event handling - oldInputHook = PyOS_InputHook; - PyOS_InputHook = GDLEventHandlerPy; -+#if PY_MAJOR_VERSION >= 3 -+ return m; -+#endif - } - - } // extern "C" -diff --git a/testsuite/python/test-GDL.py b/testsuite/python/test-GDL.py -old mode 100644 -new mode 100755 -index fca6782b..dec80608 ---- a/testsuite/python/test-GDL.py -+++ b/testsuite/python/test-GDL.py -@@ -1,9 +1,10 @@ --#!/usr/bin/py.test -vv -+#!/usr/bin/env -S python3 -m pytest -vv - - import math - import numpy - import pytest - import os -+import tempfile - import warnings - - if 'ADTTMP' in os.environ: -@@ -37,11 +38,11 @@ class GDLFile (object): - self.name = None - with warnings.catch_warnings(): - warnings.simplefilter("ignore") -- self.fname = os.tmpnam() -+ self.fname = tempfile.mkstemp()[1] - self.code = code - - def __enter__(self): -- fp = file(self.fname, 'w') -+ fp = open(self.fname, 'w') - fp.write(self.code) - fp.close() - return self.name or self.fname -@@ -70,18 +71,17 @@ def test_function_user(): - - @pytest.mark.parametrize('arg', [ - 'Hello, world', '', '\n', --# u'Hello, world', -+ u'Hello, world', - -1.2, 1e-39, 0.0, 0.05, 1.0, 1e128, float('inf'), float('-inf'), - -1, 0, 1, 1000, 2**31-1, -2**31, -- -1L, 0L, 1L, 2L**31-1, -2L**31, --# 2**45-1, --# complex(1.,1.), complex(0,0), --# numpy.arange(0, 259, dtype=int), --# numpy.arange(0, 259, dtype=long), --# numpy.arange(-255, 255, dtype=numpy.int8), -+ # 2**45-1, # GDL returns int -+ # complex(1.,1.), # Aborts execution -+ # complex(0.,0.), # Aborts execution -+ # numpy.arange(0, 259, dtype=int) # GDL Error: unknown return array type" - numpy.arange(0, 259, dtype=numpy.uint8), - numpy.arange(-255, 259, dtype=numpy.int16), --# numpy.arange(0, 259, dtype=numpy.uint16), -+ # numpy.arange(-255, 255, dtype=numpy.int8), # GDL Error: unknown return array type -+ # numpy.arange(0, 259, dtype=numpy.uint16), # GDL Error: unknown return array type - numpy.arange(-255, 259, dtype=numpy.int32), - numpy.arange(0, 259, dtype=numpy.uint32), - numpy.arange(-1, 1., 0.1, dtype=float), -@@ -89,9 +89,9 @@ def test_function_user(): - numpy.arange(-1, 1., 0.1, dtype=numpy.float64), - numpy.arange(-1, 1., 0.1, dtype=numpy.complex64), - numpy.arange(-1, 1., 0.1, dtype=numpy.complex128), --# [1,2,3,4,5], --# (1,2,3,4,5), --# {'1':2}, -+ # [1,2,3,4,5], # GDL Error: Cannot convert python scalar" -+ # (1,2,3,4,5), # Returns only the first number -+ # {'1':2}, # GDL Error: Cannot convert python scalar - ]) - def test_function_arg_pass_return(arg): - '''Call a function that just returns its argument, with different data types''' -@@ -128,12 +128,11 @@ def test_pro_user(): - - @pytest.mark.parametrize('arg', [ - 'Hello, world', '', --# u'Hello, world', -+ u'Hello, world', - -1.2, 1e-39, 0.0, 0.05, 1.0, 1e128, float('inf'), float('-inf'), - -1, 0, 1, 1000, 2**31-1, -2**31, -- -1L, 0L, 1L, 2L**31-1, -2L**31, --# 2**45-1, --# complex(1.,1.), -+ # 2**45-1, # GDL returns int -+ # complex(1.,1.), # Aborts execution - ]) - def test_pro_arg_pass(arg): - '''Call a user defined procedure that stores the value for different -@@ -149,7 +148,7 @@ def test_pro_arg_pass(arg): - with GDLFile(code) as name: - with warnings.catch_warnings(): - warnings.simplefilter("ignore") -- fname = os.tmpnam() -+ fname = tempfile.mkstemp()[1] - GDL.pro(name, fname, arg) - ret = open(fname).read().strip() - os.unlink(fname) -@@ -185,7 +184,8 @@ def test_script(): - - with warnings.catch_warnings(): - warnings.simplefilter("ignore") -- fname = os.tmpnam() -+ fname = tempfile.mkstemp()[1] -+ scriptname = tempfile.mkstemp()[1] - arg = 'Hello, world!' - code = '''openw, 5, '{0}' - printf, 5, '{1}' -@@ -198,7 +198,7 @@ def test_script(): - assert arg == ret - - --@pytest.mark.skipif(True, reason='This will errornously abort the test suite') -+@pytest.mark.xfail(reason='Does not raise a GDL.error') - def test_invalid_code(): - '''Call a function with some invalid GDL code''' - diff --git a/gdl-tiff.patch b/gdl-tiff.patch new file mode 100644 index 000000000000..4cd3e396bcfb --- /dev/null +++ b/gdl-tiff.patch @@ -0,0 +1,199 @@ +diff -U 3 -dHrN -- gdl-1.0.0-rc.3_orig/src/tiff.cxx gdl-1.0.0-rc.3/src/tiff.cxx +--- gdl-1.0.0-rc.3_orig/src/tiff.cxx 2020-06-19 18:03:33.000000000 +0200 ++++ gdl-1.0.0-rc.3/src/tiff.cxx 2021-07-31 23:55:20.514208009 +0200 +@@ -219,24 +219,24 @@ + return true; + } + +- uint16 Handler::DirectoryCount() const ++ uint16_t Handler::DirectoryCount() const + { + return (tiff_ ? nDirs_ : 0); + } + +- uint16 Handler::FileVersion() const ++ uint16_t Handler::FileVersion() const + { + return (tiff_ ? verNum_ : 0); + } + +- typedef void (*ScanlineFn)(BaseGDL*, uint32, uint32, const void*, size_t); ++ typedef void (*ScanlineFn)(BaseGDL*, uint32_t, uint32_t, const void*, size_t); + template<typename T> + ScanlineFn createScanlineFn(BaseGDL*& var, T* val) + { + if(!(var = val)) + return nullptr; + +- return [](BaseGDL* image, uint32 x, uint32 y, const void* buf, size_t bytes) { ++ return [](BaseGDL* image, uint32_t x, uint32_t y, const void* buf, size_t bytes) { + auto img = static_cast<T*>(image); + auto ptr = reinterpret_cast<typename T::Ty*>(img->DataAddr()); + auto dim = img->Dim(); +@@ -248,9 +248,9 @@ + + BaseGDL* Handler::ReadImage(const Directory& dir, const Rectangle& rect) + { +- uint32 c = dir.samplesPerPixel; +- uint32 w = (rect.w ? rect.w : dir.width - rect.x); +- uint32 h = (rect.h ? rect.h : dir.height - rect.y); ++ uint32_t c = dir.samplesPerPixel; ++ uint32_t w = (rect.w ? rect.w : dir.width - rect.x); ++ uint32_t h = (rect.h ? rect.h : dir.height - rect.y); + + ScanlineFn addScanline; + BaseGDL* image = nullptr; +@@ -289,7 +289,7 @@ + goto error; + } + +- for(uint32 y = 0; y < h; ++y) { ++ for(uint32_t y = 0; y < h; ++y) { + if(TIFFReadScanline(tiff_, buffer, rect.y + y, 0) == -1) + goto error; + +@@ -307,13 +307,13 @@ + goto error; + } + +- for(uint32 y = 0, yrem, yoff; y < h; y += yrem) { ++ for(uint32_t y = 0, yrem, yoff; y < h; y += yrem) { + yoff = (rect.y + y) % dir.tileHeight; + + if(((yrem = dir.tileHeight - yoff) + y) > h) + yrem = h - y; + +- for(uint32 x = 0, xrem, xoff; x < w; x += xrem) { ++ for(uint32_t x = 0, xrem, xoff; x < w; x += xrem) { + if(TIFFReadTile(tiff_, buffer, rect.x + x, rect.y + y, 0, 0) == -1) + goto error; + +@@ -323,7 +323,7 @@ + if(((xrem = dir.tileWidth - xoff) + x) > w) + xrem = w - x; + +- for(uint32 ty = 0; ty < yrem; ++ty, start += (sampOff * dir.tileWidth)) ++ for(uint32_t ty = 0; ty < yrem; ++ty, start += (sampOff * dir.tileWidth)) + addScanline(image, x, y + ty, start, sampOff * xrem); + } + } +@@ -352,7 +352,7 @@ + + DStructFactory gtif; + TIFF::GeoKey gk; +- int16 nvals; ++ int16_t nvals; + double* val; + + // TIFF geo fields +diff -U 3 -dHrN -- gdl-1.0.0-rc.3_orig/src/tiff.hxx gdl-1.0.0-rc.3/src/tiff.hxx +--- gdl-1.0.0-rc.3_orig/src/tiff.hxx 2020-06-19 18:03:33.000000000 +0200 ++++ gdl-1.0.0-rc.3/src/tiff.hxx 2021-07-31 23:53:29.572624524 +0200 +@@ -36,12 +36,12 @@ + struct Directory + { + tdir_t index = 0; +- uint32 width = 0; +- uint32 height = 0; +- uint32 tileWidth = 0; +- uint32 tileHeight = 0; +- uint16 samplesPerPixel = 1; +- uint16 bitsPerSample = 1; ++ uint32_t width = 0; ++ uint32_t height = 0; ++ uint32_t tileWidth = 0; ++ uint32_t tileHeight = 0; ++ uint16_t samplesPerPixel = 1; ++ uint16_t bitsPerSample = 1; + + struct Position + { +@@ -54,7 +54,7 @@ + float x = 1.f; + float y = 1.f; + +- enum class Unit : uint16 ++ enum class Unit : uint16_t + { + None = 1, + Inches = 2, +@@ -62,7 +62,7 @@ + } unit = Unit::Inches; + } resolution; + +- enum class Orientation : uint16 ++ enum class Orientation : uint16_t + { + LeftToRightTopToBottom = 1, + RightToLeftTopToBottom = 2, +@@ -74,7 +74,7 @@ + BottomToTopLeftToRight = 8, + } orientation = Orientation::LeftToRightTopToBottom; + +- enum class SampleFormat : uint16 ++ enum class SampleFormat : uint16_t + { + UnsignedInteger = 1, + SignedInteger = 2, +@@ -84,13 +84,13 @@ + ComplexFloatingPoint = 6, + } sampleFormat = SampleFormat::UnsignedInteger; + +- enum class PlanarConfig : uint16 ++ enum class PlanarConfig : uint16_t + { + Contiguous = 1, + Separate = 2, + } planarConfig = PlanarConfig::Contiguous; + +- enum class Photometric : uint16 ++ enum class Photometric : uint16_t + { + MinIsWhite = 0, + MinIsBlack = 1, +@@ -109,9 +109,9 @@ + + struct ColorMap + { +- uint16* red; +- uint16* green; +- uint16* blue; ++ uint16_t* red; ++ uint16_t* green; ++ uint16_t* blue; + } colorMap = { 0 }; + + const char* description = ""; +@@ -148,8 +148,8 @@ + + struct Rectangle + { +- uint32 x, y; +- uint32 w, h; ++ uint32_t x, y; ++ uint32_t w, h; + }; + + class Handler +@@ -161,8 +161,8 @@ + bool Open(const char* file, const char* mode); + void Close(); + bool GetDirectory(tdir_t, Directory&) const; +- uint16 DirectoryCount() const; +- uint16 FileVersion() const; ++ uint16_t DirectoryCount() const; ++ uint16_t FileVersion() const; + BaseGDL* ReadImage(const Directory&, const Rectangle& = { 0 }); + + template<typename... Ts> +@@ -193,8 +193,8 @@ + #endif + TIFFErrorHandler defEH_ = nullptr; + TIFFErrorHandler defWH_ = nullptr; +- uint16 nDirs_ = 1; +- uint16 verNum_ = 0; ++ uint16_t nDirs_ = 1; ++ uint16_t verNum_ = 0; + }; + } + |