mirror of
https://github.com/TREX-CoE/trexio.git
synced 2024-12-22 12:23:54 +01:00
Merge branch 'master' of github.com:TREX-CoE/trexio
This commit is contained in:
commit
b68fe5a18a
66
.github/workflows/actions.yml
vendored
66
.github/workflows/actions.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
||||
|
||||
get_commit_message:
|
||||
name: Get commit message
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-22.04
|
||||
outputs:
|
||||
message: ${{ steps.commit_message.outputs.message }}
|
||||
steps:
|
||||
@ -29,11 +29,12 @@ jobs:
|
||||
run: |
|
||||
set -xe
|
||||
COMMIT_MSG=$(git log --no-merges -1 --oneline)
|
||||
echo "::set-output name=message::$COMMIT_MSG"
|
||||
echo "message=$COMMIT_MSG" >> $GITHUB_OUTPUT
|
||||
echo github.ref ${{ github.ref }}
|
||||
|
||||
trexio_ubuntu:
|
||||
name: x86 Ubuntu 20.04
|
||||
runs-on: ubuntu-20.04
|
||||
name: x86 Ubuntu
|
||||
runs-on: ubuntu-22.04
|
||||
needs: get_commit_message
|
||||
|
||||
steps:
|
||||
@ -53,8 +54,8 @@ jobs:
|
||||
|
||||
- name: install dependencies
|
||||
run: |
|
||||
sudo add-apt-repository ppa:kelleyk/emacs
|
||||
sudo apt-get install libhdf5-dev emacs26
|
||||
sudo apt-get update
|
||||
sudo apt-get install libhdf5-dev emacs
|
||||
|
||||
- name: configure with autotools
|
||||
run: |
|
||||
@ -69,24 +70,29 @@ jobs:
|
||||
|
||||
- name: Archive test log file
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2
|
||||
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
|
||||
with:
|
||||
name: test-report-ubuntu
|
||||
path: test-suite.log
|
||||
|
||||
- name: create virtual environment
|
||||
- name: create venv
|
||||
run: |
|
||||
python3 -m venv --clear pytrexio-venv
|
||||
source pytrexio-venv/bin/activate
|
||||
python3 -m venv trexio-venv
|
||||
source trexio-venv/bin/activate
|
||||
|
||||
- name: install Python API
|
||||
run: make python-install
|
||||
run: |
|
||||
source trexio-venv/bin/activate
|
||||
make python-install
|
||||
|
||||
- name: check Python API
|
||||
run: make python-test
|
||||
run: |
|
||||
source trexio-venv/bin/activate
|
||||
make python-test
|
||||
|
||||
- name: build and move Python API distribution
|
||||
run: |
|
||||
source trexio-venv/bin/activate
|
||||
make python-sdist
|
||||
cp python/dist/trexio-*.tar.gz .
|
||||
|
||||
@ -94,7 +100,7 @@ jobs:
|
||||
if: >-
|
||||
contains(needs.get_commit_message.outputs.message, '[wheel build]') ||
|
||||
github.event_name == 'release'
|
||||
uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2
|
||||
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
|
||||
with:
|
||||
name: pytrexio-source
|
||||
path: ./trexio-*.tar.gz
|
||||
@ -105,7 +111,7 @@ jobs:
|
||||
- name: reconfigure with clang and AddressSanitizer
|
||||
run: |
|
||||
./autogen.sh
|
||||
./configure CC=clang-11 CFLAGS="-O2 -fsanitize=address -fno-omit-frame-pointer" LDFLAGS="-fsanitize=address" --enable-silent-rules
|
||||
./configure CC=clang-15 CFLAGS="-O2 -fsanitize=address -fno-omit-frame-pointer" LDFLAGS="-fsanitize=address" --enable-silent-rules
|
||||
|
||||
- name: recompile TREXIO
|
||||
run: make -j2
|
||||
@ -115,17 +121,21 @@ jobs:
|
||||
|
||||
- name: Archive test log file
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2
|
||||
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
|
||||
with:
|
||||
name: test-report-ubuntu-2
|
||||
name: test-report-ubuntu-memory
|
||||
path: test-suite.log
|
||||
|
||||
- name: maintainer clean
|
||||
run: make maintainer-clean
|
||||
|
||||
trexio_macos:
|
||||
name: x86 MacOS 12
|
||||
runs-on: macos-12
|
||||
name: x86 and arm64 MacOS
|
||||
strategy:
|
||||
# macos-13 = x86_64 ; macos-14 = aarch64
|
||||
matrix:
|
||||
os: [macos-13, macos-14]
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791
|
||||
@ -133,14 +143,16 @@ jobs:
|
||||
- name: install dependencies
|
||||
run: |
|
||||
brew install emacs
|
||||
brew install hdf5
|
||||
brew install hdf5@1.14
|
||||
brew install automake
|
||||
brew install libtool
|
||||
brew install swig
|
||||
brew --prefix hdf5
|
||||
|
||||
- name: configure with autotools
|
||||
run: |
|
||||
./autogen.sh
|
||||
./configure FC=gfortran-12 --enable-silent-rules
|
||||
./configure CC=gcc-12 FC=gfortran-12 --enable-silent-rules
|
||||
|
||||
- name: compile TREXIO
|
||||
run: make -j3
|
||||
@ -148,20 +160,28 @@ jobs:
|
||||
- name: check TREXIO
|
||||
run: make -j3 check
|
||||
|
||||
- name: create venv
|
||||
run: |
|
||||
python3 -m venv trexio-venv
|
||||
source trexio-venv/bin/activate
|
||||
|
||||
- name: compile Python API
|
||||
run: |
|
||||
export H5_CFLAGS="-I$(brew --prefix hdf5)/include"
|
||||
export H5_LDFLAGS="-L$(brew --prefix hdf5)/lib"
|
||||
source trexio-venv/bin/activate
|
||||
make python-install
|
||||
|
||||
- name: test Python API
|
||||
run: make python-test
|
||||
run: |
|
||||
source trexio-venv/bin/activate
|
||||
make python-test
|
||||
|
||||
- name: Archive test log file
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2
|
||||
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
|
||||
with:
|
||||
name: test-report-macos
|
||||
name: test-report-${{ matrix.os }}
|
||||
path: test-suite.log
|
||||
|
||||
- name: clean
|
||||
|
154
.github/workflows/build-wheels.yml
vendored
154
.github/workflows/build-wheels.yml
vendored
@ -16,12 +16,12 @@ jobs:
|
||||
get_commit_message:
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
name: Get commit message
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-22.04
|
||||
outputs:
|
||||
message: ${{ steps.commit_message.outputs.message }}
|
||||
steps:
|
||||
- name: Checkout the repo
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||
# Gets the correct commit message for pull request
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
@ -30,28 +30,125 @@ jobs:
|
||||
run: |
|
||||
set -xe
|
||||
COMMIT_MSG=$(git log --no-merges -1 --oneline)
|
||||
echo "::set-output name=message::$COMMIT_MSG"
|
||||
echo "message=$COMMIT_MSG" >> $GITHUB_OUTPUT
|
||||
echo github.ref ${{ github.ref }}
|
||||
|
||||
|
||||
build_linux_wheels:
|
||||
name: Build Linux wheels for different versions of CPython on manylinux_x86_64
|
||||
build_macos_wheels:
|
||||
name: build wheels for different versions of cpython on macos
|
||||
needs: get_commit_message
|
||||
if: >-
|
||||
contains(needs.get_commit_message.outputs.message, '[wheel build]') ||
|
||||
(github.repository == 'TREX-CoE/trexio' && startsWith(github.ref, 'refs/tags/v'))
|
||||
runs-on: ubuntu-20.04
|
||||
(github.repository == 'trex-coe/trexio' && startswith(github.ref, 'refs/tags/v'))
|
||||
runs-on: ${{ matrix.buildplat[0] }}
|
||||
env:
|
||||
HDF5_INSTALLDIR: "/Users/runner/work/trexio/trexio/hdf5"
|
||||
strategy:
|
||||
# Ensure that a wheel builder finishes even if another fails
|
||||
fail-fast: false
|
||||
matrix:
|
||||
# Github Actions doesn't support pairing matrix values together, let's improvise
|
||||
# https://github.com/github/feedback/discussions/7835#discussioncomment-1769026
|
||||
buildplat:
|
||||
- [macos-13, macosx_x86_64]
|
||||
- [macos-14, macosx_arm64]
|
||||
# test config
|
||||
python: ["cp38", "cp39", "cp310", "cp311", "cp312"]
|
||||
exclude:
|
||||
- buildplat: [macos-14, macosx_arm64]
|
||||
python: "cp38"
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@e2f20e631ae6d7dd3b768f56a5d2af784dd54791
|
||||
|
||||
- uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
|
||||
with:
|
||||
python-version: "3.x"
|
||||
|
||||
- name: install dependencies
|
||||
run: |
|
||||
brew install emacs
|
||||
brew install automake
|
||||
brew install libtool
|
||||
brew install swig
|
||||
|
||||
- uses: actions/cache@v3
|
||||
id: cache-hdf5
|
||||
with:
|
||||
path: $HDF5_INSTALLDIR
|
||||
key: ${{ matrix.buildplat[0] }}-hdf5
|
||||
|
||||
- name: install hdf5
|
||||
if: ${{ steps.cache-hdf5.outputs.cache-hit != 'true' }}
|
||||
run: |
|
||||
wget https://github.com/HDFGroup/hdf5/archive/refs/tags/hdf5-1_12_3.tar.gz
|
||||
tar -xzf hdf5-1_12_3.tar.gz
|
||||
cd hdf5-hdf5-1_12_3
|
||||
if [[ "$ARCH" == "arm64" ]]; then
|
||||
export MACOSX_DEPLOYMENT_TARGET="11.0"
|
||||
else
|
||||
export MACOSX_DEPLOYMENT_TARGET="10.9"
|
||||
fi
|
||||
./autogen.sh
|
||||
./configure CC=gcc-12 --prefix $HDF5_INSTALLDIR --enable-build-mode=production --with-szlib
|
||||
make -j3
|
||||
make install
|
||||
|
||||
- name: configure with autotools
|
||||
run: |
|
||||
./autogen.sh
|
||||
export PATH=${PATH}:${HDF5_INSTALLDIR}/bin
|
||||
./configure FC=gfortran-12 --enable-silent-rules
|
||||
make -j3
|
||||
|
||||
- name: prepare python
|
||||
run: |
|
||||
make python-install
|
||||
|
||||
- name: cleanup python
|
||||
run: |
|
||||
rm -rf src/ tools/
|
||||
mv python/* .
|
||||
|
||||
- name: Build wheels
|
||||
uses: pypa/cibuildwheel@bd033a44476646b606efccdd5eed92d5ea1d77ad # v2.20.0
|
||||
env:
|
||||
CIBW_PRERELEASE_PYTHONS: False
|
||||
CIBW_FREE_THREADED_SUPPORT: False
|
||||
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
|
||||
CIBW_BUILD_VERBOSITY: 1
|
||||
CIBW_BUILD_FRONTEND: "build"
|
||||
CIBW_ENVIRONMENT: H5_CFLAGS="-I/Users/runner/work/trexio/trexio/hdf5/include" H5_LDFLAGS="-L/Users/runner/work/trexio/trexio/hdf5/lib"
|
||||
# disable pytest-ing for now - does not work as expected via CIBW on MacOS --> Ask Anthony to test locally
|
||||
#CIBW_TEST_REQUIRES: pytest
|
||||
#CIBW_TEST_COMMAND: "python3 -m pytest -v test/test_api.py"
|
||||
|
||||
|
||||
- uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
|
||||
with:
|
||||
name: pytrexio-${{ matrix.python }}-${{ matrix.buildplat[1] }}-wheels
|
||||
path: ./wheelhouse/*.whl
|
||||
|
||||
|
||||
build_linux_wheels:
|
||||
name: build wheels for different versions of cpython on manylinux_x86_64
|
||||
needs: get_commit_message
|
||||
if: >-
|
||||
contains(needs.get_commit_message.outputs.message, '[wheel build]') ||
|
||||
(github.repository == 'trex-coe/trexio' && startswith(github.ref, 'refs/tags/v'))
|
||||
runs-on: ubuntu-22.04
|
||||
strategy:
|
||||
matrix:
|
||||
manylinux_tag: [2014_x86_64, 2_24_x86_64]
|
||||
manylinux_tag: [2014_x86_64, 2_28_x86_64]
|
||||
|
||||
steps:
|
||||
- name: Checkout the branch
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f
|
||||
with:
|
||||
python-version: '3.9'
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install build dependencies
|
||||
run: python -m pip install -U setuptools
|
||||
@ -89,31 +186,34 @@ jobs:
|
||||
working-directory: python
|
||||
|
||||
- name: Upload produced wheels as artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
|
||||
with:
|
||||
name: pytrexio-manylinux-${{ matrix.manylinux_tag }}
|
||||
name: pytrexio-manylinux-${{ matrix.manylinux_tag }}-wheels
|
||||
path: ./python/wheelhouse/*.whl
|
||||
|
||||
|
||||
publish_wheels:
|
||||
name: Publish all wheels on PyPI
|
||||
needs: [build_linux_wheels]
|
||||
runs-on: ubuntu-20.04
|
||||
needs: [build_linux_wheels, build_macos_wheels]
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
# IMPORTANT: this permission is mandatory for trusted publishing
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- name: Checkout the branch
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f
|
||||
with:
|
||||
python-version: '3.9'
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install build dependencies
|
||||
run: python -m pip install -U setuptools twine
|
||||
|
||||
- name: Download the build artifacts (wheels) of this workflow
|
||||
uses: actions/download-artifact@v2
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: dist
|
||||
|
||||
@ -130,20 +230,18 @@ jobs:
|
||||
- name: Display and rearrange the downloaded artifacts
|
||||
run: |
|
||||
ls -R
|
||||
mv pytrexio-manylinux-*/trexio-*.whl ./
|
||||
rm -rf -- pytrexio-manylinux-*/
|
||||
mv pytrexio-*-wheels/trexio-*.whl ./
|
||||
rm -rf -- pytrexio-*-wheels/
|
||||
ls -sh -w 1
|
||||
working-directory: dist
|
||||
|
||||
#- name: Publish distribution 📦 to Test PyPI
|
||||
# uses: pypa/gh-action-pypi-publish@master
|
||||
# uses: pypa/gh-action-pypi-publish@release/v1
|
||||
# with:
|
||||
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
|
||||
# repository_url: https://test.pypi.org/legacy/
|
||||
#verbose: true
|
||||
# verbose: true
|
||||
# ##verify-metadata: false
|
||||
|
||||
- name: Publish distribution 📦 to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@master
|
||||
with:
|
||||
password: ${{ secrets.PYPI_API_TOKEN }}
|
||||
#if: startsWith(github.ref, 'refs/tags')
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
##if: startsWith(github.ref, 'refs/tags')
|
||||
|
@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
# Initialize the CMake project.
|
||||
project(Trexio
|
||||
VERSION 2.5.0
|
||||
VERSION 2.5.1
|
||||
DESCRIPTION "TREX I/O library"
|
||||
LANGUAGES C Fortran
|
||||
)
|
||||
|
49
README.md
49
README.md
@ -15,31 +15,30 @@ which enables fast read and write operations. It is compatible with a variety
|
||||
of platforms and has interfaces for the Fortran, Python, OCaml and Rust
|
||||
programming languages.
|
||||
|
||||
* [TREXIO](#trexio)
|
||||
* [Installation](#installation)
|
||||
* [Installation using a package manager](#installation-using-a-package-manager)
|
||||
* [Conda](#conda)
|
||||
* [Spack](#spack)
|
||||
* [Guix](#guix)
|
||||
* [Debian/Ubuntu](#debianubuntu)
|
||||
* [Installation from source](#installation-from-source)
|
||||
* [Minimal requirements (for users):](#minimal-requirements-for-users)
|
||||
* [Recommended: Installation from the release tarball](#recommended-installation-from-the-release-tarball)
|
||||
* [Compilation without the HDF5 library](#compilation-without-the-hdf5-library)
|
||||
* [For TREXIO developers: from the GitHub repo clone](#for-trexio-developers-from-the-github-repo-clone)
|
||||
* [Using CMake instead of Autotools](#using-cmake-instead-of-autotools)
|
||||
* [Using TREXIO](#using-trexio)
|
||||
* [Naming convention](#naming-convention)
|
||||
* [Tutorial](#tutorial)
|
||||
* [Documentation](#documentation)
|
||||
* [Linking to your program](#linking-to-your-program)
|
||||
* [Distributing TREXIO with your code](#distributing-trexio-with-your-code)
|
||||
* [APIs for other languages](#apis-for-other-languages)
|
||||
* [Python](#python)
|
||||
* [Rust](#rust)
|
||||
* [OCaml](#ocaml)
|
||||
* [Citation](#citation)
|
||||
* [Miscellaneous](#miscellaneous)
|
||||
* [Installation](#installation)
|
||||
* [Installation using a package manager](#installation-using-a-package-manager)
|
||||
* [Conda](#conda)
|
||||
* [Spack](#spack)
|
||||
* [Guix](#guix)
|
||||
* [Debian/Ubuntu](#debianubuntu)
|
||||
* [Installation from source](#installation-from-source)
|
||||
* [Minimal requirements (for users):](#minimal-requirements-for-users)
|
||||
* [Recommended: Installation from the release tarball](#recommended-installation-from-the-release-tarball)
|
||||
* [Compilation without the HDF5 library](#compilation-without-the-hdf5-library)
|
||||
* [For TREXIO developers: from the GitHub repo clone](#for-trexio-developers-from-the-github-repo-clone)
|
||||
* [Using CMake instead of Autotools](#using-cmake-instead-of-autotools)
|
||||
* [Using TREXIO](#using-trexio)
|
||||
* [Naming convention](#naming-convention)
|
||||
* [Tutorial](#tutorial)
|
||||
* [Documentation](#documentation)
|
||||
* [Linking to your program](#linking-to-your-program)
|
||||
* [Distributing TREXIO with your code](#distributing-trexio-with-your-code)
|
||||
* [APIs for other languages](#apis-for-other-languages)
|
||||
* [Python](#python)
|
||||
* [Rust](#rust)
|
||||
* [OCaml](#ocaml)
|
||||
* [Citation](#citation)
|
||||
* [Miscellaneous](#miscellaneous)
|
||||
|
||||
|
||||
## Installation
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ([2.69])
|
||||
AC_INIT([trexio],[2.5.0],[https://github.com/TREX-CoE/trexio/issues])
|
||||
AC_INIT([trexio],[2.5.1],[https://github.com/TREX-CoE/trexio/issues])
|
||||
|
||||
AC_CONFIG_SRCDIR([Makefile.in])
|
||||
AC_CONFIG_HEADERS([include/config.h])
|
||||
|
@ -1,6 +1,6 @@
|
||||
# This file is generated by dune, edit dune-project instead
|
||||
opam-version: "2.0"
|
||||
version: "2.4.2"
|
||||
version: "2.5.1"
|
||||
synopsis: "Binding for the TREXIO Input/Output library"
|
||||
description:
|
||||
"TREXIO is a file format and library for storing wave functions and integrals for quantum chemistry."
|
||||
|
@ -11,8 +11,8 @@ can be used to convert data from one input/output file format into another.
|
||||
|
||||
## Requirements
|
||||
|
||||
- python3 (>= 3.6)
|
||||
- numpy (>= 1.17.3)
|
||||
- python3 (>= 3.8)
|
||||
- numpy (>= 1.17.3)
|
||||
|
||||
## Installation from PyPI
|
||||
|
||||
@ -27,10 +27,6 @@ However, it is good practice to first check for updates of the build-system pack
|
||||
**Note: we highly recommend to use virtual environments to avoid compatibility issues and to improve reproducibility.**
|
||||
For more details, see the corresponding part of the [Python documentation](https://docs.python.org/3/library/venv.html#creating-virtual-environments).
|
||||
|
||||
**Note: our build farm (GitHub Actions) does not support ARM64 architectures (including the Mac M1/M2 chips). Therefore, `pip install trexio` does not work on an ARM64-based machine. Thus, we recommend to install TREXIO from source on an ARM64-based machine. If one uses a Mac where HDF5 is installed with brew (i.e., `brew install hdf5`), a workaround is to execute the following 2 lines before doing `pip install trexio`:**
|
||||
|
||||
- `export H5_CFLAGS="-I$(brew --prefix hdf5)/include"`
|
||||
- `export H5_LDFLAGS="-L$(brew --prefix hdf5)/lib"`
|
||||
|
||||
## Additional requirements (for installation from source)
|
||||
|
||||
@ -50,6 +46,9 @@ For more details, see the corresponding part of the [Python documentation](https
|
||||
The following two steps can be skipped if HDF5 is properly configured for `pkg-config` (i.e. if executing `pkg-config --libs hdf5` returns a list of options).
|
||||
- `export H5_CFLAGS=-I/path/to/hdf5/include`
|
||||
- `export H5_LDFLAGS=-L/path/to/hdf5/lib`
|
||||
On MacOS where HDF5 is installed with homebrew (i.e. `brew install hdf5`), one can use the following:
|
||||
- `export H5_CFLAGS="-I$(brew --prefix hdf5)/include"`
|
||||
- `export H5_LDFLAGS="-L$(brew --prefix hdf5)/lib"`
|
||||
6. `pip install .` (this installs `trexio` in your environment)
|
||||
7. `cd test && python -m pytest -v test_api.py` (this executes several tests that verify the installation)
|
||||
|
||||
|
@ -46,22 +46,9 @@ function build_wheel_for_py()
|
||||
PYVERSION=${1}
|
||||
|
||||
# derive manylinux glibc tag from the PLAT env variable provided to docker run
|
||||
# this is needed to avoid building wheel for 2010_x86_64 with CPython 3.10
|
||||
# because NumPy does not have wheels for it
|
||||
MANYLINUX_TAG=${PLAT:9:4}
|
||||
if [[ ${PYVERSION} -eq 310 ]] && [[ ${MANYLINUX_TAG} -eq 2010 ]]; then
|
||||
echo "Skip build of the wheel for CPython 3.10 on manylinux2010_x86_64"
|
||||
return
|
||||
fi
|
||||
|
||||
# python versions <= 3.7 required additional "m" in the platform tag, e.g. cp37-cp37m
|
||||
if [[ ${PYVERSION} -eq 36 ]] || [[ ${PYVERSION} -eq 37 ]]; then
|
||||
PYM="m"
|
||||
else
|
||||
PYM=""
|
||||
fi
|
||||
|
||||
CPYTHON="cp${PYVERSION}-cp${PYVERSION}${PYM}"
|
||||
CPYTHON="cp${PYVERSION}-cp${PYVERSION}"
|
||||
|
||||
# create and activate a virtual environment based on CPython version ${PYVERSION}
|
||||
/opt/python/${CPYTHON}/bin/python3 -m venv --clear trexio-manylinux-py${PYVERSION}
|
||||
@ -103,7 +90,7 @@ function build_wheel_for_py()
|
||||
|
||||
|
||||
# build wheels for all versions of CPython in this container
|
||||
for CPYVERSION in 37 38 39 310
|
||||
for CPYVERSION in 38 39 310 311 312 313
|
||||
do
|
||||
build_wheel_for_py ${CPYVERSION}
|
||||
done
|
||||
|
@ -63,8 +63,9 @@ else
|
||||
export H5_CFLAGS=${H5_CFLAGS_LOCAL}
|
||||
fi
|
||||
|
||||
|
||||
# Install/upgrade packages required for the installation
|
||||
python3 -m pip install --upgrade setuptools build pip
|
||||
python3 -m pip install build
|
||||
python3 -m pip install -r requirements.txt
|
||||
python3 -m pip install pytest
|
||||
|
||||
|
@ -3,6 +3,6 @@ requires = [
|
||||
"setuptools>=42",
|
||||
"wheel",
|
||||
"pkgconfig",
|
||||
"oldest-supported-numpy"
|
||||
"numpy",
|
||||
]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
@ -1 +1 @@
|
||||
__version__ = "2.5.0"
|
||||
__version__ = "2.5.1"
|
||||
|
@ -1,4 +1,3 @@
|
||||
setuptools>=42
|
||||
pkgconfig
|
||||
numpy<1.27.0
|
||||
numpy>=1.17.3
|
||||
numpy
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "trexio"
|
||||
version = "2.5.0"
|
||||
version = "2.5.1"
|
||||
edition = "2021"
|
||||
license = "BSD-3-Clause"
|
||||
authors = ["Anthony Scemama <scemama@irsamc.ups-tlse.fr>", "Evgeny Posenitskiy"]
|
||||
|
295
src/numpy.i
295
src/numpy.i
@ -48,7 +48,7 @@
|
||||
|
||||
%fragment("NumPy_Backward_Compatibility", "header")
|
||||
{
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
%#if NPY_API_VERSION < NPY_1_7_API_VERSION
|
||||
%#define NPY_ARRAY_DEFAULT NPY_DEFAULT
|
||||
%#define NPY_ARRAY_FARRAY NPY_FARRAY
|
||||
%#define NPY_FORTRANORDER NPY_FORTRAN
|
||||
@ -69,7 +69,7 @@
|
||||
{
|
||||
/* Macros to extract array attributes.
|
||||
*/
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
%#if NPY_API_VERSION < NPY_1_7_API_VERSION
|
||||
%#define is_array(a) ((a) && PyArray_Check((PyArrayObject*)a))
|
||||
%#define array_type(a) (int)(PyArray_TYPE((PyArrayObject*)a))
|
||||
%#define array_numdims(a) (((PyArrayObject*)a)->nd)
|
||||
@ -114,17 +114,12 @@
|
||||
if (py_obj == NULL ) return "C NULL value";
|
||||
if (py_obj == Py_None ) return "Python None" ;
|
||||
if (PyCallable_Check(py_obj)) return "callable" ;
|
||||
if (PyString_Check( py_obj)) return "string" ;
|
||||
if (PyInt_Check( py_obj)) return "int" ;
|
||||
if (PyBytes_Check( py_obj)) return "string" ;
|
||||
if (PyLong_Check( py_obj)) return "int" ;
|
||||
if (PyFloat_Check( py_obj)) return "float" ;
|
||||
if (PyDict_Check( py_obj)) return "dict" ;
|
||||
if (PyList_Check( py_obj)) return "list" ;
|
||||
if (PyTuple_Check( py_obj)) return "tuple" ;
|
||||
%#if PY_MAJOR_VERSION < 3
|
||||
if (PyFile_Check( py_obj)) return "file" ;
|
||||
if (PyModule_Check( py_obj)) return "module" ;
|
||||
if (PyInstance_Check(py_obj)) return "instance" ;
|
||||
%#endif
|
||||
|
||||
return "unknown type";
|
||||
}
|
||||
@ -170,13 +165,11 @@
|
||||
return PyArray_EquivTypenums(actual_type, desired_type);
|
||||
}
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
void free_cap(PyObject * cap)
|
||||
void free_cap(PyObject * cap)
|
||||
{
|
||||
void* array = (void*) PyCapsule_GetPointer(cap,SWIGPY_CAPSULE_NAME);
|
||||
if (array != NULL) free(array);
|
||||
}
|
||||
%#endif
|
||||
|
||||
|
||||
}
|
||||
@ -298,7 +291,7 @@
|
||||
Py_INCREF(array_descr(ary));
|
||||
result = (PyArrayObject*) PyArray_FromArray(ary,
|
||||
array_descr(ary),
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
%#if NPY_API_VERSION < NPY_1_7_API_VERSION
|
||||
NPY_FORTRANORDER);
|
||||
%#else
|
||||
NPY_ARRAY_F_CONTIGUOUS);
|
||||
@ -529,7 +522,7 @@
|
||||
return success;
|
||||
}
|
||||
|
||||
/* Require the given PyArrayObject to to be Fortran ordered. If the
|
||||
/* Require the given PyArrayObject to be Fortran ordered. If the
|
||||
* the PyArrayObject is already Fortran ordered, do nothing. Else,
|
||||
* set the Fortran ordering flag and recompute the strides.
|
||||
*/
|
||||
@ -2007,7 +2000,7 @@
|
||||
(PyObject* array = NULL)
|
||||
{
|
||||
npy_intp dims[1];
|
||||
if (!PyInt_Check($input))
|
||||
if (!PyLong_Check($input))
|
||||
{
|
||||
const char* typestring = pytype_string($input);
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
@ -2015,7 +2008,8 @@
|
||||
typestring);
|
||||
SWIG_fail;
|
||||
}
|
||||
$2 = (DIM_TYPE) PyInt_AsLong($input);
|
||||
$2 = (DIM_TYPE) PyLong_AsSsize_t($input);
|
||||
if ($2 == -1 && PyErr_Occurred()) SWIG_fail;
|
||||
dims[0] = (npy_intp) $2;
|
||||
array = PyArray_SimpleNew(1, dims, DATA_TYPECODE);
|
||||
if (!array) SWIG_fail;
|
||||
@ -2035,7 +2029,7 @@
|
||||
(PyObject* array = NULL)
|
||||
{
|
||||
npy_intp dims[1];
|
||||
if (!PyInt_Check($input))
|
||||
if (!PyLong_Check($input))
|
||||
{
|
||||
const char* typestring = pytype_string($input);
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
@ -2043,7 +2037,8 @@
|
||||
typestring);
|
||||
SWIG_fail;
|
||||
}
|
||||
$1 = (DIM_TYPE) PyInt_AsLong($input);
|
||||
$1 = (DIM_TYPE) PyLong_AsSsize_t($input);
|
||||
if ($1 == -1 && PyErr_Occurred()) SWIG_fail;
|
||||
dims[0] = (npy_intp) $1;
|
||||
array = PyArray_SimpleNew(1, dims, DATA_TYPECODE);
|
||||
if (!array) SWIG_fail;
|
||||
@ -2462,13 +2457,9 @@
|
||||
|
||||
if (!array) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
%#if NPY_API_VERSION < NPY_1_7_API_VERSION
|
||||
PyArray_BASE(array) = cap;
|
||||
%#else
|
||||
PyArray_SetBaseObject(array,cap);
|
||||
@ -2496,13 +2487,9 @@
|
||||
|
||||
if (!array) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
PyObject* cap = PyCapsule_New((void*)(*$2), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
%#if NPY_API_VERSION < NPY_1_7_API_VERSION
|
||||
PyArray_BASE(array) = cap;
|
||||
%#else
|
||||
PyArray_SetBaseObject(array,cap);
|
||||
@ -2531,13 +2518,9 @@
|
||||
|
||||
if (!array) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
%#if NPY_API_VERSION < NPY_1_7_API_VERSION
|
||||
PyArray_BASE(array) = cap;
|
||||
%#else
|
||||
PyArray_SetBaseObject(array,cap);
|
||||
@ -2566,13 +2549,9 @@
|
||||
|
||||
if (!array) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
PyObject* cap = PyCapsule_New((void*)(*$3), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
%#if NPY_API_VERSION < NPY_1_7_API_VERSION
|
||||
PyArray_BASE(array) = cap;
|
||||
%#else
|
||||
PyArray_SetBaseObject(array,cap);
|
||||
@ -2601,13 +2580,9 @@
|
||||
|
||||
if (!array || !require_fortran(array)) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
%#if NPY_API_VERSION < NPY_1_7_API_VERSION
|
||||
PyArray_BASE(array) = cap;
|
||||
%#else
|
||||
PyArray_SetBaseObject(array,cap);
|
||||
@ -2636,13 +2611,9 @@
|
||||
|
||||
if (!array || !require_fortran(array)) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
PyObject* cap = PyCapsule_New((void*)(*$3), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
%#if NPY_API_VERSION < NPY_1_7_API_VERSION
|
||||
PyArray_BASE(array) = cap;
|
||||
%#else
|
||||
PyArray_SetBaseObject(array,cap);
|
||||
@ -2673,13 +2644,9 @@
|
||||
|
||||
if (!array) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
%#if NPY_API_VERSION < NPY_1_7_API_VERSION
|
||||
PyArray_BASE(array) = cap;
|
||||
%#else
|
||||
PyArray_SetBaseObject(array,cap);
|
||||
@ -2710,13 +2677,9 @@
|
||||
|
||||
if (!array) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
PyObject* cap = PyCapsule_New((void*)(*$4), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
%#if NPY_API_VERSION < NPY_1_7_API_VERSION
|
||||
PyArray_BASE(array) = cap;
|
||||
%#else
|
||||
PyArray_SetBaseObject(array,cap);
|
||||
@ -2747,13 +2710,9 @@
|
||||
|
||||
if (!array || !require_fortran(array)) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
%#if NPY_API_VERSION < NPY_1_7_API_VERSION
|
||||
PyArray_BASE(array) = cap;
|
||||
%#else
|
||||
PyArray_SetBaseObject(array,cap);
|
||||
@ -2784,13 +2743,9 @@
|
||||
|
||||
if (!array || !require_fortran(array)) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
PyObject* cap = PyCapsule_New((void*)(*$4), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
%#if NPY_API_VERSION < NPY_1_7_API_VERSION
|
||||
PyArray_BASE(array) = cap;
|
||||
%#else
|
||||
PyArray_SetBaseObject(array,cap);
|
||||
@ -2822,13 +2777,9 @@
|
||||
|
||||
if (!array) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
%#if NPY_API_VERSION < NPY_1_7_API_VERSION
|
||||
PyArray_BASE(array) = cap;
|
||||
%#else
|
||||
PyArray_SetBaseObject(array,cap);
|
||||
@ -2860,165 +2811,9 @@
|
||||
|
||||
if (!array) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
PyObject* cap = PyCapsule_New((void*)(*$5), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
PyArray_BASE(array) = cap;
|
||||
%#else
|
||||
PyArray_SetBaseObject(array,cap);
|
||||
%#endif
|
||||
|
||||
$result = SWIG_Python_AppendOutput($result,obj);
|
||||
}
|
||||
|
||||
/* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2,
|
||||
DIM_TYPE* DIM3, DIM_TYPE* DIM4)
|
||||
*/
|
||||
%typemap(in,numinputs=0)
|
||||
(DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 )
|
||||
(DATA_TYPE* data_temp = NULL , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp)
|
||||
{
|
||||
$1 = &data_temp;
|
||||
$2 = &dim1_temp;
|
||||
$3 = &dim2_temp;
|
||||
$4 = &dim3_temp;
|
||||
$5 = &dim4_temp;
|
||||
}
|
||||
%typemap(argout,
|
||||
fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements,NumPy_Utilities")
|
||||
(DATA_TYPE** ARGOUTVIEWM_FARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3)
|
||||
{
|
||||
npy_intp dims[4] = { *$2, *$3, *$4 , *$5 };
|
||||
PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$1));
|
||||
PyArrayObject* array = (PyArrayObject*) obj;
|
||||
|
||||
if (!array || !require_fortran(array)) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
PyArray_BASE(array) = cap;
|
||||
%#else
|
||||
PyArray_SetBaseObject(array,cap);
|
||||
%#endif
|
||||
|
||||
$result = SWIG_Python_AppendOutput($result,obj);
|
||||
}
|
||||
|
||||
/* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4,
|
||||
DATA_TYPE** ARGOUTVIEWM_FARRAY4)
|
||||
*/
|
||||
%typemap(in,numinputs=0)
|
||||
(DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 , DATA_TYPE** ARGOUTVIEWM_FARRAY4)
|
||||
(DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp, DATA_TYPE* data_temp = NULL )
|
||||
{
|
||||
$1 = &dim1_temp;
|
||||
$2 = &dim2_temp;
|
||||
$3 = &dim3_temp;
|
||||
$4 = &dim4_temp;
|
||||
$5 = &data_temp;
|
||||
}
|
||||
%typemap(argout,
|
||||
fragment="NumPy_Backward_Compatibility,NumPy_Array_Requirements,NumPy_Utilities")
|
||||
(DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEWM_FARRAY4)
|
||||
{
|
||||
npy_intp dims[4] = { *$1, *$2, *$3 , *$4 };
|
||||
PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$5));
|
||||
PyArrayObject* array = (PyArrayObject*) obj;
|
||||
|
||||
if (!array || !require_fortran(array)) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
PyArray_BASE(array) = cap;
|
||||
%#else
|
||||
PyArray_SetBaseObject(array,cap);
|
||||
%#endif
|
||||
|
||||
$result = SWIG_Python_AppendOutput($result,obj);
|
||||
}
|
||||
|
||||
/* Typemap suite for (DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2,
|
||||
DIM_TYPE* DIM3, DIM_TYPE* DIM4)
|
||||
*/
|
||||
%typemap(in,numinputs=0)
|
||||
(DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 )
|
||||
(DATA_TYPE* data_temp = NULL , DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp)
|
||||
{
|
||||
$1 = &data_temp;
|
||||
$2 = &dim1_temp;
|
||||
$3 = &dim2_temp;
|
||||
$4 = &dim3_temp;
|
||||
$5 = &dim4_temp;
|
||||
}
|
||||
%typemap(argout,
|
||||
fragment="NumPy_Backward_Compatibility,NumPy_Utilities")
|
||||
(DATA_TYPE** ARGOUTVIEWM_ARRAY4, DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4)
|
||||
{
|
||||
npy_intp dims[4] = { *$2, *$3, *$4 , *$5 };
|
||||
PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$1));
|
||||
PyArrayObject* array = (PyArrayObject*) obj;
|
||||
|
||||
if (!array) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
PyArray_BASE(array) = cap;
|
||||
%#else
|
||||
PyArray_SetBaseObject(array,cap);
|
||||
%#endif
|
||||
|
||||
$result = SWIG_Python_AppendOutput($result,obj);
|
||||
}
|
||||
|
||||
/* Typemap suite for (DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4,
|
||||
DATA_TYPE** ARGOUTVIEWM_ARRAY4)
|
||||
*/
|
||||
%typemap(in,numinputs=0)
|
||||
(DIM_TYPE* DIM1 , DIM_TYPE* DIM2 , DIM_TYPE* DIM3 , DIM_TYPE* DIM4 , DATA_TYPE** ARGOUTVIEWM_ARRAY4)
|
||||
(DIM_TYPE dim1_temp, DIM_TYPE dim2_temp, DIM_TYPE dim3_temp, DIM_TYPE dim4_temp, DATA_TYPE* data_temp = NULL )
|
||||
{
|
||||
$1 = &dim1_temp;
|
||||
$2 = &dim2_temp;
|
||||
$3 = &dim3_temp;
|
||||
$4 = &dim4_temp;
|
||||
$5 = &data_temp;
|
||||
}
|
||||
%typemap(argout,
|
||||
fragment="NumPy_Backward_Compatibility,NumPy_Utilities")
|
||||
(DIM_TYPE* DIM1, DIM_TYPE* DIM2, DIM_TYPE* DIM3, DIM_TYPE* DIM4, DATA_TYPE** ARGOUTVIEWM_ARRAY4)
|
||||
{
|
||||
npy_intp dims[4] = { *$1, *$2, *$3 , *$4 };
|
||||
PyObject* obj = PyArray_SimpleNewFromData(4, dims, DATA_TYPECODE, (void*)(*$5));
|
||||
PyArrayObject* array = (PyArrayObject*) obj;
|
||||
|
||||
if (!array) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
%#if NPY_API_VERSION < NPY_1_7_API_VERSION
|
||||
PyArray_BASE(array) = cap;
|
||||
%#else
|
||||
PyArray_SetBaseObject(array,cap);
|
||||
@ -3050,13 +2845,9 @@
|
||||
|
||||
if (!array || !require_fortran(array)) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
%#if NPY_API_VERSION < NPY_1_7_API_VERSION
|
||||
PyArray_BASE(array) = cap;
|
||||
%#else
|
||||
PyArray_SetBaseObject(array,cap);
|
||||
@ -3088,13 +2879,9 @@
|
||||
|
||||
if (!array || !require_fortran(array)) SWIG_fail;
|
||||
|
||||
%#ifdef SWIGPY_USE_CAPSULE
|
||||
PyObject* cap = PyCapsule_New((void*)(*$1), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
%#else
|
||||
PyObject* cap = PyCObject_FromVoidPtr((void*)(*$1), free);
|
||||
%#endif
|
||||
PyObject* cap = PyCapsule_New((void*)(*$5), SWIGPY_CAPSULE_NAME, free_cap);
|
||||
|
||||
%#if NPY_API_VERSION < 0x00000007
|
||||
%#if NPY_API_VERSION < NPY_1_7_API_VERSION
|
||||
PyArray_BASE(array) = cap;
|
||||
%#else
|
||||
PyArray_SetBaseObject(array,cap);
|
||||
|
@ -11,7 +11,11 @@ fi
|
||||
|
||||
DO_HDF5=0
|
||||
if [[ -z ${1} ]] && [[ "${1}" == "--without-hdf5" ]] ; then
|
||||
echo "Compiling Python API without the HDF5 back end."
|
||||
echo ""
|
||||
echo "******************** WARNING **********************"
|
||||
echo "* Compiling Python API without the HDF5 back end. *"
|
||||
echo "***************************************************"
|
||||
echo ""
|
||||
DO_HDF5=1
|
||||
else
|
||||
echo "Compiling Python API with the HDF5 back end."
|
||||
|
Loading…
Reference in New Issue
Block a user