[Git][debian-gis-team/python-hdf4][upstream] New upstream version 0.11.3
Antonio Valentino (@antonio.valentino)
gitlab at salsa.debian.org
Tue Jun 27 06:45:43 BST 2023
Antonio Valentino pushed to branch upstream at Debian GIS Project / python-hdf4
Commits:
a6d53632 by Antonio Valentino at 2023-06-27T05:39:25+00:00
New upstream version 0.11.3
- - - - -
14 changed files:
- .github/workflows/package.yml → .github/workflows/package_and_publish.yml
- .github/workflows/tests.yml
- .gitignore
- Makefile
- doc/conf.py
- doc/install.rst
- examples/runall.py
- examples/txttohdf/txttohdf.py
- pyhdf/hdfext.i
- pyhdf/hdfext.py
- pyhdf/hdfext_wrap.c
- pyproject.toml
- setup.cfg
- setup.py
Changes:
=====================================
.github/workflows/package.yml → .github/workflows/package_and_publish.yml
=====================================
@@ -1,9 +1,7 @@
-name: Pypi build
+name: PyPI publish
on:
push:
- tags:
- - 'v*' #
jobs:
packages:
@@ -15,14 +13,14 @@ jobs:
os: [windows-latest, ubuntu-latest, macos-latest]
cibw_archs: ["auto"]
env:
- CIBW_SKIP: "*-musllinux_*"
+ CIBW_SKIP: "*-musllinux_* cp36-* pp3*-win_*"
steps:
- - uses: actions/checkout at v2
+ - uses: actions/checkout at v3
- - uses: actions/setup-python at v2
+ - uses: actions/setup-python at v4
name: Install Python
with:
- python-version: '3.7'
+ python-version: '3.10'
- name: Setup conda (windows-latest)
if: matrix.os == 'windows-latest'
@@ -36,7 +34,7 @@ jobs:
- name: Install cibuildwheel
run: |
- python -m pip install cibuildwheel==2.3.1
+ python -m pip install cibuildwheel==2.13.1
- name: Build wheels
run: |
python -m cibuildwheel --output-dir dist
@@ -46,13 +44,13 @@ jobs:
CIBW_BEFORE_ALL_LINUX: yum -y install epel-release hdf hdf-devel && ln -s /usr/lib64/hdf/lib* /usr/lib64/
CIBW_ARCHS_LINUX: 'x86_64' # restrict to 64bit builds
CIBW_ARCHS_WINDOWS: 'AMD64' # restrict to 64bit builds
- # (mac-os) Install hdf-4.2.15 from sources
+ # (mac-os) Install hdf4 from sources
CIBW_BEFORE_ALL_MACOS: >
brew install ninja &&
cd /tmp &&
- git clone https://github.com/HDFGroup/hdf4.git &&
+ git clone --depth 1 --branch hdf-4_2_16 https://github.com/HDFGroup/hdf4.git &&
mkdir build && cd build &&
- ../hdf4/configure --enable-shared --disable-static --disable-fortran --disable-netcdf --enable-production --with-zlib --prefix=/usr/local &&
+ ../hdf4/configure --enable-hdf4-xdr --enable-shared --disable-static --disable-fortran --disable-netcdf --enable-production --with-zlib --prefix=/usr/local &&
make install
CIBW_BEFORE_ALL_WINDOWS: >
conda config --set always_yes yes --set changeps1 no --set auto_update_conda no --set safety_checks disabled &&
@@ -67,21 +65,22 @@ jobs:
path: wheelhouse
publish:
+ if: ${{ startsWith(github.ref, 'refs/tags/v') }}
name: Publish to PyPI
needs: [packages]
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout at v2
+ - uses: actions/checkout at v3
- name: Switch to using Python 3.x
- uses: actions/setup-python at v2
+ uses: actions/setup-python at v4
with:
python-version: 3.x
- name: Create source distribution archive
run: |
- python -m pip install numpy
- python setup.py sdist -d wheelhouse
+ python -m pip install build
+ python -m build --sdist -o wheelhouse
- uses: actions/upload-artifact at v2
with:
=====================================
.github/workflows/tests.yml
=====================================
@@ -15,13 +15,13 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
- python: ["3.7", "3.8", "3.9", "3.x"]
+ python: ["3.8", "3.9", "3.10", "3.x"]
steps:
- - uses: actions/checkout at v2
+ - uses: actions/checkout at v3
- name: Install Python
- uses: actions/setup-python at v2
+ uses: actions/setup-python at v4
with:
python-version: ${{ matrix.python }}
@@ -30,9 +30,9 @@ jobs:
run: |
brew install ninja &&
cd /tmp &&
- git clone https://github.com/HDFGroup/hdf4.git &&
+ git clone --depth 1 --branch hdf-4_2_16 https://github.com/HDFGroup/hdf4.git &&
mkdir build && cd build &&
- ../hdf4/configure --enable-shared --disable-static --disable-fortran --disable-netcdf --enable-java --enable-production --with-zlib --prefix=/usr/local &&
+ ../hdf4/configure --enable-hdf4-xdr --enable-shared --disable-static --disable-fortran --disable-netcdf --enable-java --enable-production --with-zlib --prefix=/usr/local &&
make install
- name: Install libhdf4-dev (ubuntu-latest)
@@ -58,6 +58,6 @@ jobs:
- name: Run tests
run: |
- python setup.py develop
+ pip install -e .
pytest
python examples/runall.py
=====================================
.gitignore
=====================================
@@ -1,4 +1,6 @@
*.pyc
+venv/
+.venv/
build/
dist/
pyhdf.egg-info/
=====================================
Makefile
=====================================
@@ -6,22 +6,28 @@ all: build
.PHONY: build
build:
make -C pyhdf build
- $(PYTHON) setup.py build
+ $(PYTHON) -m build
.PHONY: install
install: build
- $(PYTHON) setup.py install
+ $(PYTHON) -m pip install .
.PHONY: builddoc
.ONESHELL:
builddoc:
export PYTHONPATH=$(shell pwd)
- $(PYTHON) setup.py build_ext --inplace
+ $(PYTHON) install -e .
make -C doc clean
make -C doc html
@echo
@echo doc index is doc/_build/html/index.html
+.PHONY: clean
+test:
+ $(PYTHON) -m pip install -e .
+ pytest
+ $(PYTHON) examples/runall.py
+
.PHONY: clean
clean:
rm -rf build/ dist/ pyhdf.egg-info examples/*/*.hdf
@@ -30,7 +36,7 @@ clean:
.PHONY: dist
dist:
- $(PYTHON) setup.py sdist
+ $(PYTHON) -m build
@echo Upload to test site:
@echo $(PYTHON) -m twine upload --repository-url https://test.pypi.org/legacy/ dist/*
@echo Upload to PyPI:
=====================================
doc/conf.py
=====================================
@@ -54,9 +54,9 @@ copyright = u'2019, pyhdf authors'
# built documents.
#
# The short X.Y version.
-version = '0.10'
+version = '0.11'
# The full version, including alpha/beta/rc tags.
-release = '0.10.5'
+release = '0.11.3'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
=====================================
doc/install.rst
=====================================
@@ -96,13 +96,12 @@ Installing from the source archive
3. Install system-wide or locally::
- # sudo python setup.py install
- $ python setup.py install --prefix=/usr/local (or prefix of choice)
+ # sudo pip install .
+ $ pip install -e .
- Or, you might prefer to make a package (msi, rpm, egg, etc.) and install the
- package::
+ Or, you might prefer to make a python wheel and install it::
- $ python setup.py bdist_<package>
+ $ python -m build
To make sure everything works as expected, run the ``hdfstruct.py``
script (under ``examples/hdfstruct``) on one of your HDF4 files. The
=====================================
examples/runall.py
=====================================
@@ -1,7 +1,7 @@
#!/usr/bin/env python
"""
This script runs all the examples in examples directory.
-It should be run from the top-level directory (containing setup.py).
+It should be run from the top-level directory (containing pyproject.toml).
"""
import glob
@@ -20,8 +20,7 @@ class ExampleTester:
rootdir = os.getcwd()
def __init__(self):
- subprocess.check_call([sys.executable, "setup.py", "build_ext", "--inplace"])
- os.environ["PYTHONPATH"] = self.rootdir
+ pass
def run(self, d, cmd, **kwargs):
"""
=====================================
examples/txttohdf/txttohdf.py
=====================================
@@ -3,8 +3,7 @@
from __future__ import print_function
from pyhdf.six.moves import map
-from numpy import *
-from pyhdf.SD import *
+from pyhdf.SD import SD, SDC, HDF4Error
import os
=====================================
pyhdf/hdfext.i
=====================================
@@ -102,7 +102,7 @@
/* Tags */
#define DFTAG_NDG 720
-#define DFTAG_VH 1962
+#define DFTAG_VH 1962
#define DFTAG_VG 1965
/* limits */
@@ -129,7 +129,7 @@ typedef unsigned char uint8;
#include "mfhdf.h"
%}
-/*
+/*
***************
* Basic HDF API
***************
@@ -191,7 +191,7 @@ extern void _HEprint(void);
********
*/
-/*
+/*
* Interface to numpy, which is used to read and write
* SD array data.
*/
@@ -205,7 +205,9 @@ extern void _HEprint(void);
%{
#include "hdfi.h" /* declares int32, float32, etc */
-#include "numpy/oldnumeric.h"
+#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
+#include "numpy/ndarraytypes.h"
+#include "numpy/ndarrayobject.h"
#define DFNT_FLOAT32 5
#define DFNT_FLOAT 5 /* For backward compat; don't use */
@@ -233,21 +235,21 @@ static int HDFtoNumericType(int hdf) {
int num;
switch (hdf) {
- case DFNT_FLOAT32: num = PyArray_FLOAT; break;
- case DFNT_FLOAT64: num = PyArray_DOUBLE; break;
- case DFNT_INT8 : num = PyArray_SBYTE; break;
- case DFNT_UINT8 : num = PyArray_UBYTE; break;
- case DFNT_INT16 : num = PyArray_SHORT; break;
+ case DFNT_FLOAT32: num = NPY_FLOAT; break;
+ case DFNT_FLOAT64: num = NPY_DOUBLE; break;
+ case DFNT_INT8 : num = NPY_BYTE; break;
+ case DFNT_UINT8 : num = NPY_UBYTE; break;
+ case DFNT_INT16 : num = NPY_SHORT; break;
#ifndef NOUINT
- case DFNT_UINT16 : num = PyArray_USHORT; break;
+ case DFNT_UINT16 : num = NPY_USHORT; break;
#endif
- case DFNT_INT32 : num = PyArray_INT; break;
+ case DFNT_INT32 : num = NPY_INT; break;
#ifndef NOUINT
- case DFNT_UINT32 : num = PyArray_UINT; break;
+ case DFNT_UINT32 : num = NPY_UINT; break;
#endif
- case DFNT_CHAR8 : num = PyArray_CHAR; break;
- case DFNT_UCHAR8 : num = PyArray_UBYTE; break;
- default:
+ case DFNT_CHAR8 : num = NPY_STRING; break;
+ case DFNT_UCHAR8 : num = NPY_UBYTE; break;
+ default:
num = -1;
break;
}
@@ -256,7 +258,7 @@ static int HDFtoNumericType(int hdf) {
static PyObject * _SDreaddata_0(int32 sds_id, int32 data_type,
PyObject *start,
- PyObject *edges,
+ PyObject *edges,
PyObject *stride) {
/*
@@ -329,14 +331,14 @@ static PyObject * _SDreaddata_0(int32 sds_id, int32 data_type,
PyErr_SetString(PyExc_ValueError, "data_type not compatible with numpy");
return NULL;
}
- if ((array = (PyArrayObject *)
+ if ((array = (PyArrayObject *)
PyArray_SimpleNew(outRank, dims, num_type)) == NULL)
return NULL;
/*
* Load it from the SDS.
*/
- status = SDreaddata(sds_id, startArr, strideArr, edgesArr,
- array -> data);
+ status = SDreaddata(sds_id, startArr, strideArr, edgesArr,
+ PyArray_DATA(array));
if (status < 0) {
PyErr_SetString(PyExc_ValueError, "SDreaddata failure");
Py_DECREF(array); /* Free array */
@@ -352,29 +354,29 @@ static PyObject * _SDreaddata_0(int32 sds_id, int32 data_type,
if (outRank > 0)
return (PyObject *) array;
switch (num_type) {
- case PyArray_FLOAT:
- f32 = *(float *) array->data;
+ case NPY_FLOAT:
+ f32 = *(float *) PyArray_DATA(array);
o = PyFloat_FromDouble((double) f32);
break;
- case PyArray_DOUBLE:
- f64 = *(double *) array->data;
+ case NPY_DOUBLE:
+ f64 = *(double *) PyArray_DATA(array);
o = PyFloat_FromDouble(f64);
break;
- case PyArray_CHAR:
- case PyArray_SBYTE:
- i32 = *(char *) array->data;
+ case NPY_STRING:
+ case NPY_BYTE:
+ i32 = *(char *) PyArray_DATA(array);
o = PyInt_FromLong((long) i32);
break;
- case PyArray_UBYTE:
- i32 = *(unsigned char *) array->data;
+ case NPY_UBYTE:
+ i32 = *(unsigned char *) PyArray_DATA(array);
o = PyInt_FromLong((long) i32);
break;
- case PyArray_SHORT:
- i32 = *(short *) array->data;
+ case NPY_SHORT:
+ i32 = *(short *) PyArray_DATA(array);
o = PyInt_FromLong((long) i32);
break;
- case PyArray_INT:
- i32 = *(int *) array->data;
+ case NPY_INT:
+ i32 = *(int *) PyArray_DATA(array);
o = PyInt_FromLong((long) i32);
break;
}
@@ -384,7 +386,7 @@ static PyObject * _SDreaddata_0(int32 sds_id, int32 data_type,
static PyObject * _SDwritedata_0(int32 sds_id, int32 data_type,
PyObject *start,
- PyObject *edges,
+ PyObject *edges,
PyObject *data,
PyObject *stride) {
@@ -438,14 +440,14 @@ static PyObject * _SDwritedata_0(int32 sds_id, int32 data_type,
PyErr_SetString(PyExc_ValueError, "data_type not compatible with numpy");
return NULL;
}
- if ((array = (PyArrayObject *)
+ if ((array = (PyArrayObject *)
PyArray_ContiguousFromObject(data, num_type, rank - 1, rank)) == NULL)
return NULL;
/*
* Store in the SDS.
*/
- status = SDwritedata(sds_id, startArr, strideArr, edgesArr,
- array -> data);
+ status = SDwritedata(sds_id, startArr, strideArr, edgesArr,
+ PyArray_DATA(array));
Py_DECREF(array); /* Free array */
if (status < 0) {
PyErr_SetString(PyExc_ValueError, "SDwritedata failure");
@@ -454,26 +456,26 @@ static PyObject * _SDwritedata_0(int32 sds_id, int32 data_type,
/*
* Return None.
*/
- Py_INCREF(Py_None);
+ Py_INCREF(Py_None);
return Py_None;
}
%}
/*
- * Following two routines are defined above, and interface to the
+ * Following two routines are defined above, and interface to the
* `SDreaddata()' and `SDwritedata()' hdf functions.
*/
extern PyObject * _SDreaddata_0(int32 sds_id, int32 data_type,
- PyObject *start,
+ PyObject *start,
PyObject *edges,
PyObject *stride);
extern PyObject * _SDwritedata_0(int32 sds_id, int32 data_type,
- PyObject *start,
+ PyObject *start,
PyObject *edges,
- PyObject *data,
+ PyObject *data,
PyObject *stride);
/*
@@ -482,7 +484,7 @@ extern PyObject * _SDwritedata_0(int32 sds_id, int32 data_type,
extern int32 SDstart(const char *filename, int32 access_mode);
-extern int32 SDcreate(int32 sd_id, const char *sds_name, int32 data_type,
+extern int32 SDcreate(int32 sd_id, const char *sds_name, int32 data_type,
int32 rank, const int32 *dim_sizes);
extern int32 SDselect(int32 sd_id, int32 sds_index);
@@ -519,7 +521,7 @@ extern int32 SDreftoindex(int32 sd_id, int32 sds_ref);
*/
%cstring_bounded_output(char *dim_name, CHAR_BUFFER_SIZE);
-extern int32 SDdiminfo(int32 dim_id, char *dim_name,
+extern int32 SDdiminfo(int32 dim_id, char *dim_name,
int32 *OUTPUT, int32 *OUTPUT, int32 *OUTPUT);
%clear char *dim_name;
@@ -533,7 +535,7 @@ extern int32 SDsetdimname(int32 dim_id, const char *dim_name);
extern int32 SDgetdimscale(int32 dim_id, void *buf);
-extern int32 SDsetdimscale(int32 dim_id, int32 n_values, int32 data_type,
+extern int32 SDsetdimscale(int32 dim_id, int32 n_values, int32 data_type,
const void *buf);
/*
@@ -541,7 +543,7 @@ extern int32 SDsetdimscale(int32 dim_id, int32 n_values, int32 data_type,
*/
%cstring_bounded_output(char *attr_name, CHAR_BUFFER_SIZE);
-extern int32 SDattrinfo(int32 obj_id, int32 attr_index,
+extern int32 SDattrinfo(int32 obj_id, int32 attr_index,
char *attr_name, int32 *OUTPUT, int32 *OUTPUT);
%clear char *attr_name;
@@ -564,7 +566,7 @@ extern int32 SDgetcal(int32 sds_id, double *OUTPUT, double *OUTPUT,
%cstring_bounded_output(char *unit, ATTRIB_BUFFER_SIZE);
%cstring_bounded_output(char *format, ATTRIB_BUFFER_SIZE);
%cstring_bounded_output(char *coord_system, ATTRIB_BUFFER_SIZE);
-extern int32 SDgetdatastrs(int32 sds_id, char *label, char *unit, char *format,
+extern int32 SDgetdatastrs(int32 sds_id, char *label, char *unit, char *format,
char *coord_system, int32 len);
%clear char *label;
%clear char *unit;
@@ -574,7 +576,7 @@ extern int32 SDgetdatastrs(int32 sds_id, char *label, char *unit, char *format,
%cstring_bounded_output(char *label, ATTRIB_BUFFER_SIZE);
%cstring_bounded_output(char *unit, ATTRIB_BUFFER_SIZE);
%cstring_bounded_output(char *format, ATTRIB_BUFFER_SIZE);
-extern int32 SDgetdimstrs(int32 sds_id, char *label, char *unit, char *format,
+extern int32 SDgetdimstrs(int32 sds_id, char *label, char *unit, char *format,
int32 len);
%clear char *label;
%clear char *unit;
@@ -607,7 +609,7 @@ extern int32 SDsetrange(int32 sds_id, const void *max, const void *min);
#include "hcomp.h"
-static int32 _SDgetcompress(int32 sds_id, int32 *comp_type, int32 *value,
+static int32 _SDgetcompress(int32 sds_id, int32 *comp_type, int32 *value,
int32 *v2, int32 *v3, int32 *v4, int32 *v5) {
comp_info c_info;
@@ -684,7 +686,7 @@ extern int32 _SDsetcompress(int32 sds_id, int32 comp_type, int32 value,
* Misc
*/
-extern int32 SDsetexternalfile(int32 sds_id, const char *filename,
+extern int32 SDsetexternalfile(int32 sds_id, const char *filename,
int32 offset);
/*
@@ -692,9 +694,9 @@ extern int32 SDsetexternalfile(int32 sds_id, const char *filename,
* VS API
********
*/
-
-/*
+
+/*
* Access / Create
*****************
*/
@@ -713,7 +715,7 @@ extern intn Vfinish(int32 file_id); /* Vend is a macro */
* Creating one-field vdata.
*/
-extern int32 VHstoredata(int32 file_id,
+extern int32 VHstoredata(int32 file_id,
const char *fieldname,
void *buf,
int32 n_records,
@@ -721,7 +723,7 @@ extern int32 VHstoredata(int32 file_id,
const char *vdata_name,
const char *vdata_class);
-extern int32 VHstoredatam(int32 file_id,
+extern int32 VHstoredatam(int32 file_id,
const char *fieldname,
void *buf,
int32 n_records,
@@ -823,13 +825,13 @@ extern int32 VFfieldtype(int32 vdata_id,
extern const char *VFfieldname(int32 vdata_id,
int32 field_index);
-extern int32 VFfieldesize(int32 vdata_id,
+extern int32 VFfieldesize(int32 vdata_id,
int32 field_index);
-extern int32 VFfieldisize(int32 vdata_id,
+extern int32 VFfieldisize(int32 vdata_id,
int32 field_index);
-extern int32 VFfieldorder(int32 vdata_id,
+extern int32 VFfieldorder(int32 vdata_id,
int32 field_index);
@@ -850,24 +852,24 @@ extern intn VSfexist(int32 vdata_id,
* Attributes.
*/
-extern int32 VSsetclass(int32 vdata_id,
+extern int32 VSsetclass(int32 vdata_id,
const char *vdata_class);
extern int32 VSsetname(int32 vdata_id,
const char *vdata_name);
-extern intn VSsetinterlace(int32 vdata_id,
+extern intn VSsetinterlace(int32 vdata_id,
int32 interlace_mode);
-extern intn VSsetattr(int32 vdata_id,
+extern intn VSsetattr(int32 vdata_id,
int32 field_index,
- const char *attr_name,
+ const char *attr_name,
int32 data_type,
- int32 n_values,
+ int32 n_values,
const void *values);
-extern intn VSgetattr(int32 vdata_id,
- int32 field_index,
+extern intn VSgetattr(int32 vdata_id,
+ int32 field_index,
intn attr_index,
void *buf);
@@ -879,7 +881,7 @@ extern int32 VSnattrs(int32 vdata_id);
%cstring_bounded_output(char *attr_name, CHAR_BUFFER_SIZE);
extern intn VSattrinfo(int32 vdata_id,
int32 field_index,
- intn attr_index,
+ intn attr_index,
char *attr_name,
int32 *OUTPUT, /* data_type */
int32 *OUTPUT, /* n_values */
@@ -981,19 +983,19 @@ extern int32 Vnrefs(int32 vgroup_id,
extern intn Vfindattr(int32 vgroup_id,
const char *attr_name);
-extern intn Vgetattr(int32 vdata_id,
+extern intn Vgetattr(int32 vdata_id,
intn attr_index,
void *buf);
-extern intn Vsetattr(int32 vgroup_id,
- const char *attr_name,
+extern intn Vsetattr(int32 vgroup_id,
+ const char *attr_name,
int32 data_type,
- int32 n_values,
+ int32 n_values,
const void *values);
%cstring_bounded_output(char *attr_name, CHAR_BUFFER_SIZE);
extern intn Vattrinfo(int32 vgroup_id,
- intn attr_index,
+ intn attr_index,
char *attr_name,
int32 *OUTPUT, /* data_type */
int32 *OUTPUT, /* n_values */
=====================================
pyhdf/hdfext.py
=====================================
@@ -1,99 +1,62 @@
-# This file was automatically generated by SWIG (http://www.swig.org).
-# Version 3.0.12
+# This file was automatically generated by SWIG (https://www.swig.org).
+# Version 4.1.1
#
-# Do not make changes to this file unless you know what you are doing--modify
+# Do not make changes to this file unless you know what you are doing - modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
-if _swig_python_version_info >= (2, 7, 0):
- def swig_import_helper():
- import importlib
- pkg = __name__.rpartition('.')[0]
- mname = '.'.join((pkg, '_hdfext')).lstrip('.')
- try:
- return importlib.import_module(mname)
- except ImportError:
- return importlib.import_module('_hdfext')
- _hdfext = swig_import_helper()
- del swig_import_helper
-elif _swig_python_version_info >= (2, 6, 0):
- def swig_import_helper():
- from os.path import dirname
- import imp
- fp = None
- try:
- fp, pathname, description = imp.find_module('_hdfext', [dirname(__file__)])
- except ImportError:
- import _hdfext
- return _hdfext
- try:
- _mod = imp.load_module('_hdfext', fp, pathname, description)
- finally:
- if fp is not None:
- fp.close()
- return _mod
- _hdfext = swig_import_helper()
- del swig_import_helper
+# Import the low-level C/C++ module
+if __package__ or "." in __name__:
+ from . import _hdfext
else:
import _hdfext
-del _swig_python_version_info
-
-try:
- _swig_property = property
-except NameError:
- pass # Python < 2.2 doesn't have 'property'.
try:
import builtins as __builtin__
except ImportError:
import __builtin__
-def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
- if (name == "thisown"):
- return self.this.own(value)
- if (name == "this"):
- if type(value).__name__ == 'SwigPyObject':
- self.__dict__[name] = value
- return
- method = class_type.__swig_setmethods__.get(name, None)
- if method:
- return method(self, value)
- if (not static):
- if _newclass:
- object.__setattr__(self, name, value)
+def _swig_repr(self):
+ try:
+ strthis = "proxy of " + self.this.__repr__()
+ except __builtin__.Exception:
+ strthis = ""
+ return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
+
+
+def _swig_setattr_nondynamic_instance_variable(set):
+ def set_instance_attr(self, name, value):
+ if name == "this":
+ set(self, name, value)
+ elif name == "thisown":
+ self.this.own(value)
+ elif hasattr(self, name) and isinstance(getattr(type(self), name), property):
+ set(self, name, value)
else:
- self.__dict__[name] = value
- else:
- raise AttributeError("You cannot add attributes to %s" % self)
+ raise AttributeError("You cannot add instance attributes to %s" % self)
+ return set_instance_attr
-def _swig_setattr(self, class_type, name, value):
- return _swig_setattr_nondynamic(self, class_type, name, value, 0)
+def _swig_setattr_nondynamic_class_variable(set):
+ def set_class_attr(cls, name, value):
+ if hasattr(cls, name) and not isinstance(getattr(cls, name), property):
+ set(cls, name, value)
+ else:
+ raise AttributeError("You cannot add class attributes to %s" % cls)
+ return set_class_attr
-def _swig_getattr(self, class_type, name):
- if (name == "thisown"):
- return self.this.own()
- method = class_type.__swig_getmethods__.get(name, None)
- if method:
- return method(self)
- raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
+def _swig_add_metaclass(metaclass):
+ """Class decorator for adding a metaclass to a SWIG wrapped class - a slimmed down version of six.add_metaclass"""
+ def wrapper(cls):
+ return metaclass(cls.__name__, cls.__bases__, cls.__dict__.copy())
+ return wrapper
-def _swig_repr(self):
- try:
- strthis = "proxy of " + self.this.__repr__()
- except __builtin__.Exception:
- strthis = ""
- return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
+class _SwigNonDynamicMeta(type):
+ """Meta class to enforce nondynamic attributes (no new attributes) for a class"""
+ __setattr__ = _swig_setattr_nondynamic_class_variable(type.__setattr__)
-try:
- _object = object
- _newclass = 1
-except __builtin__.Exception:
- class _object:
- pass
- _newclass = 0
DFNT_NONE = _hdfext.DFNT_NONE
DFNT_QUERY = _hdfext.DFNT_QUERY
@@ -145,21 +108,13 @@ DFTAG_NDG = _hdfext.DFTAG_NDG
DFTAG_VH = _hdfext.DFTAG_VH
DFTAG_VG = _hdfext.DFTAG_VG
H4_MAX_VAR_DIMS = _hdfext.H4_MAX_VAR_DIMS
-class array_byte(_object):
- __swig_setmethods__ = {}
- __setattr__ = lambda self, name, value: _swig_setattr(self, array_byte, name, value)
- __swig_getmethods__ = {}
- __getattr__ = lambda self, name: _swig_getattr(self, array_byte, name)
+class array_byte(object):
+ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def __init__(self, nelements):
- this = _hdfext.new_array_byte(nelements)
- try:
- self.this.append(this)
- except __builtin__.Exception:
- self.this = this
+ _hdfext.array_byte_swiginit(self, _hdfext.new_array_byte(nelements))
__swig_destroy__ = _hdfext.delete_array_byte
- __del__ = lambda self: None
def __getitem__(self, index):
return _hdfext.array_byte___getitem__(self, index)
@@ -169,32 +124,20 @@ class array_byte(_object):
def cast(self):
return _hdfext.array_byte_cast(self)
- if _newclass:
- frompointer = staticmethod(_hdfext.array_byte_frompointer)
- else:
- frompointer = _hdfext.array_byte_frompointer
-array_byte_swigregister = _hdfext.array_byte_swigregister
-array_byte_swigregister(array_byte)
-
-def array_byte_frompointer(t):
- return _hdfext.array_byte_frompointer(t)
-array_byte_frompointer = _hdfext.array_byte_frompointer
-
-class array_int8(_object):
- __swig_setmethods__ = {}
- __setattr__ = lambda self, name, value: _swig_setattr(self, array_int8, name, value)
- __swig_getmethods__ = {}
- __getattr__ = lambda self, name: _swig_getattr(self, array_int8, name)
+
+ @staticmethod
+ def frompointer(t):
+ return _hdfext.array_byte_frompointer(t)
+
+# Register array_byte in _hdfext:
+_hdfext.array_byte_swigregister(array_byte)
+class array_int8(object):
+ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def __init__(self, nelements):
- this = _hdfext.new_array_int8(nelements)
- try:
- self.this.append(this)
- except __builtin__.Exception:
- self.this = this
+ _hdfext.array_int8_swiginit(self, _hdfext.new_array_int8(nelements))
__swig_destroy__ = _hdfext.delete_array_int8
- __del__ = lambda self: None
def __getitem__(self, index):
return _hdfext.array_int8___getitem__(self, index)
@@ -204,32 +147,20 @@ class array_int8(_object):
def cast(self):
return _hdfext.array_int8_cast(self)
- if _newclass:
- frompointer = staticmethod(_hdfext.array_int8_frompointer)
- else:
- frompointer = _hdfext.array_int8_frompointer
-array_int8_swigregister = _hdfext.array_int8_swigregister
-array_int8_swigregister(array_int8)
-
-def array_int8_frompointer(t):
- return _hdfext.array_int8_frompointer(t)
-array_int8_frompointer = _hdfext.array_int8_frompointer
-
-class array_int16(_object):
- __swig_setmethods__ = {}
- __setattr__ = lambda self, name, value: _swig_setattr(self, array_int16, name, value)
- __swig_getmethods__ = {}
- __getattr__ = lambda self, name: _swig_getattr(self, array_int16, name)
+
+ @staticmethod
+ def frompointer(t):
+ return _hdfext.array_int8_frompointer(t)
+
+# Register array_int8 in _hdfext:
+_hdfext.array_int8_swigregister(array_int8)
+class array_int16(object):
+ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def __init__(self, nelements):
- this = _hdfext.new_array_int16(nelements)
- try:
- self.this.append(this)
- except __builtin__.Exception:
- self.this = this
+ _hdfext.array_int16_swiginit(self, _hdfext.new_array_int16(nelements))
__swig_destroy__ = _hdfext.delete_array_int16
- __del__ = lambda self: None
def __getitem__(self, index):
return _hdfext.array_int16___getitem__(self, index)
@@ -239,32 +170,20 @@ class array_int16(_object):
def cast(self):
return _hdfext.array_int16_cast(self)
- if _newclass:
- frompointer = staticmethod(_hdfext.array_int16_frompointer)
- else:
- frompointer = _hdfext.array_int16_frompointer
-array_int16_swigregister = _hdfext.array_int16_swigregister
-array_int16_swigregister(array_int16)
-
-def array_int16_frompointer(t):
- return _hdfext.array_int16_frompointer(t)
-array_int16_frompointer = _hdfext.array_int16_frompointer
-
-class array_uint16(_object):
- __swig_setmethods__ = {}
- __setattr__ = lambda self, name, value: _swig_setattr(self, array_uint16, name, value)
- __swig_getmethods__ = {}
- __getattr__ = lambda self, name: _swig_getattr(self, array_uint16, name)
+
+ @staticmethod
+ def frompointer(t):
+ return _hdfext.array_int16_frompointer(t)
+
+# Register array_int16 in _hdfext:
+_hdfext.array_int16_swigregister(array_int16)
+class array_uint16(object):
+ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def __init__(self, nelements):
- this = _hdfext.new_array_uint16(nelements)
- try:
- self.this.append(this)
- except __builtin__.Exception:
- self.this = this
+ _hdfext.array_uint16_swiginit(self, _hdfext.new_array_uint16(nelements))
__swig_destroy__ = _hdfext.delete_array_uint16
- __del__ = lambda self: None
def __getitem__(self, index):
return _hdfext.array_uint16___getitem__(self, index)
@@ -274,32 +193,20 @@ class array_uint16(_object):
def cast(self):
return _hdfext.array_uint16_cast(self)
- if _newclass:
- frompointer = staticmethod(_hdfext.array_uint16_frompointer)
- else:
- frompointer = _hdfext.array_uint16_frompointer
-array_uint16_swigregister = _hdfext.array_uint16_swigregister
-array_uint16_swigregister(array_uint16)
-
-def array_uint16_frompointer(t):
- return _hdfext.array_uint16_frompointer(t)
-array_uint16_frompointer = _hdfext.array_uint16_frompointer
-
-class array_int32(_object):
- __swig_setmethods__ = {}
- __setattr__ = lambda self, name, value: _swig_setattr(self, array_int32, name, value)
- __swig_getmethods__ = {}
- __getattr__ = lambda self, name: _swig_getattr(self, array_int32, name)
+
+ @staticmethod
+ def frompointer(t):
+ return _hdfext.array_uint16_frompointer(t)
+
+# Register array_uint16 in _hdfext:
+_hdfext.array_uint16_swigregister(array_uint16)
+class array_int32(object):
+ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def __init__(self, nelements):
- this = _hdfext.new_array_int32(nelements)
- try:
- self.this.append(this)
- except __builtin__.Exception:
- self.this = this
+ _hdfext.array_int32_swiginit(self, _hdfext.new_array_int32(nelements))
__swig_destroy__ = _hdfext.delete_array_int32
- __del__ = lambda self: None
def __getitem__(self, index):
return _hdfext.array_int32___getitem__(self, index)
@@ -309,32 +216,20 @@ class array_int32(_object):
def cast(self):
return _hdfext.array_int32_cast(self)
- if _newclass:
- frompointer = staticmethod(_hdfext.array_int32_frompointer)
- else:
- frompointer = _hdfext.array_int32_frompointer
-array_int32_swigregister = _hdfext.array_int32_swigregister
-array_int32_swigregister(array_int32)
-
-def array_int32_frompointer(t):
- return _hdfext.array_int32_frompointer(t)
-array_int32_frompointer = _hdfext.array_int32_frompointer
-
-class array_uint32(_object):
- __swig_setmethods__ = {}
- __setattr__ = lambda self, name, value: _swig_setattr(self, array_uint32, name, value)
- __swig_getmethods__ = {}
- __getattr__ = lambda self, name: _swig_getattr(self, array_uint32, name)
+
+ @staticmethod
+ def frompointer(t):
+ return _hdfext.array_int32_frompointer(t)
+
+# Register array_int32 in _hdfext:
+_hdfext.array_int32_swigregister(array_int32)
+class array_uint32(object):
+ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def __init__(self, nelements):
- this = _hdfext.new_array_uint32(nelements)
- try:
- self.this.append(this)
- except __builtin__.Exception:
- self.this = this
+ _hdfext.array_uint32_swiginit(self, _hdfext.new_array_uint32(nelements))
__swig_destroy__ = _hdfext.delete_array_uint32
- __del__ = lambda self: None
def __getitem__(self, index):
return _hdfext.array_uint32___getitem__(self, index)
@@ -344,32 +239,20 @@ class array_uint32(_object):
def cast(self):
return _hdfext.array_uint32_cast(self)
- if _newclass:
- frompointer = staticmethod(_hdfext.array_uint32_frompointer)
- else:
- frompointer = _hdfext.array_uint32_frompointer
-array_uint32_swigregister = _hdfext.array_uint32_swigregister
-array_uint32_swigregister(array_uint32)
-
-def array_uint32_frompointer(t):
- return _hdfext.array_uint32_frompointer(t)
-array_uint32_frompointer = _hdfext.array_uint32_frompointer
-
-class array_float32(_object):
- __swig_setmethods__ = {}
- __setattr__ = lambda self, name, value: _swig_setattr(self, array_float32, name, value)
- __swig_getmethods__ = {}
- __getattr__ = lambda self, name: _swig_getattr(self, array_float32, name)
+
+ @staticmethod
+ def frompointer(t):
+ return _hdfext.array_uint32_frompointer(t)
+
+# Register array_uint32 in _hdfext:
+_hdfext.array_uint32_swigregister(array_uint32)
+class array_float32(object):
+ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def __init__(self, nelements):
- this = _hdfext.new_array_float32(nelements)
- try:
- self.this.append(this)
- except __builtin__.Exception:
- self.this = this
+ _hdfext.array_float32_swiginit(self, _hdfext.new_array_float32(nelements))
__swig_destroy__ = _hdfext.delete_array_float32
- __del__ = lambda self: None
def __getitem__(self, index):
return _hdfext.array_float32___getitem__(self, index)
@@ -379,32 +262,20 @@ class array_float32(_object):
def cast(self):
return _hdfext.array_float32_cast(self)
- if _newclass:
- frompointer = staticmethod(_hdfext.array_float32_frompointer)
- else:
- frompointer = _hdfext.array_float32_frompointer
-array_float32_swigregister = _hdfext.array_float32_swigregister
-array_float32_swigregister(array_float32)
-
-def array_float32_frompointer(t):
- return _hdfext.array_float32_frompointer(t)
-array_float32_frompointer = _hdfext.array_float32_frompointer
-
-class array_float64(_object):
- __swig_setmethods__ = {}
- __setattr__ = lambda self, name, value: _swig_setattr(self, array_float64, name, value)
- __swig_getmethods__ = {}
- __getattr__ = lambda self, name: _swig_getattr(self, array_float64, name)
+
+ @staticmethod
+ def frompointer(t):
+ return _hdfext.array_float32_frompointer(t)
+
+# Register array_float32 in _hdfext:
+_hdfext.array_float32_swigregister(array_float32)
+class array_float64(object):
+ thisown = property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc="The membership flag")
__repr__ = _swig_repr
def __init__(self, nelements):
- this = _hdfext.new_array_float64(nelements)
- try:
- self.this.append(this)
- except __builtin__.Exception:
- self.this = this
+ _hdfext.array_float64_swiginit(self, _hdfext.new_array_float64(nelements))
__swig_destroy__ = _hdfext.delete_array_float64
- __del__ = lambda self: None
def __getitem__(self, index):
return _hdfext.array_float64___getitem__(self, index)
@@ -414,493 +285,368 @@ class array_float64(_object):
def cast(self):
return _hdfext.array_float64_cast(self)
- if _newclass:
- frompointer = staticmethod(_hdfext.array_float64_frompointer)
- else:
- frompointer = _hdfext.array_float64_frompointer
-array_float64_swigregister = _hdfext.array_float64_swigregister
-array_float64_swigregister(array_float64)
-def array_float64_frompointer(t):
- return _hdfext.array_float64_frompointer(t)
-array_float64_frompointer = _hdfext.array_float64_frompointer
+ @staticmethod
+ def frompointer(t):
+ return _hdfext.array_float64_frompointer(t)
+# Register array_float64 in _hdfext:
+_hdfext.array_float64_swigregister(array_float64)
def new_array_voidp(nelements):
return _hdfext.new_array_voidp(nelements)
-new_array_voidp = _hdfext.new_array_voidp
def delete_array_voidp(ary):
return _hdfext.delete_array_voidp(ary)
-delete_array_voidp = _hdfext.delete_array_voidp
def array_voidp_getitem(ary, index):
return _hdfext.array_voidp_getitem(ary, index)
-array_voidp_getitem = _hdfext.array_voidp_getitem
def array_voidp_setitem(ary, index, value):
return _hdfext.array_voidp_setitem(ary, index, value)
-array_voidp_setitem = _hdfext.array_voidp_setitem
def Hopen(filename, access_mode, num_dds_blocks):
return _hdfext.Hopen(filename, access_mode, num_dds_blocks)
-Hopen = _hdfext.Hopen
def Hclose(file_id):
return _hdfext.Hclose(file_id)
-Hclose = _hdfext.Hclose
def Hgetlibversion():
return _hdfext.Hgetlibversion()
-Hgetlibversion = _hdfext.Hgetlibversion
def Hgetfileversion(file_id):
return _hdfext.Hgetfileversion(file_id)
-Hgetfileversion = _hdfext.Hgetfileversion
def Hishdf(filename):
return _hdfext.Hishdf(filename)
-Hishdf = _hdfext.Hishdf
def HEvalue(error_stack_offset):
return _hdfext.HEvalue(error_stack_offset)
-HEvalue = _hdfext.HEvalue
def HEstring(error_code):
return _hdfext.HEstring(error_code)
-HEstring = _hdfext.HEstring
def _HEprint():
return _hdfext._HEprint()
-_HEprint = _hdfext._HEprint
def _SDreaddata_0(sds_id, data_type, start, edges, stride):
return _hdfext._SDreaddata_0(sds_id, data_type, start, edges, stride)
-_SDreaddata_0 = _hdfext._SDreaddata_0
def _SDwritedata_0(sds_id, data_type, start, edges, data, stride):
return _hdfext._SDwritedata_0(sds_id, data_type, start, edges, data, stride)
-_SDwritedata_0 = _hdfext._SDwritedata_0
def SDstart(filename, access_mode):
return _hdfext.SDstart(filename, access_mode)
-SDstart = _hdfext.SDstart
def SDcreate(sd_id, sds_name, data_type, rank, dim_sizes):
return _hdfext.SDcreate(sd_id, sds_name, data_type, rank, dim_sizes)
-SDcreate = _hdfext.SDcreate
def SDselect(sd_id, sds_index):
return _hdfext.SDselect(sd_id, sds_index)
-SDselect = _hdfext.SDselect
def SDendaccess(sds_id):
return _hdfext.SDendaccess(sds_id)
-SDendaccess = _hdfext.SDendaccess
def SDend(sd_id):
return _hdfext.SDend(sd_id)
-SDend = _hdfext.SDend
def SDfileinfo(sd_id):
return _hdfext.SDfileinfo(sd_id)
-SDfileinfo = _hdfext.SDfileinfo
def SDgetinfo(sds_id, buf):
return _hdfext.SDgetinfo(sds_id, buf)
-SDgetinfo = _hdfext.SDgetinfo
def SDcheckempty(sds_id):
return _hdfext.SDcheckempty(sds_id)
-SDcheckempty = _hdfext.SDcheckempty
def SDidtoref(sds_id):
return _hdfext.SDidtoref(sds_id)
-SDidtoref = _hdfext.SDidtoref
def SDiscoordvar(sds_id):
return _hdfext.SDiscoordvar(sds_id)
-SDiscoordvar = _hdfext.SDiscoordvar
def SDisrecord(sds_id):
return _hdfext.SDisrecord(sds_id)
-SDisrecord = _hdfext.SDisrecord
def SDnametoindex(sd_id, sds_name):
return _hdfext.SDnametoindex(sd_id, sds_name)
-SDnametoindex = _hdfext.SDnametoindex
def SDreftoindex(sd_id, sds_ref):
return _hdfext.SDreftoindex(sd_id, sds_ref)
-SDreftoindex = _hdfext.SDreftoindex
def SDdiminfo(dim_id):
return _hdfext.SDdiminfo(dim_id)
-SDdiminfo = _hdfext.SDdiminfo
def SDgetdimid(sds_id, dim_index):
return _hdfext.SDgetdimid(sds_id, dim_index)
-SDgetdimid = _hdfext.SDgetdimid
def SDsetdimname(dim_id, dim_name):
return _hdfext.SDsetdimname(dim_id, dim_name)
-SDsetdimname = _hdfext.SDsetdimname
def SDgetdimscale(dim_id, buf):
return _hdfext.SDgetdimscale(dim_id, buf)
-SDgetdimscale = _hdfext.SDgetdimscale
def SDsetdimscale(dim_id, n_values, data_type, buf):
return _hdfext.SDsetdimscale(dim_id, n_values, data_type, buf)
-SDsetdimscale = _hdfext.SDsetdimscale
def SDattrinfo(obj_id, attr_index):
return _hdfext.SDattrinfo(obj_id, attr_index)
-SDattrinfo = _hdfext.SDattrinfo
def SDfindattr(obj_id, attr_name):
return _hdfext.SDfindattr(obj_id, attr_name)
-SDfindattr = _hdfext.SDfindattr
def SDreadattr(obj_id, attr_index, buf):
return _hdfext.SDreadattr(obj_id, attr_index, buf)
-SDreadattr = _hdfext.SDreadattr
def SDsetattr(obj_id, attr_name, data_type, n_values, values):
return _hdfext.SDsetattr(obj_id, attr_name, data_type, n_values, values)
-SDsetattr = _hdfext.SDsetattr
def SDgetcal(sds_id):
return _hdfext.SDgetcal(sds_id)
-SDgetcal = _hdfext.SDgetcal
def SDgetdatastrs(sds_id, len):
return _hdfext.SDgetdatastrs(sds_id, len)
-SDgetdatastrs = _hdfext.SDgetdatastrs
def SDgetdimstrs(sds_id, len):
return _hdfext.SDgetdimstrs(sds_id, len)
-SDgetdimstrs = _hdfext.SDgetdimstrs
def SDgetfillvalue(sds_id, buf):
return _hdfext.SDgetfillvalue(sds_id, buf)
-SDgetfillvalue = _hdfext.SDgetfillvalue
def SDgetrange(sds_id, buf1, buf2):
return _hdfext.SDgetrange(sds_id, buf1, buf2)
-SDgetrange = _hdfext.SDgetrange
def SDsetcal(sds_id, cal, cal_error, offset, offset_err, data_type):
return _hdfext.SDsetcal(sds_id, cal, cal_error, offset, offset_err, data_type)
-SDsetcal = _hdfext.SDsetcal
def SDsetdatastrs(sds_id, label, unit, format, coord_system):
return _hdfext.SDsetdatastrs(sds_id, label, unit, format, coord_system)
-SDsetdatastrs = _hdfext.SDsetdatastrs
def SDsetdimstrs(sds_id, label, unit, format):
return _hdfext.SDsetdimstrs(sds_id, label, unit, format)
-SDsetdimstrs = _hdfext.SDsetdimstrs
def SDsetfillmode(sd_id, fill_mode):
return _hdfext.SDsetfillmode(sd_id, fill_mode)
-SDsetfillmode = _hdfext.SDsetfillmode
def SDsetfillvalue(sds_id, fill_val):
return _hdfext.SDsetfillvalue(sds_id, fill_val)
-SDsetfillvalue = _hdfext.SDsetfillvalue
def SDsetrange(sds_id, max, min):
return _hdfext.SDsetrange(sds_id, max, min)
-SDsetrange = _hdfext.SDsetrange
def _SDgetcompress(sds_id):
return _hdfext._SDgetcompress(sds_id)
-_SDgetcompress = _hdfext._SDgetcompress
def _SDsetcompress(sds_id, comp_type, value, v2):
return _hdfext._SDsetcompress(sds_id, comp_type, value, v2)
-_SDsetcompress = _hdfext._SDsetcompress
def SDsetexternalfile(sds_id, filename, offset):
return _hdfext.SDsetexternalfile(sds_id, filename, offset)
-SDsetexternalfile = _hdfext.SDsetexternalfile
def Vinitialize(file_id):
return _hdfext.Vinitialize(file_id)
-Vinitialize = _hdfext.Vinitialize
def VSattach(file_id, vdata_ref, vdata_access_mode):
return _hdfext.VSattach(file_id, vdata_ref, vdata_access_mode)
-VSattach = _hdfext.VSattach
def VSdetach(vdata_id):
return _hdfext.VSdetach(vdata_id)
-VSdetach = _hdfext.VSdetach
def Vfinish(file_id):
return _hdfext.Vfinish(file_id)
-Vfinish = _hdfext.Vfinish
def VHstoredata(file_id, fieldname, buf, n_records, data_type, vdata_name, vdata_class):
return _hdfext.VHstoredata(file_id, fieldname, buf, n_records, data_type, vdata_name, vdata_class)
-VHstoredata = _hdfext.VHstoredata
def VHstoredatam(file_id, fieldname, buf, n_records, data_type, vdata_name, vdata_class, order):
return _hdfext.VHstoredatam(file_id, fieldname, buf, n_records, data_type, vdata_name, vdata_class, order)
-VHstoredatam = _hdfext.VHstoredatam
def VSfdefine(vdata_id, fieldname, data_type, order):
return _hdfext.VSfdefine(vdata_id, fieldname, data_type, order)
-VSfdefine = _hdfext.VSfdefine
def VSsetfields(vdata_id, fieldname_list):
return _hdfext.VSsetfields(vdata_id, fieldname_list)
-VSsetfields = _hdfext.VSsetfields
def VSseek(vdata_id, record_index):
return _hdfext.VSseek(vdata_id, record_index)
-VSseek = _hdfext.VSseek
def VSread(vdata_id, databuf, n_records, interlace_mode):
return _hdfext.VSread(vdata_id, databuf, n_records, interlace_mode)
-VSread = _hdfext.VSread
def VSwrite(vdata_id, databuf, n_records, interlace_mode):
return _hdfext.VSwrite(vdata_id, databuf, n_records, interlace_mode)
-VSwrite = _hdfext.VSwrite
def VSfpack(vdata_id, action, fields_in_buf, buf, buf_size, n_records, fieldname_list, bufptrs):
return _hdfext.VSfpack(vdata_id, action, fields_in_buf, buf, buf_size, n_records, fieldname_list, bufptrs)
-VSfpack = _hdfext.VSfpack
def VSelts(vdata_id):
return _hdfext.VSelts(vdata_id)
-VSelts = _hdfext.VSelts
def VSgetclass(vdata_id):
return _hdfext.VSgetclass(vdata_id)
-VSgetclass = _hdfext.VSgetclass
def VSgetfields(vdata_id):
return _hdfext.VSgetfields(vdata_id)
-VSgetfields = _hdfext.VSgetfields
def VSgetinterlace(vdata_id):
return _hdfext.VSgetinterlace(vdata_id)
-VSgetinterlace = _hdfext.VSgetinterlace
def VSgetname(vdata_id):
return _hdfext.VSgetname(vdata_id)
-VSgetname = _hdfext.VSgetname
def VSsizeof(vdata_id, fieldname_list):
return _hdfext.VSsizeof(vdata_id, fieldname_list)
-VSsizeof = _hdfext.VSsizeof
def VSinquire(vdata_id):
return _hdfext.VSinquire(vdata_id)
-VSinquire = _hdfext.VSinquire
def VSQuerytag(vdata_id):
return _hdfext.VSQuerytag(vdata_id)
-VSQuerytag = _hdfext.VSQuerytag
def VSQueryref(vdata_id):
return _hdfext.VSQueryref(vdata_id)
-VSQueryref = _hdfext.VSQueryref
def VSfindex(vdata_id, field_name):
return _hdfext.VSfindex(vdata_id, field_name)
-VSfindex = _hdfext.VSfindex
def VSisattr(vdta_id):
return _hdfext.VSisattr(vdta_id)
-VSisattr = _hdfext.VSisattr
def VFnfields(vdata_id):
return _hdfext.VFnfields(vdata_id)
-VFnfields = _hdfext.VFnfields
def VFfieldtype(vdata_id, field_index):
return _hdfext.VFfieldtype(vdata_id, field_index)
-VFfieldtype = _hdfext.VFfieldtype
def VFfieldname(vdata_id, field_index):
return _hdfext.VFfieldname(vdata_id, field_index)
-VFfieldname = _hdfext.VFfieldname
def VFfieldesize(vdata_id, field_index):
return _hdfext.VFfieldesize(vdata_id, field_index)
-VFfieldesize = _hdfext.VFfieldesize
def VFfieldisize(vdata_id, field_index):
return _hdfext.VFfieldisize(vdata_id, field_index)
-VFfieldisize = _hdfext.VFfieldisize
def VFfieldorder(vdata_id, field_index):
return _hdfext.VFfieldorder(vdata_id, field_index)
-VFfieldorder = _hdfext.VFfieldorder
def VSfind(file_id, vdata_name):
return _hdfext.VSfind(file_id, vdata_name)
-VSfind = _hdfext.VSfind
def VSgetid(file_id, vdata_ref):
return _hdfext.VSgetid(file_id, vdata_ref)
-VSgetid = _hdfext.VSgetid
def VSfexist(vdata_id, fieldname_list):
return _hdfext.VSfexist(vdata_id, fieldname_list)
-VSfexist = _hdfext.VSfexist
def VSsetclass(vdata_id, vdata_class):
return _hdfext.VSsetclass(vdata_id, vdata_class)
-VSsetclass = _hdfext.VSsetclass
def VSsetname(vdata_id, vdata_name):
return _hdfext.VSsetname(vdata_id, vdata_name)
-VSsetname = _hdfext.VSsetname
def VSsetinterlace(vdata_id, interlace_mode):
return _hdfext.VSsetinterlace(vdata_id, interlace_mode)
-VSsetinterlace = _hdfext.VSsetinterlace
def VSsetattr(vdata_id, field_index, attr_name, data_type, n_values, values):
return _hdfext.VSsetattr(vdata_id, field_index, attr_name, data_type, n_values, values)
-VSsetattr = _hdfext.VSsetattr
def VSgetattr(vdata_id, field_index, attr_index, buf):
return _hdfext.VSgetattr(vdata_id, field_index, attr_index, buf)
-VSgetattr = _hdfext.VSgetattr
def VSfnattrs(vdata_id, field_index):
return _hdfext.VSfnattrs(vdata_id, field_index)
-VSfnattrs = _hdfext.VSfnattrs
def VSnattrs(vdata_id):
return _hdfext.VSnattrs(vdata_id)
-VSnattrs = _hdfext.VSnattrs
def VSattrinfo(vdata_id, field_index, attr_index):
return _hdfext.VSattrinfo(vdata_id, field_index, attr_index)
-VSattrinfo = _hdfext.VSattrinfo
def VSfindattr(vdata_id, field_index, attr_name):
return _hdfext.VSfindattr(vdata_id, field_index, attr_name)
-VSfindattr = _hdfext.VSfindattr
def Vattach(file_id, vgroup_ref, vg_access_mode):
return _hdfext.Vattach(file_id, vgroup_ref, vg_access_mode)
-Vattach = _hdfext.Vattach
def Vdetach(vgroup_id):
return _hdfext.Vdetach(vgroup_id)
-Vdetach = _hdfext.Vdetach
def Vgetname(vgroup_id):
return _hdfext.Vgetname(vgroup_id)
-Vgetname = _hdfext.Vgetname
def Vsetname(vgroup_id, vgroup_name):
return _hdfext.Vsetname(vgroup_id, vgroup_name)
-Vsetname = _hdfext.Vsetname
def Vgetclass(vgroup_id):
return _hdfext.Vgetclass(vgroup_id)
-Vgetclass = _hdfext.Vgetclass
def Vsetclass(vgroup_id, vgroup_class):
return _hdfext.Vsetclass(vgroup_id, vgroup_class)
-Vsetclass = _hdfext.Vsetclass
def Vfind(file_id, vgroup_name):
return _hdfext.Vfind(file_id, vgroup_name)
-Vfind = _hdfext.Vfind
def Vfindclass(file_id, vgroup_class):
return _hdfext.Vfindclass(file_id, vgroup_class)
-Vfindclass = _hdfext.Vfindclass
def Vinsert(vgroup_id, v_id):
return _hdfext.Vinsert(vgroup_id, v_id)
-Vinsert = _hdfext.Vinsert
def Vaddtagref(vgroup_id, obj_tag, obj_ref):
return _hdfext.Vaddtagref(vgroup_id, obj_tag, obj_ref)
-Vaddtagref = _hdfext.Vaddtagref
def Vdeletetagref(vgroup_id, obj_tag, obj_ref):
return _hdfext.Vdeletetagref(vgroup_id, obj_tag, obj_ref)
-Vdeletetagref = _hdfext.Vdeletetagref
def Vdelete(file_id, vgroup_id):
return _hdfext.Vdelete(file_id, vgroup_id)
-Vdelete = _hdfext.Vdelete
def VQueryref(vgroup_id):
return _hdfext.VQueryref(vgroup_id)
-VQueryref = _hdfext.VQueryref
def VQuerytag(vgroup_id):
return _hdfext.VQuerytag(vgroup_id)
-VQuerytag = _hdfext.VQuerytag
def Vntagrefs(vgroup_id):
return _hdfext.Vntagrefs(vgroup_id)
-Vntagrefs = _hdfext.Vntagrefs
def Vgettagref(vgroup_id, index):
return _hdfext.Vgettagref(vgroup_id, index)
-Vgettagref = _hdfext.Vgettagref
def Vgetversion(vgroup_id):
return _hdfext.Vgetversion(vgroup_id)
-Vgetversion = _hdfext.Vgetversion
def Vgettagrefs(vgroup_id, tag_attay, ref_array, maxsize):
return _hdfext.Vgettagrefs(vgroup_id, tag_attay, ref_array, maxsize)
-Vgettagrefs = _hdfext.Vgettagrefs
def Vgetid(file_id, vgroup_ref):
return _hdfext.Vgetid(file_id, vgroup_ref)
-Vgetid = _hdfext.Vgetid
def Vinqtagref(vgroup_id, tag, ref):
return _hdfext.Vinqtagref(vgroup_id, tag, ref)
-Vinqtagref = _hdfext.Vinqtagref
def Visvg(vgroup_id, obj_ref):
return _hdfext.Visvg(vgroup_id, obj_ref)
-Visvg = _hdfext.Visvg
def Visvs(vgroup_id, obj_ref):
return _hdfext.Visvs(vgroup_id, obj_ref)
-Visvs = _hdfext.Visvs
def Vnrefs(vgroup_id, tag_type):
return _hdfext.Vnrefs(vgroup_id, tag_type)
-Vnrefs = _hdfext.Vnrefs
def Vfindattr(vgroup_id, attr_name):
return _hdfext.Vfindattr(vgroup_id, attr_name)
-Vfindattr = _hdfext.Vfindattr
def Vgetattr(vdata_id, attr_index, buf):
return _hdfext.Vgetattr(vdata_id, attr_index, buf)
-Vgetattr = _hdfext.Vgetattr
def Vsetattr(vgroup_id, attr_name, data_type, n_values, values):
return _hdfext.Vsetattr(vgroup_id, attr_name, data_type, n_values, values)
-Vsetattr = _hdfext.Vsetattr
def Vattrinfo(vgroup_id, attr_index):
return _hdfext.Vattrinfo(vgroup_id, attr_index)
-Vattrinfo = _hdfext.Vattrinfo
def Vnattrs(vgroup_id):
return _hdfext.Vnattrs(vgroup_id)
-Vnattrs = _hdfext.Vnattrs
-# This file is compatible with both classic and new-style classes.
-
=====================================
pyhdf/hdfext_wrap.c
=====================================
The diff for this file was not included because it is too large.
=====================================
pyproject.toml
=====================================
@@ -1,7 +1,40 @@
[build-system]
-# Minimum requirements for the build system to execute.
-requires = [ # PEP 508 specifications.
- "numpy",
+requires = [
"setuptools",
- "wheel"
+ "numpy",
+]
+build-backend = "setuptools.build_meta"
+
+[project]
+name = "pyhdf"
+version = "0.11.3"
+description = "Python interface to the NCSA HDF4 library"
+readme = "README.md"
+keywords = ['hdf4', 'netcdf', 'numpy', 'python', 'pyhdf']
+classifiers = [
+ "Development Status :: 5 - Production/Stable",
+ "Intended Audience :: Science/Research",
+ "Intended Audience :: Developers",
+ "License :: OSI Approved",
+ "Programming Language :: C",
+ "Programming Language :: Python",
+ "Programming Language :: Python :: 3",
+ "Topic :: Software Development",
+ "Topic :: Scientific/Engineering",
+ "Operating System :: Microsoft :: Windows",
+ "Operating System :: POSIX",
+ "Operating System :: Unix",
+ "Operating System :: MacOS",
+]
+license = {text = "MIT License"}
+authors = [
+ {name = "Andre Gosselin", email = "Andre.Gosselin at dfo-mpo.gc.ca"},
+ {name = "Travis E. Oliphant", email = "teoliphant at gmail.com"},
+]
+maintainers = [
+ {name = "Fazlul Shahriar", email = "fshahriar at gmail.com"},
]
+dependencies = []
+
+[project.urls]
+Homepage = 'https://github.com/fhs/pyhdf'
=====================================
setup.cfg
=====================================
@@ -1,12 +1,2 @@
-[bdist_rpm]
-group = Development/Python
-packager = Fazlul Shahriar <fshahriar at gmail.com>
-release = 1
-requires = HDF-4.2r1
- numpy
-provides = pyhdf
-doc_files = pyhdf/doc/
-
[options]
-install_requires = numpy
-setup_requires = numpy
+packages = pyhdf
=====================================
setup.py
=====================================
@@ -1,61 +1,29 @@
-#!/usr/bin/env python
-"""pyhdf: Python interface to the NCSA HDF4 library.
-
-The pyhdf package wraps the functionality of the NCSA HDF version
-4 library inside a Python OOP framework. The SD (scientific dataset),
-VS (Vdata) and V (Vgroup) APIs are currently implemented. SD datasets
-are read/written through numpy arrays. NetCDF files can also be read
-and modified with pyhdf.
-"""
-
from __future__ import print_function
-DOCLINES = __doc__.split("\n")
-
-# Allows bdist_egg to work if you have setuptools installed.
-# This import must be before the numpy.distutils import of setup.
-# Otherwise, no harm.
-try:
- import setuptools
-except:
- pass
-
-from numpy.distutils.core import setup, Extension
-
import sys
import os
import os.path as path
import shlex
-CLASSIFIERS = """\
-Development Status :: 5 - Production/Stable
-Intended Audience :: Science/Research
-Intended Audience :: Developers
-License :: OSI Approved
-Programming Language :: C
-Programming Language :: Python
-Programming Language :: Python :: 3
-Topic :: Software Development
-Topic :: Scientific/Engineering
-Operating System :: Microsoft :: Windows
-Operating System :: POSIX
-Operating System :: Unix
-Operating System :: MacOS
-"""
+from setuptools import Extension, setup
+import numpy as np
+
def _find_args(pat, env):
- val = os.environ.get(env, [])
- if val:
- val = val.split(os.pathsep)
+ try:
+ val = os.environ[env].split(os.pathsep)
+ except KeyError:
+ val = []
try:
k = sys.argv.index(pat)
- val.extend(sys.argv[k+1].split(os.pathsep))
+ val.extend(sys.argv[k + 1].split(os.pathsep))
del sys.argv[k]
del sys.argv[k]
except ValueError:
pass
return val
+
# A Debian based linux distribution might be using libhdf4 (contains netcdf
# routines) or libhdf4-alt (does not contain netcdf routines). This function
# tries to detect if the alt version should be used.
@@ -67,25 +35,29 @@ def _use_hdf4alt(libdirs):
libdirs.append("/usr/local/lib")
libdirs.append("/lib")
for d in libdirs:
- if os.path.exists(os.path.join(d, "libdfalt.so")) and \
- os.path.exists(os.path.join(d, "libmfhdfalt.so")):
+ if os.path.exists(os.path.join(d, "libdfalt.so")) and os.path.exists(
+ os.path.join(d, "libmfhdfalt.so")
+ ):
return True
return False
-include_dirs = _find_args('-i', 'INCLUDE_DIRS')
-library_dirs = _find_args('-l', 'LIBRARY_DIRS')
-szip_installed = 'SZIP' in os.environ
-compress = 'NO_COMPRESS' not in os.environ
+
+include_dirs = _find_args("-i", "INCLUDE_DIRS")
+library_dirs = _find_args("-l", "LIBRARY_DIRS")
+szip_installed = "SZIP" in os.environ
+compress = "NO_COMPRESS" not in os.environ
extra_link_args = None
if "LINK_ARGS" in os.environ:
extra_link_args = shlex.split(os.environ["LINK_ARGS"])
-msg = 'Cannot proceed without the HDF4 library. Please ' \
- 'export INCLUDE_DIRS and LIBRARY_DIRS as explained' \
- 'in the INSTALL file.'
+msg = (
+ "Cannot proceed without the HDF4 library. Please "
+ "export INCLUDE_DIRS and LIBRARY_DIRS as explained"
+ "in the INSTALL file."
+)
-if sys.platform.startswith('linux'):
+if sys.platform.startswith("linux"):
# libhdf4 header files on most linux distributations
# (e.g. Debian/Ubuntu, CentOS) are stored in /usr/include/hdf
d = "/usr/include/hdf/"
@@ -97,19 +69,8 @@ for p in include_dirs + library_dirs:
print("\n******\n%s not found\n******\n\n" % p)
raise RuntimeError(msg)
-if sys.platform == 'win32':
- # Find DLL path
- dll_path = ''
- for p in library_dirs:
- if path.exists(p + os.path.sep + "mfhdf.dll"):
- dll_path = p + os.path.sep
- break
- if dll_path == '':
- print("library_dirs =", library_dirs)
- raise RuntimeError("Cannot find required HDF4 DLLs -- check LIBRARY_DIRS")
-
-if sys.platform == 'win32':
- libraries = ["mfhdf", "hdf", "xdr" ]
+if sys.platform == "win32":
+ libraries = ["mfhdf", "hdf", "xdr"]
elif _use_hdf4alt(library_dirs):
libraries = ["mfhdfalt", "dfalt"]
else:
@@ -117,13 +78,13 @@ else:
if szip_installed:
extra_compile_args = []
- if sys.platform == 'win32':
+ if sys.platform == "win32":
libraries += ["szlib"]
else:
libraries += ["sz"]
else:
extra_compile_args = ["-DNOSZIP"]
-if sys.platform == 'win32':
+if sys.platform == "win32":
libraries += ["libjpeg", "zlib", "ws2_32"]
else:
libraries += ["jpeg", "z"]
@@ -131,33 +92,17 @@ else:
if not compress:
extra_compile_args += ["-DNOCOMPRESS"]
-_hdfext = Extension('pyhdf._hdfext',
- sources = ["pyhdf/hdfext_wrap.c"],
- include_dirs = include_dirs,
- extra_compile_args = extra_compile_args,
- library_dirs = library_dirs,
- extra_link_args=extra_link_args,
- libraries = libraries,
- )
-
-if sys.platform == 'win32':
- data_files = [("pyhdf", [dll_path + x for x in ["mfhdf.dll", "hdf.dll"]])]
-else:
- data_files = []
-
-setup(name = 'pyhdf',
- maintainer = 'pyhdf authors',
- author = 'Andre Gosselin et al.',
- description = DOCLINES[0],
- keywords = ['hdf4', 'netcdf', 'numpy', 'python', 'pyhdf'],
- license = 'MIT',
- long_description = "\n".join(DOCLINES[2:]),
- url = 'https://github.com/fhs/pyhdf',
- version = '0.10.5',
- packages = ['pyhdf'],
- ext_modules = [_hdfext],
- data_files = data_files,
- provides = ['pyhdf'],
- classifiers = [_f for _f in CLASSIFIERS.split('\n') if _f],
- platforms = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"],
- )
+
+setup(
+ ext_modules=[
+ Extension(
+ name="pyhdf._hdfext",
+ sources=["pyhdf/hdfext_wrap.c"],
+ include_dirs=[np.get_include()] + include_dirs,
+ extra_compile_args=extra_compile_args,
+ library_dirs=library_dirs,
+ extra_link_args=extra_link_args,
+ libraries=libraries,
+ ),
+ ],
+)
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-hdf4/-/commit/a6d536324f5e15ef2cea02d284f1a0233d832ae4
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/python-hdf4/-/commit/a6d536324f5e15ef2cea02d284f1a0233d832ae4
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20230627/5f1983a9/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list