From b76f1427629f4241389652d542e1eeca45716d47 Mon Sep 17 00:00:00 2001 From: Joachim Metz Date: Sat, 28 Oct 2023 08:33:18 +0200 Subject: [PATCH] Applied updates and changes for deployment --- .github/workflows/build_wheel.yml | 42 ++++++++ .gitignore | 6 +- Makefile.am | 43 +++----- appveyor.yml | 15 ++- common/Makefile.am | 6 +- configure.ac | 2 + documents/Makefile.am | 2 +- ewf.net/Makefile.am | 2 +- ewftools-mt/Makefile.am | 4 +- ewftools/Makefile.am | 4 +- examples/Makefile.am | 2 +- include/Makefile.am | 10 +- libewf-legacy.ini | 2 +- libewf/Makefile.am | 10 +- libmfdata/Makefile.am | 4 +- m4/libcrypto.m4 | 6 +- m4/python.m4 | 10 +- manuals/Makefile.am | 2 +- msvscpp/Makefile.am | 2 +- po/Makevars.in | 3 + pyewf-python2/Makefile.am | 4 +- pyewf-python3/Makefile.am | 4 +- pyewf/Makefile.am | 2 +- pyproject.toml | 4 + setup.cfg | 2 - setup.cfg.in | 15 +++ setup.py | 158 ++++++++---------------------- synclibs.sh | 6 +- tests/Makefile.am | 2 +- tests/runtests.py | 77 +++++++++++++++ tests/test_library.sh | 81 ++++++++------- tests/test_manpage.sh | 4 +- tests/test_runner.sh | 154 +++-------------------------- tox.ini | 21 ++-- 34 files changed, 329 insertions(+), 382 deletions(-) create mode 100644 .github/workflows/build_wheel.yml create mode 100644 pyproject.toml delete mode 100644 setup.cfg create mode 100644 setup.cfg.in create mode 100755 tests/runtests.py diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml new file mode 100644 index 0000000..15c13bf --- /dev/null +++ b/.github/workflows/build_wheel.yml @@ -0,0 +1,42 @@ +# Build wheel from source using tox. +name: build_wheel +on: [push, pull_request] +permissions: read-all +jobs: + build_wheel: + runs-on: ubuntu-22.04 + strategy: + matrix: + include: + - python-version: '3.7' + toxenv: 'py37' + - python-version: '3.8' + toxenv: 'py38' + - python-version: '3.9' + toxenv: 'py39' + - python-version: '3.10' + toxenv: 'py310' + - python-version: '3.11' + toxenv: 'py311' + - python-version: '3.12' + toxenv: 'py312' + steps: + - uses: actions/checkout@v3 + - name: Install build dependencies + run: | + sudo add-apt-repository universe && + sudo add-apt-repository -y ppa:deadsnakes/ppa && + sudo apt-get update && + sudo apt-get install -y autoconf automake autopoint build-essential git libtool pkg-config python${{ matrix.python-version }} python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-venv python3-distutils python3-pip python3-setuptools + - name: Install tox + run: | + python3 -m pip install tox + - name: Download test data + run: | + if test -x "synctestdata.sh"; then ./synctestdata.sh; fi + - name: Prepare build + run: | + ./synclibs.sh --use-head && ./autogen.sh && ./configure && make sources >/dev/null + - name: Build Python wheel + run: | + tox -e${{ matrix.toxenv }} diff --git a/.gitignore b/.gitignore index 832da0c..23d8a0e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ # Files to ignore by git # -# Version: 20230405 +# Version: 20230926 # Generic auto-generated build files *~ @@ -25,10 +25,13 @@ *.swp *.Tpo *.trs +*.whl /*.egg-info/ +__pycache__ .deps .dirstamp .libs +.tox INSTALL Makefile Makefile.bcc @@ -125,6 +128,7 @@ stamp-h[1-9] /libewf/libewf.rc /libewf/libewf_definitions.h /pyewf-python[23]/*.[ch] +/setup.cfg /ewf.net/ewf.net.rc /ewftools/*.exe /ewftools/ewfacquire diff --git a/Makefile.am b/Makefile.am index ac37768..443d131 100644 --- a/Makefile.am +++ b/Makefile.am @@ -56,6 +56,9 @@ PKGCONFIG_FILES = \ libewf.pc.in SETUP_PY_FILES = \ + pyproject.toml \ + setup.cfg \ + setup.cfg.in \ setup.py SPEC_FILES = \ @@ -102,40 +105,16 @@ library: (cd $(srcdir)/po && $(MAKE) $(AM_MAKEFLAGS)) distclean: clean - /bin/rm -f Makefile - /bin/rm -f config.status - /bin/rm -f config.cache - /bin/rm -f config.log - /bin/rm -f libewf.pc - /bin/rm -f libewf.spec - /bin/rm -f dpkg/changelog - /bin/rm -f dpkg/shlibs.local.ex + -rm -f Makefile + -rm -f config.status + -rm -f config.cache + -rm -f config.log + -rm -f libewf.pc + -rm -f libewf.spec + -rm -f dpkg/changelog + -rm -f dpkg/shlibs.local.ex @for dir in ${subdirs}; do \ (cd $$dir && $(MAKE) distclean) \ || case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" -splint: - (cd $(srcdir)/libcerror && $(MAKE) splint $(AM_MAKEFLAGS)) - (cd $(srcdir)/libcdata && $(MAKE) splint $(AM_MAKEFLAGS)) - (cd $(srcdir)/libcdatetime && $(MAKE) splint $(AM_MAKEFLAGS)) - (cd $(srcdir)/libclocale && $(MAKE) splint $(AM_MAKEFLAGS)) - (cd $(srcdir)/libcnotify && $(MAKE) splint $(AM_MAKEFLAGS)) - (cd $(srcdir)/libcsplit && $(MAKE) splint $(AM_MAKEFLAGS)) - (cd $(srcdir)/libuna && $(MAKE) splint $(AM_MAKEFLAGS)) - (cd $(srcdir)/libcfile && $(MAKE) splint $(AM_MAKEFLAGS)) - (cd $(srcdir)/libcpath && $(MAKE) splint $(AM_MAKEFLAGS)) - (cd $(srcdir)/libbfio && $(MAKE) splint $(AM_MAKEFLAGS)) - (cd $(srcdir)/libfcache && $(MAKE) splint $(AM_MAKEFLAGS)) - (cd $(srcdir)/libfdata && $(MAKE) splint $(AM_MAKEFLAGS)) - (cd $(srcdir)/libfvalue && $(MAKE) splint $(AM_MAKEFLAGS)) - (cd $(srcdir)/libmfdata && $(MAKE) splint $(AM_MAKEFLAGS)) - (cd $(srcdir)/libhmac && $(MAKE) splint $(AM_MAKEFLAGS)) - (cd $(srcdir)/libewf && $(MAKE) splint $(AM_MAKEFLAGS)) - (cd $(srcdir)/libodraw && $(MAKE) splint $(AM_MAKEFLAGS)) - (cd $(srcdir)/libsmdev && $(MAKE) splint $(AM_MAKEFLAGS)) - (cd $(srcdir)/libsmraw && $(MAKE) splint $(AM_MAKEFLAGS)) - (cd $(srcdir)/ewftools && $(MAKE) splint $(AM_MAKEFLAGS)) - (cd $(srcdir)/po && $(MAKE) $(AM_MAKEFLAGS)) - (cd $(srcdir)/tests && $(MAKE) splint $(AM_MAKEFLAGS)) - diff --git a/appveyor.yml b/appveyor.yml index 474307a..95e65e6 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -90,11 +90,16 @@ environment: APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey HOMEBREW_NO_INSTALL_CLEANUP: 1 CC: clang + CFLAGS: "-I/usr/local/include" + LDFLAGS: "-L/usr/local/lib" CONFIGURE_OPTIONS: "" - TARGET: macos-x64-gcc BUILD_ENVIRONMENT: xcode APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey HOMEBREW_NO_INSTALL_CLEANUP: 1 + CC: gcc + CFLAGS: "-I/usr/local/include" + LDFLAGS: "-L/usr/local/lib" CONFIGURE_OPTIONS: "" - TARGET: macos-x64-gcc-python BUILD_ENVIRONMENT: xcode @@ -102,6 +107,7 @@ environment: PYTHON: "/usr/local/opt/python@3.11/bin/python3" PYTHON_CONFIG: "/usr/local/opt/python@3.11/bin/python3-config" HOMEBREW_NO_INSTALL_CLEANUP: 1 + CC: gcc CFLAGS: "-I/usr/local/include" LDFLAGS: "-L/usr/local/lib" CONFIGURE_OPTIONS: "--enable-python" @@ -111,6 +117,7 @@ environment: PYTHON: "/usr/local/opt/python@3.11/bin/python3" PYTHON_CONFIG: "/usr/local/opt/python@3.11/bin/python3-config" HOMEBREW_NO_INSTALL_CLEANUP: 1 + CC: gcc CFLAGS: "-I/usr/local/include" LDFLAGS: "-L/usr/local/lib" CONFIGURE_OPTIONS: "--disable-dependency-tracking --prefix=/usr/local --enable-python --with-pyprefix" @@ -146,6 +153,12 @@ environment: HOMEBREW_NO_INSTALL_CLEANUP: 1 PYTHON_VERSION: 3.11 TOXENV: py311 + - TARGET: macos-tox-py312 + BUILD_ENVIRONMENT: python-tox + APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey + HOMEBREW_NO_INSTALL_CLEANUP: 1 + PYTHON_VERSION: 3.12 + TOXENV: py312 - TARGET: cygwin64-gcc BUILD_ENVIRONMENT: cygwin64 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 @@ -273,7 +286,7 @@ build_script: - sh: if test ${BUILD_ENVIRONMENT} = "xcode"; then export PATH="/usr/local/opt/gettext/bin:$PATH"; export SED="/usr/local/bin/gsed"; tests/build.sh ${CONFIGURE_OPTIONS}; fi - cmd: if [%BUILD_ENVIRONMENT%]==[python] ( "%PYTHON%" setup.py bdist_wheel ) -- sh: if test ${BUILD_ENVIRONMENT} = "python-tox"; then export PATH="/usr/local/opt/gettext/bin:$PATH"; export SED="/usr/local/bin/gsed"; ./synclibs.sh && ./autogen.sh && ./configure --disable-nls --disable-shared-libs && make >/dev/null && tox -e${TOXENV}; fi +- sh: if test ${BUILD_ENVIRONMENT} = "python-tox"; then export PATH="/usr/local/opt/gettext/bin:$PATH"; export SED="/usr/local/bin/gsed"; ./synclibs.sh && ./autogen.sh && ./configure --disable-nls --disable-shared-libs && make sources >/dev/null && tox -e${TOXENV}; fi - cmd: if [%BUILD_ENVIRONMENT%]==[cygwin64] ( xcopy /i /q /s C:\projects\libewf-legacy C:\cygwin64\home\appveyor\libewf-legacy && C:\cygwin64\bin\bash -e -l -c "cd libewf-legacy && wget -q 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' -O './config.guess' && wget -q 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' -O './config.sub'" && diff --git a/common/Makefile.am b/common/Makefile.am index bb9b6b0..2433a75 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -19,7 +19,7 @@ MAINTAINERCLEANFILES = \ Makefile.in distclean: clean - /bin/rm -f config.h - /bin/rm -f types.h - /bin/rm -f Makefile + -rm -f config.h + -rm -f types.h + -rm -f Makefile diff --git a/configure.ac b/configure.ac index c4ede1d..0cc0002 100644 --- a/configure.ac +++ b/configure.ac @@ -9,6 +9,7 @@ AC_CONFIG_SRCDIR( [include/libewf.h.in]) AM_INIT_AUTOMAKE([gnu 1.6 tar-ustar]) +AM_EXTRA_RECURSIVE_TARGETS([sources splint]) AC_CONFIG_MACRO_DIR([m4]) @@ -271,6 +272,7 @@ AC_CONFIG_FILES([libewf/libewf.rc]) AC_CONFIG_FILES([ewf.net/ewf.net.rc]) AC_CONFIG_FILES([libewf.pc]) AC_CONFIG_FILES([libewf.spec]) +AC_CONFIG_FILES([setup.cfg]) dnl Generate a source configuration file AC_CONFIG_HEADERS([common/config.h]) diff --git a/documents/Makefile.am b/documents/Makefile.am index 45880ac..7aa8c00 100644 --- a/documents/Makefile.am +++ b/documents/Makefile.am @@ -7,5 +7,5 @@ MAINTAINERCLEANFILES = \ Makefile.in distclean: clean - /bin/rm -f Makefile + -rm -f Makefile diff --git a/ewf.net/Makefile.am b/ewf.net/Makefile.am index 95f6ff4..8afa9c2 100644 --- a/ewf.net/Makefile.am +++ b/ewf.net/Makefile.am @@ -12,5 +12,5 @@ MAINTAINERCLEANFILES = \ Makefile.in distclean: clean - /bin/rm -f Makefile + -rm -f Makefile diff --git a/ewftools-mt/Makefile.am b/ewftools-mt/Makefile.am index 272f87c..909d05c 100644 --- a/ewftools-mt/Makefile.am +++ b/ewftools-mt/Makefile.am @@ -81,9 +81,9 @@ MAINTAINERCLEANFILES = \ Makefile.in distclean: clean - /bin/rm -f Makefile + -rm -f Makefile -splint: +splint-local: @echo "Running splint on ewfacquirestream ..." -splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(ewfacquirestream_SOURCES) diff --git a/ewftools/Makefile.am b/ewftools/Makefile.am index a37ce27..1911cfc 100644 --- a/ewftools/Makefile.am +++ b/ewftools/Makefile.am @@ -411,9 +411,9 @@ MAINTAINERCLEANFILES = \ Makefile.in distclean: clean - /bin/rm -f Makefile + -rm -f Makefile -splint: +splint-local: @echo "Running splint on ewfacquire ..." -splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(ewfacquire_SOURCES) @echo "Running splint on ewfacquirestream ..." diff --git a/examples/Makefile.am b/examples/Makefile.am index efdb042..7311701 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -21,5 +21,5 @@ MAINTAINERCLEANFILES = \ Makefile.in distclean: clean - /bin/rm -f Makefile + -rm -f Makefile diff --git a/include/Makefile.am b/include/Makefile.am index b7ca885..68c35a6 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -19,9 +19,9 @@ MAINTAINERCLEANFILES = \ Makefile.in distclean: clean - /bin/rm -f libewf.h - /bin/rm -f libewf/definitions.h - /bin/rm -f libewf/features.h - /bin/rm -f libewf/types.h - /bin/rm -f Makefile + -rm -f libewf.h + -rm -f libewf/definitions.h + -rm -f libewf/features.h + -rm -f libewf/types.h + -rm -f Makefile diff --git a/libewf-legacy.ini b/libewf-legacy.ini index 3d443eb..c8b347b 100644 --- a/libewf-legacy.ini +++ b/libewf-legacy.ini @@ -19,7 +19,7 @@ year_of_creation: "2008" [tools] build_dependencies: ["crypto", "fuse", "lex", "uuid", "yacc"] description: "Several tools for reading and writing EWF files" -names: ["ewfaqcuire", "ewfaqcuirestream", "ewfexport", "ewfinfo", "ewfmount", "ewfverify"] +names: ["ewfacquire", "ewfacquirestream", "ewfexport", "ewfinfo", "ewfmount", "ewfverify"] [mount_tool] missing_backend_error: "No sub system to mount EWF." diff --git a/libewf/Makefile.am b/libewf/Makefile.am index 57ea2c2..b116ab6 100644 --- a/libewf/Makefile.am +++ b/libewf/Makefile.am @@ -118,11 +118,13 @@ MAINTAINERCLEANFILES = \ Makefile.in distclean: clean - /bin/rm -f libewf_definitions.h - /bin/rm -f libewf.rc - /bin/rm -f Makefile + -rm -f libewf_definitions.h + -rm -f libewf.rc + -rm -f Makefile -splint: +sources-local: $(BUILT_SOURCES) + +splint-local: @echo "Running splint on libewf ..." -splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(libewf_la_SOURCES) diff --git a/libmfdata/Makefile.am b/libmfdata/Makefile.am index bf21b1a..199a5ff 100644 --- a/libmfdata/Makefile.am +++ b/libmfdata/Makefile.am @@ -43,9 +43,9 @@ MAINTAINERCLEANFILES = \ Makefile.in distclean: clean - /bin/rm -f Makefile + -rm -f Makefile -splint: +splint-local: @echo "Running splint on libmfdata ..." -splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(libmfdata_la_SOURCES) diff --git a/m4/libcrypto.m4 b/m4/libcrypto.m4 index 87944a2..507f2bb 100644 --- a/m4/libcrypto.m4 +++ b/m4/libcrypto.m4 @@ -1,6 +1,6 @@ dnl Checks for libcrypto required headers and functions dnl -dnl Version: 20230701 +dnl Version: 20231007 dnl Function to detect whether openssl/evp.h can be used in combination with zlib.h AC_DEFUN([AX_LIBCRYPTO_CHECK_OPENSSL_EVP_ZLIB_COMPATIBILE], @@ -687,6 +687,10 @@ AC_DEFUN([AX_LIBCRYPTO_CHECK_LIB], ac_cv_libcrypto_CPPFLAGS="$openssl_CFLAGS" ac_cv_libcrypto_LIBADD="$openssl_LIBS" + AS_IF( + [test "x$ac_cv_libcrypto_LIBADD" = x], + [ac_cv_libcrypto_LIBADD="-lcrypto"]) + dnl On Cygwin also link zlib since libcrypto relies on it AS_CASE( [$host], diff --git a/m4/python.m4 b/m4/python.m4 index 307e15c..e10bc9f 100644 --- a/m4/python.m4 +++ b/m4/python.m4 @@ -1,6 +1,6 @@ dnl Functions for Python bindings dnl -dnl Version: 20211114 +dnl Version: 20230923 dnl Function to check if the python binary is available dnl "python${PYTHON_VERSION} python python# python#.#" @@ -8,7 +8,7 @@ AC_DEFUN([AX_PROG_PYTHON], [AS_IF( [test "x${PYTHON_VERSION}" != x], [ax_python_progs="python${PYTHON_VERSION}"], - [ax_python_progs="python python3 python3.11 python3.10 python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python2 python2.7 python2.6 python2.5"]) + [ax_python_progs="python python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0 python2 python2.7 python2.6 python2.5"]) AC_CHECK_PROGS( [PYTHON], [$ax_python_progs]) @@ -58,7 +58,7 @@ AC_DEFUN([AX_PROG_PYTHON2], dnl Function to check if the python3 binary is available dnl "python3 python3.#" AC_DEFUN([AX_PROG_PYTHON3], - [ax_python3_progs="python3 python3.11 python3.10 python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0" + [ax_python3_progs="python3 python3.12 python3.11 python3.10 python3.9 python3.8 python3.7 python3.6 python3.5 python3.4 python3.3 python3.2 python3.1 python3.0" AC_CHECK_PROGS( [PYTHON3], [$ax_python3_progs]) @@ -95,7 +95,7 @@ AC_DEFUN([AX_PROG_PYTHON_CONFIG], [test "x${PYTHON_CONFIG}" = x], [AC_CHECK_PROGS( [PYTHON_CONFIG], - [python-config python3-config python3.11-config python3.10-config python3.9-config python3.8-config python3.7-config python3.6-config python3.5-config python3.4-config python3.3-config python3.2-config python3.1-config python3.0-config python2-config python2.7-config python2.6-config python2.5-config]) + [python-config python3-config python3.12-config python3.11-config python3.10-config python3.9-config python3.8-config python3.7-config python3.6-config python3.5-config python3.4-config python3.3-config python3.2-config python3.1-config python3.0-config python2-config python2.7-config python2.6-config python2.5-config]) ]) AS_IF( [test "x${PYTHON_CONFIG}" = x], @@ -131,7 +131,7 @@ AC_DEFUN([AX_PROG_PYTHON3_CONFIG], [test "x${PYTHON3_CONFIG}" = x], [AC_CHECK_PROGS( [PYTHON3_CONFIG], - [python3-config python3.11-config python3.10-config python3.9-config python3.8-config python3.7-config python3.6-config python3.5-config python3.4-config python3.3-config python3.2-config python3.1-config python3.0-config]) + [python3-config python3.12-config python3.11-config python3.10-config python3.9-config python3.8-config python3.7-config python3.6-config python3.5-config python3.4-config python3.3-config python3.2-config python3.1-config python3.0-config]) ]) AS_IF( [test "x${PYTHON3_CONFIG}" = x], diff --git a/manuals/Makefile.am b/manuals/Makefile.am index 2d62c56..a6fb12e 100644 --- a/manuals/Makefile.am +++ b/manuals/Makefile.am @@ -22,5 +22,5 @@ MAINTAINERCLEANFILES = \ Makefile.in distclean: clean - /bin/rm -f Makefile + -rm -f Makefile diff --git a/msvscpp/Makefile.am b/msvscpp/Makefile.am index 0c98cdd..85e87f8 100644 --- a/msvscpp/Makefile.am +++ b/msvscpp/Makefile.am @@ -72,5 +72,5 @@ MAINTAINERCLEANFILES = \ Makefile.in distclean: clean - /bin/rm -f Makefile + -rm -f Makefile diff --git a/po/Makevars.in b/po/Makevars.in index d92a79a..bd0b9d0 100644 --- a/po/Makevars.in +++ b/po/Makevars.in @@ -40,3 +40,6 @@ MSGID_BUGS_ADDRESS = @PACKAGE_BUGREPORT@ # message catalogs shall be used. It is usually empty. EXTRA_LOCALE_CATEGORIES = +# Additional make targets. +sources splint: + diff --git a/pyewf-python2/Makefile.am b/pyewf-python2/Makefile.am index cb61c57..064bce3 100644 --- a/pyewf-python2/Makefile.am +++ b/pyewf-python2/Makefile.am @@ -65,8 +65,8 @@ MAINTAINERCLEANFILES = \ Makefile.in clean-local: - /bin/rm -f pyewf*.[ch] + -rm -f pyewf*.[ch] distclean: clean - /bin/rm -f Makefile + -rm -f Makefile diff --git a/pyewf-python3/Makefile.am b/pyewf-python3/Makefile.am index a566c43..11b4ce9 100644 --- a/pyewf-python3/Makefile.am +++ b/pyewf-python3/Makefile.am @@ -65,8 +65,8 @@ MAINTAINERCLEANFILES = \ Makefile.in clean-local: - /bin/rm -f pyewf*.[ch] + -rm -f pyewf*.[ch] distclean: clean - /bin/rm -f Makefile + -rm -f Makefile diff --git a/pyewf/Makefile.am b/pyewf/Makefile.am index 340be1b..8925e62 100644 --- a/pyewf/Makefile.am +++ b/pyewf/Makefile.am @@ -52,5 +52,5 @@ MAINTAINERCLEANFILES = \ Makefile.in distclean: clean - /bin/rm -f Makefile + -rm -f Makefile diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..1870a2e --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,4 @@ +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" + diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 1ded777..0000000 --- a/setup.cfg +++ /dev/null @@ -1,2 +0,0 @@ -[metadata] -license_files = COPYING COPYING.LESSER diff --git a/setup.cfg.in b/setup.cfg.in new file mode 100644 index 0000000..6dd94cd --- /dev/null +++ b/setup.cfg.in @@ -0,0 +1,15 @@ +[metadata] +name = libewf-python +version = @VERSION@ +description = Python bindings module for libewf +long_description = Python bindings module for libewf +author = Joachim Metz +author_email = joachim.metz@gmail.com +license = GNU Lesser General Public License v3 or later (LGPLv3+) +license_files = COPYING COPYING.LESSER +classifiers = + Development Status :: 3 - Alpha + Programming Language :: Python + +[options] +python_requires = >=3.7 diff --git a/setup.py b/setup.py index afd9215..3a86854 100755 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # # Script to build and install Python-bindings. -# Version: 20230411 +# Version: 20230909 from __future__ import print_function @@ -25,44 +25,11 @@ from setuptools.command.build_ext import build_ext from setuptools.command.sdist import sdist -try: - from distutils.command.bdist_msi import bdist_msi -except ImportError: - bdist_msi = None -try: - from setuptools.command.bdist_rpm import bdist_rpm -except ImportError: - from distutils.command.bdist import bdist as bdist_rpm - - -if not bdist_msi: - custom_bdist_msi = None -else: - class custom_bdist_msi(bdist_msi): - """Custom handler for the bdist_msi command.""" - - def run(self): - """Builds an MSI.""" - # Make a deepcopy of distribution so the following version changes - # only apply to bdist_msi. - self.distribution = copy.deepcopy(self.distribution) - - # bdist_msi does not support the library version so we add ".1" - # as a work around. - self.distribution.metadata.version = "{0:s}.1".format( - self.distribution.metadata.version) - - bdist_msi.run(self) - - -class custom_bdist_rpm(bdist_rpm): - """Custom handler for the bdist_rpm command.""" - - def run(self): - """Builds a RPM.""" - print("'setup.py bdist_rpm' command not supported use 'rpmbuild' instead.") - sys.exit(1) +if (sys.version_info[0], sys.version_info[1]) < (3, 7): + print(("Unsupported Python version: {0:s}, version 3.7 or higher " + "required.").format(sys.version)) + sys.exit(1) class custom_build_ext(build_ext): @@ -218,49 +185,25 @@ def module_name(self): """The Python module name.""" return "py{0:s}".format(self.library_name[3:]) - @property - def package_name(self): - """The package name.""" - return "{0:s}-python".format(self.library_name) - - @property - def package_description(self): - """The package description.""" - return "Python bindings module for {0:s}".format(self.library_name) - - @property - def project_url(self): - """The project URL.""" - return "https://github.com/libyal/{0:s}/".format(self.library_name) - def _ReadConfigureAc(self): """Reads configure.ac to initialize the project information.""" - file_object = open("configure.ac", "rb") - if not file_object: - raise IOError("Unable to open: configure.ac") - - found_ac_init = False - found_library_name = False - for line in file_object.readlines(): - line = line.strip() - if found_library_name: - library_version = line[1:-2] - if sys.version_info[0] >= 3: - library_version = library_version.decode("ascii") - self.library_version = library_version - break - - elif found_ac_init: - library_name = line[1:-2] - if sys.version_info[0] >= 3: - library_name = library_name.decode("ascii") - self.library_name = library_name - found_library_name = True - - elif line.startswith(b"AC_INIT"): - found_ac_init = True - - file_object.close() + with open("configure.ac", "r", encoding="utf-8") as file_object: + found_ac_init = False + found_library_name = False + for line in file_object.readlines(): + line = line.strip() + if found_library_name: + library_version = line[1:-2] + self.library_version = library_version + break + + elif found_ac_init: + library_name = line[1:-2] + self.library_name = library_name + found_library_name = True + + elif line.startswith("AC_INIT"): + found_ac_init = True if not self.library_name or not self.library_version: raise RuntimeError( @@ -271,30 +214,23 @@ def _ReadMakefileAm(self): if not self.library_name: raise RuntimeError("Missing library name") - file_object = open("Makefile.am", "rb") - if not file_object: - raise IOError("Unable to open: Makefile.am") - - found_subdirs = False - for line in file_object.readlines(): - line = line.strip() - if found_subdirs: - library_name, _, _ = line.partition(b" ") - if sys.version_info[0] >= 3: - library_name = library_name.decode("ascii") + with open("Makefile.am", "r", encoding="utf-8") as file_object: + found_subdirs = False + for line in file_object.readlines(): + line = line.strip() + if found_subdirs: + library_name, _, _ = line.partition(" ") - self.include_directories.append(library_name) + self.include_directories.append(library_name) - if library_name.startswith("lib"): - self.library_names.append(library_name) + if library_name.startswith("lib"): + self.library_names.append(library_name) - if library_name == self.library_name: - break + if library_name == self.library_name: + break - elif line.startswith(b"SUBDIRS"): - found_subdirs = True - - file_object.close() + elif line.startswith("SUBDIRS"): + found_subdirs = True if not self.include_directories or not self.library_names: raise RuntimeError( @@ -306,12 +242,8 @@ def _ReadMakefileAm(self): CMDCLASS = { "build_ext": custom_build_ext, - "bdist_rpm": custom_bdist_rpm, "sdist": custom_sdist} -if custom_bdist_msi: - CMDCLASS["bdist_msi"] = custom_bdist_msi - SOURCES = [] # TODO: replace by detection of MSC @@ -344,18 +276,7 @@ def _ReadMakefileAm(self): # TODO: find a way to detect missing python.h # e.g. on Ubuntu python-dev is not installed by python-pip -# TODO: what about description and platform in egg file - -setup( - name=project_information.package_name, - url=project_information.project_url, - version=project_information.library_version, - description=project_information.package_description, - long_description=project_information.package_description, - long_description_content_type="text/plain", - author="Joachim Metz", - author_email="joachim.metz@gmail.com", - license="GNU Lesser General Public License v3 or later (LGPLv3+)", +setup_args = dict( cmdclass=CMDCLASS, ext_modules=[ Extension( @@ -364,8 +285,9 @@ def _ReadMakefileAm(self): include_dirs=project_information.include_directories, libraries=[], library_dirs=[], - sources=SOURCES, - ), - ], + sources=SOURCES + ) + ] ) +setup(**setup_args) diff --git a/synclibs.sh b/synclibs.sh index 108fc6d..ed53021 100755 --- a/synclibs.sh +++ b/synclibs.sh @@ -1,7 +1,7 @@ #!/bin/sh # Script that synchronizes the local library dependencies # -# Version: 20230510 +# Version: 20231023 EXIT_SUCCESS=0; EXIT_FAILURE=1; @@ -111,12 +111,12 @@ endif if test ${LOCAL_LIB} = "libfplist"; then # TODO: make this more generic to strip the last \\ - sed -i'~' 's/libfplist_xml_scanner.c \\/libfplist_xml_scanner.c/' ${LOCAL_LIB_MAKEFILE_AM}; + sed -i'~' '/EXTRA_DIST = /,/^$/s/libfplist_xml_scanner.c \\/libfplist_xml_scanner.c/' ${LOCAL_LIB_MAKEFILE_AM}; elif test ${LOCAL_LIB} = "libodraw"; then # TODO: make this more generic to strip the last \\ - sed -i'~' 's/libodraw_cue_scanner.c \\/libodraw_cue_scanner.c/' ${LOCAL_LIB_MAKEFILE_AM}; + sed -i'~' '/EXTRA_DIST = /,/^$/s/libodraw_cue_scanner.c \\/libodraw_cue_scanner.c/' ${LOCAL_LIB_MAKEFILE_AM}; else sed -i'~' '/EXTRA_DIST = /,/^$/d' ${LOCAL_LIB_MAKEFILE_AM}; diff --git a/tests/Makefile.am b/tests/Makefile.am index 71efdeb..c6fb16a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -548,5 +548,5 @@ MAINTAINERCLEANFILES = \ Makefile.in distclean: clean - /bin/rm -f Makefile + -rm -f Makefile diff --git a/tests/runtests.py b/tests/runtests.py new file mode 100755 index 0000000..9df3912 --- /dev/null +++ b/tests/runtests.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python +# +# Script to run Python test scripts. +# +# Version: 20231009 + +import glob +import os +import sys +import unittest + + +test_profile = ".pyewf" +input_glob = "*.[Ees]01" +option_sets = [] + + +def ReadIgnoreList(test_profile): + """Reads the test profile ignore file if it exists. + + Args: + test_profile (str): test profile. + + Returns: + set[str]: ignore list. + """ + ignore_file_path = os.path.join("tests", "input", test_profile, "ignore") + if os.path.isfile(ignore_file_path): + with open(ignore_file_path, "r", encoding="utf-8") as file_object: + return set([line.strip() for line in file_object.readlines()]) + + return set() + + +if __name__ == "__main__": + print(f"Using Python version {sys.version!s}") + + test_loader = unittest.TestLoader() + test_runner = unittest.TextTestRunner(verbosity=2) + + test_scripts = test_loader.discover("tests", pattern="*.py") + + ignore_list = ReadIgnoreList(test_profile) + + test_set = None + source_file = None + + for test_set in glob.glob(os.path.join("tests", "input", "*")): + test_set = test_set.rsplit(os.path.sep, maxsplit=1)[-1] + if not test_set or test_set[0] == '.' or test_set in ignore_list: + continue + + source_files = glob.glob(os.path.join( + "tests", "input", test_set, input_glob)) + if source_files: + source_file = source_files[0] + break + + setattr(unittest, "source", source_file) + + if source_file: + for option_set in option_sets: + test_file = os.path.basename(source_file) + test_options_file_path = os.path.join( + "tests", "input", test_profile, test_set, + f"{test_file:s}.{option_set:s}") + if os.path.isfile(test_options_file_path): + with open(test_options_file_path, "r", encoding="utf-8") as file_object: + lines = [line.strip() for line in file_object.readlines()] + if lines[0] == "# libyal test data options": + for line in lines[1:]: + key, value = line.split("=", maxsplit=1) + setattr(unittest, key, value) + + test_results = test_runner.run(test_scripts) + if not test_results.wasSuccessful(): + sys.exit(1) diff --git a/tests/test_library.sh b/tests/test_library.sh index e5f0942..159518f 100755 --- a/tests/test_library.sh +++ b/tests/test_library.sh @@ -1,7 +1,7 @@ -#!/bin/bash +#!/usr/bin/env bash # Tests library functions and types. # -# Version: 20200705 +# Version: 20231007 EXIT_SUCCESS=0; EXIT_FAILURE=1; @@ -9,7 +9,7 @@ EXIT_IGNORE=77; LIBRARY_TESTS="bit_stream checksum chunk_data chunk_table compression date_time date_time_values deflate empty_block error file_entry filename hash_sections hash_values huffman_tree io_handle media_values notify read_io_handle sector_range segment_table single_files write_io_handle"; LIBRARY_TESTS_WITH_INPUT="handle support"; -OPTION_SETS=""; +OPTION_SETS=(); INPUT_GLOB="*.[Ees]01"; @@ -46,7 +46,7 @@ run_test_with_input() if ! test -d "input2"; then - echo "Test input directory not found."; + echo "Test input2 directory not found."; return ${EXIT_IGNORE}; fi @@ -54,7 +54,7 @@ run_test_with_input() if test ${RESULT} -eq ${EXIT_SUCCESS}; then - echo "No files or directories found in the test input directory"; + echo "No files or directories found in the test input2 directory"; return ${EXIT_IGNORE}; fi @@ -78,47 +78,54 @@ run_test_with_input() local TEST_SET_DIRECTORY=$(get_test_set_directory "${TEST_PROFILE_DIRECTORY}" "${TEST_SET_INPUT_DIRECTORY}"); - local OLDIFS=${IFS}; - - # IFS="\n" is not supported by all platforms. - IFS=" -"; - if test -f "${TEST_SET_DIRECTORY}/files"; then - for INPUT_FILE in `cat ${TEST_SET_DIRECTORY}/files | sed "s?^?${TEST_SET_INPUT_DIRECTORY}/?"`; + IFS="" read -a INPUT_FILES <<< $(cat ${TEST_SET_DIRECTORY}/files | sed "s?^?${TEST_SET_INPUT_DIRECTORY}/?"); + else + IFS="" read -a INPUT_FILES <<< $(ls -1d ${TEST_SET_INPUT_DIRECTORY}/${INPUT_GLOB}); + fi + for INPUT_FILE in "${INPUT_FILES[@]}"; + do + OPTION_INPUT_FILE="${INPUT_FILE}"; + + if test "${OSTYPE}" = "msys"; + then + # A test executable built with MinGW expects a Windows path. + INPUT_FILE=`echo ${INPUT_FILE} | sed 's?/?\\\\?g'`; + fi + local TESTED_WITH_OPTIONS=0; + + for OPTION_SET in ${OPTION_SETS[@]}; do - if test "${OSTYPE}" = "msys"; - then - # A test executable built with MinGW expects a Windows path. - INPUT_FILE=`echo ${INPUT_FILE} | sed 's?/?\\\\?g'`; - fi - run_test_on_input_file_with_options "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "default" "${OPTION_SETS}" "${TEST_EXECUTABLE}" "${INPUT_FILE}"; - RESULT=$?; + local TEST_DATA_OPTION_FILE=$(get_test_data_option_file "${TEST_SET_DIRECTORY}" "${OPTION_INPUT_FILE}" "${OPTION_SET}"); - if test ${RESULT} -ne ${EXIT_SUCCESS}; + if test -f ${TEST_DATA_OPTION_FILE}; then - break; + TESTED_WITH_OPTIONS=1; + + IFS=" " read -a OPTIONS <<< $(read_test_data_option_file "${TEST_SET_DIRECTORY}" "${INPUT_FILE}" "${OPTION_SET}"); + + run_test_on_input_file "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "default" "${OPTION_SET}" "${TEST_EXECUTABLE}" "${INPUT_FILE}" "${OPTIONS[@]}"; + RESULT=$?; + + if test ${RESULT} -ne ${EXIT_SUCCESS}; + then + break; + fi fi done - else - for INPUT_FILE in `ls -1d ${TEST_SET_INPUT_DIRECTORY}/${INPUT_GLOB}`; - do - if test "${OSTYPE}" = "msys"; - then - # A test executable built with MinGW expects a Windows path. - INPUT_FILE=`echo ${INPUT_FILE} | sed 's?/?\\\\?g'`; - fi - run_test_on_input_file_with_options "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "default" "${OPTION_SETS}" "${TEST_EXECUTABLE}" "${INPUT_FILE}"; + + if test ${TESTED_WITH_OPTIONS} -eq 0; + then + run_test_on_input_file "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "default" "" "${TEST_EXECUTABLE}" "${INPUT_FILE}"; RESULT=$?; + fi - if test ${RESULT} -ne ${EXIT_SUCCESS}; - then - break; - fi - done - fi - IFS=${OLDIFS}; + if test ${RESULT} -ne ${EXIT_SUCCESS}; + then + break; + fi + done if test ${RESULT} -ne ${EXIT_SUCCESS}; then diff --git a/tests/test_manpage.sh b/tests/test_manpage.sh index 9246cf2..4abb656 100755 --- a/tests/test_manpage.sh +++ b/tests/test_manpage.sh @@ -1,7 +1,7 @@ -#!/bin/bash +#!/usr/bin/env bash # Tests man pages. # -# Version: 20190302 +# Version: 20230410 EXIT_SUCCESS=0; EXIT_FAILURE=1; diff --git a/tests/test_runner.sh b/tests/test_runner.sh index 4580f73..e527367 100755 --- a/tests/test_runner.sh +++ b/tests/test_runner.sh @@ -1,7 +1,7 @@ -#!/bin/bash +#!/usr/bin/env bash # Bash functions to run an executable for testing. # -# Version: 20220924 +# Version: 20231013 # # When CHECK_WITH_ASAN is set to a non-empty value the test executable # is run with asan, otherwise it is run without. @@ -406,9 +406,12 @@ read_test_data_option_file() TEST_DATA_OPTION_FILE=$(get_test_data_option_file "${TEST_SET_DIRECTORY}" "${INPUT_FILE}" "${OPTION_SET}"); fi - local OPTIONS=() - local OPTIONS_STRING=`cat "${TEST_DATA_OPTION_FILE}" | head -n 1 | sed 's/[\r\n]*$//'`; + local OPTIONS_STRING=`head -n 1 "${TEST_DATA_OPTION_FILE}" | sed 's/[\r\n]*$//'`; + if test "${OPTIONS_STRING}" = "# libyal test data options"; + then + OPTIONS_STRING=`tail -n +2 "${TEST_DATA_OPTION_FILE}" | sed 's/^offset=/-o/;s/^password=/-p/;s/^recovery_password=/-r/;s/^startup_key=/-s/;s/virtual_address=/-v/' | tr '\n' ' '`; + fi echo "${OPTIONS_STRING}"; } @@ -1073,14 +1076,10 @@ run_test_on_input_file() local ARGUMENTS=("$@"); local INPUT_NAME=`basename "${INPUT_FILE}"`; - local OPTIONS=(); local TEST_OUTPUT="${INPUT_NAME}"; if test -n "${OPTION_SET}"; then - OPTIONS_STRING=$(read_test_data_option_file "${TEST_SET_DIRECTORY}" "${INPUT_FILE}" "${OPTION_SET}"); - IFS=" " read -a OPTIONS <<< "${OPTIONS_STRING}"; - TEST_OUTPUT="${INPUT_NAME}-${OPTION_SET}"; fi @@ -1092,7 +1091,7 @@ run_test_on_input_file() if test "${TEST_MODE}" = "with_callback"; then - test_callback "${TMPDIR}" "${TEST_SET_DIRECTORY}" "${TEST_OUTPUT}" "${TEST_EXECUTABLE}" "${TEST_INPUT}" ${ARGUMENTS[@]} "${OPTIONS[@]}"; + test_callback "${TMPDIR}" "${TEST_SET_DIRECTORY}" "${TEST_OUTPUT}" "${TEST_EXECUTABLE}" "${TEST_INPUT}" ${ARGUMENTS[@]}; RESULT=$?; elif test "${TEST_MODE}" = "with_stdout_reference"; @@ -1109,7 +1108,7 @@ run_test_on_input_file() local INPUT_FILE_FULL_PATH=$( readlink_f "${INPUT_FILE}" ); local TEST_LOG="${TEST_OUTPUT}.log"; - (cd ${TMPDIR} && run_test_with_input_and_arguments "${TEST_EXECUTABLE}" "${INPUT_FILE_FULL_PATH}" ${ARGUMENTS[@]} "${OPTIONS[@]}" > "${TEST_LOG}"); + (cd ${TMPDIR} && run_test_with_input_and_arguments "${TEST_EXECUTABLE}" "${INPUT_FILE_FULL_PATH}" ${ARGUMENTS[@]} > "${TEST_LOG}"); RESULT=$?; # Compare output if test ran successfully. @@ -1135,7 +1134,7 @@ run_test_on_input_file() fi else - run_test_with_input_and_arguments "${TEST_EXECUTABLE}" "${INPUT_FILE}" ${ARGUMENTS[@]} "${OPTIONS[@]}"; + run_test_with_input_and_arguments "${TEST_EXECUTABLE}" "${INPUT_FILE}" ${ARGUMENTS[@]}; RESULT=$?; fi @@ -1144,22 +1143,12 @@ run_test_on_input_file() if test -n "${TEST_DESCRIPTION}"; then ARGUMENTS=`echo "${ARGUMENTS[*]}" | tr '\n' ' ' | sed 's/[ ]\$//'`; - OPTIONS=`echo "${OPTIONS[*]}" | tr '\n' ' ' | sed 's/[ ]\$//'`; - if test -z "${ARGUMENTS}" && test -z "${OPTIONS}"; + if test -z "${ARGUMENTS}"; then echo -n "${TEST_DESCRIPTION} with input: ${INPUT_FILE}"; - - elif test -z "${ARGUMENTS}"; - then - echo -n "${TEST_DESCRIPTION} with options: '${OPTIONS}' and input: ${INPUT_FILE}"; - - elif test -z "${OPTIONS}"; - then - echo -n "${TEST_DESCRIPTION} with options: '${ARGUMENTS}' and input: ${INPUT_FILE}"; - else - echo -n "${TEST_DESCRIPTION} with options: '${ARGUMENTS} ${OPTIONS}' and input: ${INPUT_FILE}"; + echo -n "${TEST_DESCRIPTION} with options: '${ARGUMENTS}' and input: ${INPUT_FILE}"; fi if test ${RESULT} -ne ${EXIT_SUCCESS}; @@ -1172,122 +1161,3 @@ run_test_on_input_file() return ${RESULT}; } -# Runs the test with options on the input file. -# -# Note that this function is not intended to be directly invoked -# from outside the test runner script. -# -# Arguments: -# a string containing the path of the test set directory -# a string containing the description of the test -# a string containing the test mode -# a string containing the name of the test data option sets -# a string containing the path of the test executable -# a string containing the path of the test input file -# an array containing the arguments for the test executable -# -# Returns: -# an integer containg the exit status of the test executable -# -run_test_on_input_file_with_options() -{ - local TEST_SET_DIRECTORY=$1; - local TEST_DESCRIPTION=$2; - local TEST_MODE=$3; - local OPTION_SETS=$4; - local TEST_EXECUTABLE=$5; - local INPUT_FILE=$6; - shift 6; - local ARGUMENTS=("$@"); - - local RESULT=${EXIT_SUCCESS}; - local TESTED_WITH_OPTIONS=0; - - for OPTION_SET in `echo ${OPTION_SETS} | tr ' ' '\n'`; - do - local TEST_DATA_OPTION_FILE=$(get_test_data_option_file "${TEST_SET_DIRECTORY}" "${INPUT_FILE}" "${OPTION_SET}"); - - if ! test -f ${TEST_DATA_OPTION_FILE}; - then - continue - fi - - run_test_on_input_file "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "${TEST_MODE}" "${OPTION_SET}" "${TEST_EXECUTABLE}" "${INPUT_FILE}" ${ARGUMENTS[@]}; - RESULT=$?; - - if test ${RESULT} -ne ${EXIT_SUCCESS}; - then - break; - fi - TESTED_WITH_OPTIONS=1; - done - - if test ${RESULT} -eq ${EXIT_SUCCESS} && test ${TESTED_WITH_OPTIONS} -eq 0; - then - run_test_on_input_file "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "${TEST_MODE}" "" "${TEST_EXECUTABLE}" "${INPUT_FILE}" ${ARGUMENTS[@]}; - RESULT=$?; - fi - return ${RESULT}; -} - -# Runs the test with options on the file entries in the test set directory. -# -# Note that this function is not intended to be directly invoked -# from outside the test runner script. -# -# Arguments: -# a string containing the path of the test set directory -# a string containing the description of the test -# a string containing the test mode -# a string containing the name of the test data option sets -# a string containing the path of the test executable -# an array containing the arguments for the test executable -# -# Returns: -# an integer containg the exit status of the test executable -# -run_test_on_test_set_with_options() -{ - local TEST_SET_DIRECTORY=$1; - local TEST_DESCRIPTION=$2; - local TEST_MODE=$3; - local OPTION_SETS=$4; - local TEST_EXECUTABLE=$5; - shift 5; - local ARGUMENTS=("$@"); - - local RESULT=${EXIT_SUCCESS}; - - # IFS="\n"; is not supported by all platforms. - IFS=" -"; - - if test -f "${TEST_SET_DIRECTORY}/files"; - then - for INPUT_FILE in `cat ${TEST_SET_DIRECTORY}/files | sed "s?^?${TEST_SET_INPUT_DIRECTORY}/?"`; - do - run_test_on_input_file_with_options "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "${TEST_MODE}" "${OPTION_SETS}" "${TEST_EXECUTABLE}" "${INPUT_FILE}" ${ARGUMENTS[@]}; - RESULT=$?; - - if test ${RESULT} -ne ${EXIT_SUCCESS}; - then - break; - fi - done - else - for INPUT_FILE in `ls -1d ${TEST_SET_INPUT_DIRECTORY}/${INPUT_GLOB}`; - do - run_test_on_input_file_with_options "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "${TEST_MODE}" "${OPTION_SETS}" "${TEST_EXECUTABLE}" "${INPUT_FILE}" ${ARGUMENTS[@]}; - RESULT=$?; - - if test ${RESULT} -ne ${EXIT_SUCCESS}; - then - break; - fi - done - fi - IFS=${OLDIFS}; - - return ${RESULT}; -} - diff --git a/tox.ini b/tox.ini index df530a0..009f168 100644 --- a/tox.ini +++ b/tox.ini @@ -1,15 +1,20 @@ [tox] -envlist = py3{7,8,9,10,11} +envlist = py3{7,8,9,10,11,12} [testenv] usedevelop = True -allowlist_externals = ./setup.py pip_pre = True passenv = - CFLAGS - CPPFLAGS - INCLUDE - LDFLAGS - LIB + CFLAGS + CPPFLAGS + INCLUDE + LDFLAGS + LIB +deps = + build + setuptools + wheel commands = - ./setup.py bdist_wheel + python -m build --no-isolation --outdir=dist --wheel + python -m pip install --no-index --find-links=dist libewf-python + python tests/runtests.py