mirror of
https://github.com/libyal/libexe
synced 2026-06-08 15:29:55 +00:00
Applied updates and changes for deployment
This commit is contained in:
@@ -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 }}
|
||||
+5
-1
@@ -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]
|
||||
/libexe/libexe.rc
|
||||
/libexe/libexe_definitions.h
|
||||
/pyexe-python[23]/*.[ch]
|
||||
/setup.cfg
|
||||
/exetools/*.exe
|
||||
/exetools/exeinfo
|
||||
/tests/*.exe
|
||||
|
||||
+9
-27
@@ -48,6 +48,9 @@ PKGCONFIG_FILES = \
|
||||
libexe.pc.in
|
||||
|
||||
SETUP_PY_FILES = \
|
||||
pyproject.toml \
|
||||
setup.cfg \
|
||||
setup.cfg.in \
|
||||
setup.py
|
||||
|
||||
SPEC_FILES = \
|
||||
@@ -93,35 +96,14 @@ 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 libexe.pc
|
||||
/bin/rm -f libexe.spec
|
||||
-rm -f Makefile
|
||||
-rm -f config.status
|
||||
-rm -f config.cache
|
||||
-rm -f config.log
|
||||
-rm -f libexe.pc
|
||||
-rm -f libexe.spec
|
||||
@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)/libcthreads && $(MAKE) splint $(AM_MAKEFLAGS))
|
||||
(cd $(srcdir)/libcdata && $(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)/libfdatetime && $(MAKE) splint $(AM_MAKEFLAGS))
|
||||
(cd $(srcdir)/libexe && $(MAKE) splint $(AM_MAKEFLAGS))
|
||||
(cd $(srcdir)/exetools && $(MAKE) splint $(AM_MAKEFLAGS))
|
||||
(cd $(srcdir)/pyexe && $(MAKE) splint $(AM_MAKEFLAGS))
|
||||
(cd $(srcdir)/tests && $(MAKE) splint $(AM_MAKEFLAGS))
|
||||
(cd $(srcdir)/ossfuzz && $(MAKE) splint $(AM_MAKEFLAGS))
|
||||
(cd $(srcdir)/po && $(MAKE) splint $(AM_MAKEFLAGS))
|
||||
|
||||
|
||||
+14
-1
@@ -84,11 +84,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
|
||||
@@ -96,6 +101,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"
|
||||
@@ -105,6 +111,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"
|
||||
@@ -140,6 +147,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
|
||||
@@ -212,7 +225,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\libexe C:\cygwin64\home\appveyor\libexe &&
|
||||
C:\cygwin64\bin\bash -e -l -c "cd libexe && 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'" &&
|
||||
|
||||
+3
-3
@@ -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
|
||||
|
||||
|
||||
+3
-1
@@ -2,13 +2,14 @@ AC_PREREQ([2.71])
|
||||
|
||||
AC_INIT(
|
||||
[libexe],
|
||||
[20230903],
|
||||
[20231024],
|
||||
[joachim.metz@gmail.com])
|
||||
|
||||
AC_CONFIG_SRCDIR(
|
||||
[include/libexe.h.in])
|
||||
|
||||
AM_INIT_AUTOMAKE([gnu 1.6 tar-ustar])
|
||||
AM_EXTRA_RECURSIVE_TARGETS([sources splint])
|
||||
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
@@ -195,6 +196,7 @@ AC_CONFIG_FILES([dpkg/changelog])
|
||||
AC_CONFIG_FILES([libexe/libexe.rc])
|
||||
AC_CONFIG_FILES([libexe.pc])
|
||||
AC_CONFIG_FILES([libexe.spec])
|
||||
AC_CONFIG_FILES([setup.cfg])
|
||||
dnl Generate a source configuration file
|
||||
AC_CONFIG_HEADERS([common/config.h])
|
||||
|
||||
|
||||
@@ -48,9 +48,9 @@ MAINTAINERCLEANFILES = \
|
||||
Makefile.in
|
||||
|
||||
distclean: clean
|
||||
/bin/rm -f Makefile
|
||||
-rm -f Makefile
|
||||
|
||||
splint:
|
||||
splint-local:
|
||||
@echo "Running splint on exeinfo ..."
|
||||
-splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(exeinfo_SOURCES)
|
||||
|
||||
|
||||
+5
-5
@@ -19,9 +19,9 @@ MAINTAINERCLEANFILES = \
|
||||
Makefile.in
|
||||
|
||||
distclean: clean
|
||||
/bin/rm -f libexe.h
|
||||
/bin/rm -f libexe/definitions.h
|
||||
/bin/rm -f libexe/features.h
|
||||
/bin/rm -f libexe/types.h
|
||||
/bin/rm -f Makefile
|
||||
-rm -f libexe.h
|
||||
-rm -f libexe/definitions.h
|
||||
-rm -f libexe/features.h
|
||||
-rm -f libexe/types.h
|
||||
-rm -f Makefile
|
||||
|
||||
|
||||
+6
-4
@@ -87,11 +87,13 @@ MAINTAINERCLEANFILES = \
|
||||
Makefile.in
|
||||
|
||||
distclean: clean
|
||||
/bin/rm -f libexe_definitions.h
|
||||
/bin/rm -f libexe.rc
|
||||
/bin/rm -f Makefile
|
||||
-rm -f libexe_definitions.h
|
||||
-rm -f libexe.rc
|
||||
-rm -f Makefile
|
||||
|
||||
splint:
|
||||
sources-local: $(BUILT_SOURCES)
|
||||
|
||||
splint-local:
|
||||
@echo "Running splint on libexe ..."
|
||||
-splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(libexe_la_SOURCES)
|
||||
|
||||
|
||||
+5
-5
@@ -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],
|
||||
|
||||
+1
-1
@@ -10,5 +10,5 @@ MAINTAINERCLEANFILES = \
|
||||
Makefile.in
|
||||
|
||||
distclean: clean
|
||||
/bin/rm -f Makefile
|
||||
-rm -f Makefile
|
||||
|
||||
|
||||
+1
-1
@@ -44,5 +44,5 @@ MAINTAINERCLEANFILES = \
|
||||
Makefile.in
|
||||
|
||||
distclean: clean
|
||||
/bin/rm -f Makefile
|
||||
-rm -f Makefile
|
||||
|
||||
|
||||
+2
-2
@@ -37,9 +37,9 @@ MAINTAINERCLEANFILES = \
|
||||
Makefile.in
|
||||
|
||||
distclean: clean
|
||||
/bin/rm -f Makefile
|
||||
-rm -f Makefile
|
||||
|
||||
splint:
|
||||
splint-local:
|
||||
@echo "Running splint on file_fuzzer ..."
|
||||
-splint -preproc -redef $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(file_fuzzer_SOURCES)
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -64,8 +64,8 @@ MAINTAINERCLEANFILES = \
|
||||
Makefile.in
|
||||
|
||||
clean-local:
|
||||
/bin/rm -f pyexe*.[ch]
|
||||
-rm -f pyexe*.[ch]
|
||||
|
||||
distclean: clean
|
||||
/bin/rm -f Makefile
|
||||
-rm -f Makefile
|
||||
|
||||
|
||||
@@ -64,8 +64,8 @@ MAINTAINERCLEANFILES = \
|
||||
Makefile.in
|
||||
|
||||
clean-local:
|
||||
/bin/rm -f pyexe*.[ch]
|
||||
-rm -f pyexe*.[ch]
|
||||
|
||||
distclean: clean
|
||||
/bin/rm -f Makefile
|
||||
-rm -f Makefile
|
||||
|
||||
|
||||
+1
-1
@@ -51,5 +51,5 @@ MAINTAINERCLEANFILES = \
|
||||
Makefile.in
|
||||
|
||||
distclean: clean
|
||||
/bin/rm -f Makefile
|
||||
-rm -f Makefile
|
||||
|
||||
|
||||
@@ -232,13 +232,13 @@ int pyexe_file_object_io_handle_free(
|
||||
Py_DecRef(
|
||||
( *file_object_io_handle )->file_object );
|
||||
|
||||
PyGILState_Release(
|
||||
gil_state );
|
||||
|
||||
PyMem_Free(
|
||||
*file_object_io_handle );
|
||||
|
||||
*file_object_io_handle = NULL;
|
||||
|
||||
PyGILState_Release(
|
||||
gil_state );
|
||||
}
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
[build-system]
|
||||
requires = ["setuptools", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
[metadata]
|
||||
name = libexe-python
|
||||
version = @VERSION@
|
||||
description = Python bindings module for libexe
|
||||
long_description = Python bindings module for libexe
|
||||
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
|
||||
@@ -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 import setup
|
||||
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 @@ class ProjectInformation(object):
|
||||
"""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")
|
||||
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
|
||||
|
||||
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]
|
||||
self.library_name = library_name
|
||||
found_library_name = True
|
||||
|
||||
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()
|
||||
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 @@ class ProjectInformation(object):
|
||||
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")
|
||||
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(" ")
|
||||
|
||||
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")
|
||||
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 @@ project_information = ProjectInformation()
|
||||
|
||||
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 @@ SOURCES.extend(source_files)
|
||||
# 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 @@ setup(
|
||||
include_dirs=project_information.include_directories,
|
||||
libraries=[],
|
||||
library_dirs=[],
|
||||
sources=SOURCES,
|
||||
),
|
||||
],
|
||||
sources=SOURCES
|
||||
)
|
||||
]
|
||||
)
|
||||
setup(**setup_args)
|
||||
|
||||
|
||||
+3
-3
@@ -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};
|
||||
|
||||
+1
-1
@@ -334,5 +334,5 @@ MAINTAINERCLEANFILES = \
|
||||
Makefile.in
|
||||
|
||||
distclean: clean
|
||||
/bin/rm -f Makefile
|
||||
-rm -f Makefile
|
||||
|
||||
|
||||
Executable
+77
@@ -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 = ".pyexe"
|
||||
input_glob = "*"
|
||||
option_sets = ["offset"]
|
||||
|
||||
|
||||
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)
|
||||
+46
-5
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# Info tool testing script
|
||||
#
|
||||
# Version: 20230410
|
||||
# Version: 20231005
|
||||
|
||||
EXIT_SUCCESS=0;
|
||||
EXIT_FAILURE=1;
|
||||
@@ -9,7 +9,7 @@ EXIT_IGNORE=77;
|
||||
|
||||
PROFILES=("exeinfo");
|
||||
OPTIONS_PER_PROFILE=("");
|
||||
OPTION_SETS="";
|
||||
OPTION_SETS=();
|
||||
|
||||
INPUT_GLOB="*";
|
||||
|
||||
@@ -71,7 +71,7 @@ do
|
||||
|
||||
IGNORE_LIST=$(read_ignore_list "${TEST_PROFILE_DIRECTORY}");
|
||||
|
||||
IFS=" " read -a OPTIONS <<< ${OPTIONS_PER_PROFILE[${PROFILE_INDEX}]};
|
||||
IFS=" " read -a PROFILE_OPTIONS <<< ${OPTIONS_PER_PROFILE[${PROFILE_INDEX}]};
|
||||
|
||||
RESULT=${EXIT_SUCCESS};
|
||||
|
||||
@@ -89,8 +89,49 @@ do
|
||||
fi
|
||||
TEST_SET_DIRECTORY=$(get_test_set_directory "${TEST_PROFILE_DIRECTORY}" "${TEST_SET_INPUT_DIRECTORY}");
|
||||
|
||||
run_test_on_test_set_with_options "${TEST_SET_DIRECTORY}" "exeinfo" "with_stdout_reference" "${OPTION_SETS}" "${TEST_EXECUTABLE}" "${OPTIONS[@]}";
|
||||
RESULT=$?;
|
||||
RESULT=${EXIT_SUCCESS};
|
||||
|
||||
if test -f "${TEST_SET_DIRECTORY}/files";
|
||||
then
|
||||
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
|
||||
TESTED_WITH_OPTIONS=0;
|
||||
|
||||
for OPTION_SET in ${OPTION_SETS[@]};
|
||||
do
|
||||
TEST_DATA_OPTION_FILE=$(get_test_data_option_file "${TEST_SET_DIRECTORY}" "${INPUT_FILE}" "${OPTION_SET}");
|
||||
|
||||
if test -f ${TEST_DATA_OPTION_FILE};
|
||||
then
|
||||
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}" "exeinfo" "with_stdout_reference" "${OPTION_SET}" "${TEST_EXECUTABLE}" "${INPUT_FILE}" "${PROFILE_OPTIONS[@]}" "${OPTIONS[@]}";
|
||||
RESULT=$?;
|
||||
|
||||
if test ${RESULT} -ne ${EXIT_SUCCESS};
|
||||
then
|
||||
break;
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if test ${TESTED_WITH_OPTIONS} -eq 0;
|
||||
then
|
||||
run_test_on_input_file "${TEST_SET_DIRECTORY}" "exeinfo" "with_stdout_reference" "" "${TEST_EXECUTABLE}" "${INPUT_FILE}" "${PROFILE_OPTIONS[@]}";
|
||||
RESULT=$?;
|
||||
fi
|
||||
|
||||
if test ${RESULT} -ne ${EXIT_SUCCESS};
|
||||
then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
|
||||
# Ignore failures due to corrupted data.
|
||||
if test "${TEST_SET}" = "corrupted";
|
||||
|
||||
+43
-36
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# Tests library functions and types.
|
||||
#
|
||||
# Version: 20230410
|
||||
# Version: 20231007
|
||||
|
||||
EXIT_SUCCESS=0;
|
||||
EXIT_FAILURE=1;
|
||||
@@ -9,7 +9,7 @@ EXIT_IGNORE=77;
|
||||
|
||||
LIBRARY_TESTS="data_directory_descriptor debug_data error export_table import_table io_handle le_header mz_header ne_header notify section section_descriptor section_io_handle";
|
||||
LIBRARY_TESTS_WITH_INPUT="file support";
|
||||
OPTION_SETS="";
|
||||
OPTION_SETS=();
|
||||
|
||||
INPUT_GLOB="*";
|
||||
|
||||
@@ -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}/?"`;
|
||||
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=$?;
|
||||
|
||||
if test ${RESULT} -ne ${EXIT_SUCCESS};
|
||||
then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
IFS="" read -a INPUT_FILES <<< $(cat ${TEST_SET_DIRECTORY}/files | sed "s?^?${TEST_SET_INPUT_DIRECTORY}/?");
|
||||
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}";
|
||||
RESULT=$?;
|
||||
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 ${RESULT} -ne ${EXIT_SUCCESS};
|
||||
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
|
||||
local TEST_DATA_OPTION_FILE=$(get_test_data_option_file "${TEST_SET_DIRECTORY}" "${OPTION_INPUT_FILE}" "${OPTION_SET}");
|
||||
|
||||
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
|
||||
fi
|
||||
IFS=${OLDIFS};
|
||||
|
||||
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
|
||||
|
||||
if test ${RESULT} -ne ${EXIT_SUCCESS};
|
||||
then
|
||||
|
||||
+36
-26
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# Tests Python module functions and types.
|
||||
#
|
||||
# Version: 20230410
|
||||
# Version: 20231005
|
||||
|
||||
EXIT_SUCCESS=0;
|
||||
EXIT_FAILURE=1;
|
||||
@@ -9,7 +9,7 @@ EXIT_IGNORE=77;
|
||||
|
||||
TEST_FUNCTIONS="support";
|
||||
TEST_FUNCTIONS_WITH_INPUT="file";
|
||||
OPTION_SETS="";
|
||||
OPTION_SETS=();
|
||||
|
||||
TEST_TOOL_DIRECTORY=".";
|
||||
INPUT_GLOB="*";
|
||||
@@ -68,37 +68,47 @@ test_python_function_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}/?"`;
|
||||
do
|
||||
run_test_on_input_file_with_options "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "default" "${OPTION_SETS}" "${TEST_SCRIPT}" "${INPUT_FILE}";
|
||||
RESULT=$?;
|
||||
|
||||
if test ${RESULT} -ne ${EXIT_SUCCESS};
|
||||
then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
IFS="" read -a INPUT_FILES <<< $(cat ${TEST_SET_DIRECTORY}/files | sed "s?^?${TEST_SET_INPUT_DIRECTORY}/?");
|
||||
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}" "default" "${OPTION_SETS}" "${TEST_SCRIPT}" "${INPUT_FILE}";
|
||||
RESULT=$?;
|
||||
IFS="" read -a INPUT_FILES <<< $(ls -1d ${TEST_SET_INPUT_DIRECTORY}/${INPUT_GLOB});
|
||||
fi
|
||||
for INPUT_FILE in "${INPUT_FILES[@]}";
|
||||
do
|
||||
local TESTED_WITH_OPTIONS=0;
|
||||
|
||||
if test ${RESULT} -ne ${EXIT_SUCCESS};
|
||||
for OPTION_SET in ${OPTION_SETS[@]};
|
||||
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
|
||||
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_SCRIPT}" "${INPUT_FILE}" "${OPTIONS[@]}";
|
||||
RESULT=$?;
|
||||
|
||||
if test ${RESULT} -ne ${EXIT_SUCCESS};
|
||||
then
|
||||
break;
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
IFS=${OLDIFS};
|
||||
|
||||
if test ${TESTED_WITH_OPTIONS} -eq 0;
|
||||
then
|
||||
run_test_on_input_file "${TEST_SET_DIRECTORY}" "${TEST_DESCRIPTION}" "default" "" "${TEST_SCRIPT}" "${INPUT_FILE}";
|
||||
RESULT=$?;
|
||||
fi
|
||||
|
||||
if test ${RESULT} -ne ${EXIT_SUCCESS};
|
||||
then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
|
||||
if test ${RESULT} -ne ${EXIT_SUCCESS};
|
||||
then
|
||||
|
||||
+11
-141
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# Bash functions to run an executable for testing.
|
||||
#
|
||||
# Version: 20230410
|
||||
# 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};
|
||||
}
|
||||
|
||||
|
||||
+43
-36
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# Tests tools functions and types.
|
||||
#
|
||||
# Version: 20230410
|
||||
# Version: 20231007
|
||||
|
||||
EXIT_SUCCESS=0;
|
||||
EXIT_FAILURE=1;
|
||||
@@ -9,7 +9,7 @@ EXIT_IGNORE=77;
|
||||
|
||||
TOOLS_TESTS="info_handle output signal";
|
||||
TOOLS_TESTS_WITH_INPUT="";
|
||||
OPTION_SETS="";
|
||||
OPTION_SETS=();
|
||||
|
||||
INPUT_GLOB="*";
|
||||
|
||||
@@ -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}/?"`;
|
||||
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=$?;
|
||||
|
||||
if test ${RESULT} -ne ${EXIT_SUCCESS};
|
||||
then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
IFS="" read -a INPUT_FILES <<< $(cat ${TEST_SET_DIRECTORY}/files | sed "s?^?${TEST_SET_INPUT_DIRECTORY}/?");
|
||||
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}";
|
||||
RESULT=$?;
|
||||
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 ${RESULT} -ne ${EXIT_SUCCESS};
|
||||
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
|
||||
local TEST_DATA_OPTION_FILE=$(get_test_data_option_file "${TEST_SET_DIRECTORY}" "${OPTION_INPUT_FILE}" "${OPTION_SET}");
|
||||
|
||||
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
|
||||
fi
|
||||
IFS=${OLDIFS};
|
||||
|
||||
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
|
||||
|
||||
if test ${RESULT} -ne ${EXIT_SUCCESS};
|
||||
then
|
||||
|
||||
@@ -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 libexe-python
|
||||
python tests/runtests.py
|
||||
|
||||
Reference in New Issue
Block a user