Skip to content

Commit

Permalink
Merge branch 'davidcaron:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
willsanddrew committed Apr 11, 2024
2 parents fda9bf3 + 4138384 commit f97515f
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 57 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -39,7 +39,7 @@ jobs:
runs-on: windows-2019
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
submodules: recursive

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.3.1
run: python -m pip install cibuildwheel

- name: Build wheels (Ubuntu)
if: matrix.os == 'ubuntu-latest'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -2,7 +2,7 @@

[![PyPI](https://img.shields.io/pypi/v/pye57.svg)](https://pypi.org/project/pye57)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pye57.svg)](https://pypi.org/project/pye57)
![GitHub](https://img.shields.io/github/workflow/status/davidcaron/pye57/build)
![GitHub](https://img.shields.io/github/actions/workflow/status/davidcaron/pye57/build.yml?branch=master)

Python wrapper of [LibE57Format](https://github.com/asmaloney/libE57Format) to read and write .e57 point cloud files

Expand Down
2 changes: 1 addition & 1 deletion libE57Format
Submodule libE57Format updated 114 files
1 change: 0 additions & 1 deletion pyproject.toml
Expand Up @@ -15,5 +15,4 @@ build-backend = "setuptools.build_meta"
# before-all = "powershell scripts/install_xerces_c.ps1"
test-requires = "pytest"
build = "cp*-manylinux_x86_64 cp*-win_amd64*"
skip = "cp36*"
test-command = "python -m pytest {project}/tests"
7 changes: 4 additions & 3 deletions setup.py
Expand Up @@ -107,21 +107,22 @@ def build_extensions(self):
ext_modules=ext_modules,
packages=["pye57"],
package_dir={"": "src"},
include_package_data=True,
# include_package_data=True,
package_data={"pye57": package_data},
extras_require={"test": "pytest"},
license="MIT",
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
],
cmdclass={"build_ext": BuildExt},
zip_safe=False,
python_requires=">=3.7",
python_requires=">=3.8",
)
2 changes: 1 addition & 1 deletion src/pye57/__version__.py
@@ -1 +1 @@
__version__ = "0.4.1"
__version__ = "0.4.4"
89 changes: 47 additions & 42 deletions src/pye57/libe57_wrapper.cpp
Expand Up @@ -6,6 +6,7 @@
#include <E57Exception.h>
#include <E57Format.h>
#include <E57Version.h>
#include <ASTMVersion.h>

namespace py = pybind11;
using namespace pybind11::literals;
Expand Down Expand Up @@ -54,26 +55,27 @@ PYBIND11_MODULE(libe57, m) {
m.attr("CHECKSUM_POLICY_SPARSE") = CHECKSUM_POLICY_SPARSE;
m.attr("CHECKSUM_POLICY_HALF") = CHECKSUM_POLICY_HALF;
m.attr("CHECKSUM_POLICY_ALL") = CHECKSUM_POLICY_ALL;
m.attr("E57_INT8_MIN") = E57_INT8_MIN;
m.attr("E57_INT8_MAX") = E57_INT8_MAX;
m.attr("E57_INT16_MIN") = E57_INT16_MIN;
m.attr("E57_INT16_MAX") = E57_INT16_MAX;
m.attr("E57_INT32_MIN") = E57_INT32_MIN;
m.attr("E57_INT32_MAX") = E57_INT32_MAX;
m.attr("E57_INT64_MIN") = E57_INT64_MIN;
m.attr("E57_INT64_MAX") = E57_INT64_MAX;
m.attr("E57_UINT8_MIN") = E57_UINT8_MIN;
m.attr("E57_UINT8_MAX") = E57_UINT8_MAX;
m.attr("E57_UINT16_MIN") = E57_UINT16_MIN;
m.attr("E57_UINT16_MAX") = E57_UINT16_MAX;
m.attr("E57_UINT32_MIN") = E57_UINT32_MIN;
m.attr("E57_UINT32_MAX") = E57_UINT32_MAX;
m.attr("E57_UINT64_MIN") = E57_UINT64_MIN;
m.attr("E57_UINT64_MAX") = E57_UINT64_MAX;
m.attr("E57_FLOAT_MIN") = E57_FLOAT_MIN;
m.attr("E57_FLOAT_MAX") = E57_FLOAT_MAX;
m.attr("E57_DOUBLE_MIN") = E57_DOUBLE_MIN;
m.attr("E57_DOUBLE_MAX") = E57_DOUBLE_MAX;
m.attr("E57_INT8_MIN") = INT8_MIN;
// for some reason INT8_MAX casts to a string not to an int !
m.attr("E57_INT8_MAX") = 127;
m.attr("E57_INT16_MIN") = INT16_MIN;
m.attr("E57_INT16_MAX") = INT16_MAX;
m.attr("E57_INT32_MIN") = INT32_MIN;
m.attr("E57_INT32_MAX") = INT32_MAX;
m.attr("E57_INT64_MIN") = INT64_MIN;
m.attr("E57_INT64_MAX") = INT64_MAX;
m.attr("E57_UINT8_MIN") = UINT8_MIN;
m.attr("E57_UINT8_MAX") = UINT8_MAX;
m.attr("E57_UINT16_MIN") = UINT16_MIN;
m.attr("E57_UINT16_MAX") = UINT16_MAX;
m.attr("E57_UINT32_MIN") = UINT32_MIN;
m.attr("E57_UINT32_MAX") = UINT32_MAX;
m.attr("E57_UINT64_MIN") = UINT64_MIN;
m.attr("E57_UINT64_MAX") = UINT64_MAX;
m.attr("E57_FLOAT_MIN") = FLOAT_MIN;
m.attr("E57_FLOAT_MAX") = FLOAT_MAX;
m.attr("E57_DOUBLE_MIN") = DOUBLE_MIN;
m.attr("E57_DOUBLE_MAX") = DOUBLE_MAX;
py::enum_<NodeType>(m, "NodeType")
.value("E57_STRUCTURE", NodeType::E57_STRUCTURE)
.value("E57_VECTOR", NodeType::E57_VECTOR)
Expand Down Expand Up @@ -357,7 +359,7 @@ PYBIND11_MODULE(libe57, m) {
});

py::class_<IntegerNode> cls_IntegerNode(m, "IntegerNode");
cls_IntegerNode.def(py::init<e57::ImageFile, int64_t, int64_t, int64_t>(), "destImageFile"_a, "value"_a=0, "minimum"_a=E57_INT64_MIN, "maximum"_a=E57_INT64_MAX);
cls_IntegerNode.def(py::init<e57::ImageFile, int64_t, int64_t, int64_t>(), "destImageFile"_a, "value"_a=0, "minimum"_a=INT64_MIN, "maximum"_a=INT64_MAX);
cls_IntegerNode.def("value", &IntegerNode::value);
cls_IntegerNode.def("minimum", &IntegerNode::minimum);
cls_IntegerNode.def("maximum", &IntegerNode::maximum);
Expand Down Expand Up @@ -399,7 +401,7 @@ PYBIND11_MODULE(libe57, m) {
});

py::class_<FloatNode> cls_FloatNode(m, "FloatNode");
cls_FloatNode.def(py::init<e57::ImageFile, double, FloatPrecision, double, double>(), "destImageFile"_a, "value"_a=0.0, "precision"_a=E57_DOUBLE, "minimum"_a=E57_DOUBLE_MIN, "maximum"_a=E57_DOUBLE_MAX);
cls_FloatNode.def(py::init<e57::ImageFile, double, FloatPrecision, double, double>(), "destImageFile"_a, "value"_a=0.0, "precision"_a=E57_DOUBLE, "minimum"_a=-DBL_MAX, "maximum"_a=DBL_MAX);
cls_FloatNode.def("value", &FloatNode::value);
cls_FloatNode.def("precision", &FloatNode::precision);
cls_FloatNode.def("minimum", &FloatNode::minimum);
Expand Down Expand Up @@ -486,26 +488,29 @@ PYBIND11_MODULE(libe57, m) {
return arr;
});

py::class_<ImageFile> cls_ImageFile(m, "ImageFile");
cls_ImageFile.def(py::init<const std::string &, const std::string &, int>(), "fname"_a, "mode"_a, "checksumPolicy"_a=CHECKSUM_POLICY_ALL);
cls_ImageFile.def("root", &ImageFile::root);
cls_ImageFile.def("close", &ImageFile::close);
cls_ImageFile.def("cancel", &ImageFile::cancel);
cls_ImageFile.def("isOpen", &ImageFile::isOpen);
cls_ImageFile.def("isWritable", &ImageFile::isWritable);
cls_ImageFile.def("fileName", &ImageFile::fileName);
cls_ImageFile.def("writerCount", &ImageFile::writerCount);
cls_ImageFile.def("readerCount", &ImageFile::readerCount);
cls_ImageFile.def("extensionsAdd", &ImageFile::extensionsAdd, "prefix"_a, "uri"_a);
cls_ImageFile.def("extensionsLookupPrefix", &ImageFile::extensionsLookupPrefix, "prefix"_a, "uri"_a);
cls_ImageFile.def("extensionsLookupUri", &ImageFile::extensionsLookupUri, "uri"_a, "prefix"_a);
cls_ImageFile.def("extensionsCount", &ImageFile::extensionsCount);
cls_ImageFile.def("extensionsPrefix", &ImageFile::extensionsPrefix, "index"_a);
cls_ImageFile.def("extensionsUri", &ImageFile::extensionsUri, "index"_a);
cls_ImageFile.def("isElementNameExtended", &ImageFile::isElementNameExtended, "elementName"_a);
cls_ImageFile.def("elementNameParse", &ImageFile::elementNameParse, "elementName"_a, "prefix"_a, "localPart"_a);
cls_ImageFile.def("checkInvariant", &ImageFile::checkInvariant, "doRecurse"_a=true);
cls_ImageFile.def("__repr__", [](const ImageFile &im) {
py::class_<ImageFile> (m, "ImageFile")
.def(py::init<const std::string &, const std::string &, int>(), "fname"_a, "mode"_a, "checksumPolicy"_a=CHECKSUM_POLICY_ALL)
.def("root", &ImageFile::root)
.def("close", &ImageFile::close)
.def("cancel", &ImageFile::cancel)
.def("isOpen", &ImageFile::isOpen)
.def("isWritable", &ImageFile::isWritable)
.def("fileName", &ImageFile::fileName)
.def("writerCount", &ImageFile::writerCount)
.def("readerCount", &ImageFile::readerCount)
.def("extensionsAdd", &ImageFile::extensionsAdd, "prefix"_a, "uri"_a)
// I couldn't wrap the overloaded function so I call it directly
.def("extensionsLookupPrefix", [](const ImageFile &im, std::string &prefix, std::string &uri) {
return im.extensionsLookupPrefix(prefix, uri);
}, "prefix"_a, "uri"_a)
.def("extensionsLookupUri", &ImageFile::extensionsLookupUri, "uri"_a, "prefix"_a)
.def("extensionsCount", &ImageFile::extensionsCount)
.def("extensionsPrefix", &ImageFile::extensionsPrefix, "index"_a)
.def("extensionsUri", &ImageFile::extensionsUri, "index"_a)
.def("isElementNameExtended", &ImageFile::isElementNameExtended, "elementName"_a)
.def("elementNameParse", &ImageFile::elementNameParse, "elementName"_a, "prefix"_a, "localPart"_a)
.def("checkInvariant", &ImageFile::checkInvariant, "doRecurse"_a=true)
.def("__repr__", [](const ImageFile &im) {
return "<ImageFile '" + im.fileName() + "'>";
});

Expand Down
9 changes: 4 additions & 5 deletions tests/test_main.py
Expand Up @@ -6,7 +6,6 @@

import pye57
from pye57 import libe57
from pye57.utils import get_fields

try:
from exceptions import WindowsError
Expand All @@ -19,7 +18,7 @@ def test_hi():
assert libe57.__doc__


def test_data(*args):
def sample_data(*args):
here = os.path.split(__file__)[0]
return os.path.join(here, "test_data", *args)

Expand All @@ -36,15 +35,15 @@ def delete_retry(path):

@pytest.fixture
def e57_path():
return test_data("test.e57")
return sample_data("test.e57")

@pytest.fixture
def e57_spherical_path():
return test_data("testSpherical.e57")
return sample_data("testSpherical.e57")

@pytest.fixture
def temp_e57_write(request):
path = test_data("test_write.e57")
path = sample_data("test_write.e57")
request.addfinalizer(lambda: delete_retry(path))
return path

Expand Down

0 comments on commit f97515f

Please sign in to comment.