From f799473ba092a175fd4ed10d73d647fa780e3065 Mon Sep 17 00:00:00 2001 From: Joachim Metz Date: Sun, 4 Feb 2024 06:09:44 +0100 Subject: [PATCH] Applied updates --- appveyor.yml | 88 +++++++++++++++++++++++++++++++------ autogen.ps1 | 25 ++++++----- configure.ac | 2 +- tests/test_python_module.sh | 16 +++++-- tox.ini | 13 +++++- 5 files changed, 113 insertions(+), 31 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index d89cd0d..fe1a0ed 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -115,14 +115,66 @@ environment: CFLAGS: "-I/usr/local/include" LDFLAGS: "-L/usr/local/lib" CONFIGURE_OPTIONS: "--disable-dependency-tracking --prefix=/usr/local --enable-python --with-pyprefix" - - TARGET: python311 - BUILD_ENVIRONMENT: python + - TARGET: windows-tox-py38-32bit + BUILD_ENVIRONMENT: python-tox + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 + PYTHON: "C:\\Python38\\python.exe" + PYTHON_VERSION: 3.8 + TOXENV: py38 + - TARGET: windows-tox-py38-64bit + BUILD_ENVIRONMENT: python-tox + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 + PYTHON: "C:\\Python38-x64\\python.exe" + PYTHON_VERSION: 3.8 + TOXENV: py38 + - TARGET: windows-tox-py39-32bit + BUILD_ENVIRONMENT: python-tox + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 + PYTHON: "C:\\Python39\\python.exe" + PYTHON_VERSION: 3.9 + TOXENV: py39 + - TARGET: windows-tox-py39-64bit + BUILD_ENVIRONMENT: python-tox + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 + PYTHON: "C:\\Python39-x64\\python.exe" + PYTHON_VERSION: 3.9 + TOXENV: py39 + - TARGET: windows-tox-py310-32bit + BUILD_ENVIRONMENT: python-tox + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 + PYTHON: "C:\\Python310\\python.exe" + PYTHON_VERSION: 3.10 + TOXENV: py310 + - TARGET: windows-tox-py310-64bit + BUILD_ENVIRONMENT: python-tox + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 + PYTHON: "C:\\Python310-x64\\python.exe" + PYTHON_VERSION: 3.10 + TOXENV: py310 + - TARGET: windows-tox-py311-32bit + BUILD_ENVIRONMENT: python-tox APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 PYTHON: "C:\\Python311\\python.exe" - - TARGET: python311-x64 - BUILD_ENVIRONMENT: python + PYTHON_VERSION: 3.11 + TOXENV: py311 + - TARGET: windows-tox-py311-64bit + BUILD_ENVIRONMENT: python-tox APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 PYTHON: "C:\\Python311-x64\\python.exe" + PYTHON_VERSION: 3.11 + TOXENV: py311 + - TARGET: windows-tox-py312-32bit + BUILD_ENVIRONMENT: python-tox + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 + PYTHON: "C:\\Python312\\python.exe" + PYTHON_VERSION: 3.12 + TOXENV: py312 + - TARGET: windows-tox-py312-64bit + BUILD_ENVIRONMENT: python-tox + APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 + PYTHON: "C:\\Python312-x64\\python.exe" + PYTHON_VERSION: 3.12 + TOXENV: py312 - TARGET: macos-tox-py38 BUILD_ENVIRONMENT: python-tox APPVEYOR_BUILD_WORKER_IMAGE: macos-monterey @@ -153,6 +205,12 @@ environment: HOMEBREW_NO_INSTALL_CLEANUP: 1 PYTHON_VERSION: 3.12 TOXENV: py312 + - TARGET: linux-tox-py310 + BUILD_ENVIRONMENT: python-tox + APPVEYOR_BUILD_WORKER_IMAGE: ubuntu2204 + PYTHON_VERSION: 3.10 + TOXENV: py310 + AUDITWHEEL_PLAT: manylinux_2_35_x86_64 - TARGET: cygwin64-gcc BUILD_ENVIRONMENT: cygwin64 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022 @@ -191,11 +249,12 @@ environment: install: - cmd: if [%BUILD_ENVIRONMENT%]==[msbuild] ( git clone https://github.com/libyal/vstools.git ..\vstools ) -- sh: if test ${BUILD_ENVIRONMENT} = "python-tox" || test ${BUILD_ENVIRONMENT} = "xcode"; then brew update-reset && brew update -q; fi -- sh: if test ${BUILD_ENVIRONMENT} = "python-tox" || test ${BUILD_ENVIRONMENT} = "xcode"; then brew install -q autoconf automake gettext gnu-sed libtool pkg-config || true; fi -- sh: if test ${BUILD_ENVIRONMENT} = "python-tox"; then brew install -q python@${PYTHON_VERSION} tox twine-pypi || true; fi -- cmd: if [%BUILD_ENVIRONMENT%]==[python] ( - "%PYTHON%" -m pip install -U pip setuptools twine wheel ) +- sh: if ( test `uname -s` = "Darwin" && test ${BUILD_ENVIRONMENT} = "python-tox" ) || test ${BUILD_ENVIRONMENT} = "xcode"; then brew update-reset && brew update -q; fi +- sh: if ( test `uname -s` = "Darwin" && test ${BUILD_ENVIRONMENT} = "python-tox" ) || test ${BUILD_ENVIRONMENT} = "xcode"; then brew install -q autoconf automake gettext gnu-sed libtool pkg-config || true; fi +- cmd: if [%BUILD_ENVIRONMENT%]==[python-tox] ( + "%PYTHON%" -m pip install -U tox twine ) +- sh: if test `uname -s` = "Darwin" && test ${BUILD_ENVIRONMENT} = "python-tox"; then brew install -q python@${PYTHON_VERSION} tox twine-pypi || true; fi +- sh: if test `uname -s` = "Linux" && test ${BUILD_ENVIRONMENT} = "python-tox"; then sudo apt-get update && sudo apt-get -y install autoconf automake autopoint build-essential git libtool patchelf pkg-config python3 python3-dev python3-distutils python3-pip python3-setuptools tox twine; fi - ps: If ($env:BUILD_ENVIRONMENT -eq "cygwin64") { (New-Object Net.WebClient).DownloadFile("https://cygwin.com/setup-x86_64.exe", "C:\\cygwin64\\setup-x86_64.exe") } - cmd: if [%BUILD_ENVIRONMENT%]==[cygwin64] ( @@ -206,7 +265,7 @@ install: $ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile ..\codecov.exe } build_script: -- ps: If ($env:BUILD_ENVIRONMENT -eq "msbuild" -or ($env:BUILD_ENVIRONMENT -eq "python" -and $isWindows)) { +- ps: If ($env:BUILD_ENVIRONMENT -eq "msbuild" -or ($env:BUILD_ENVIRONMENT -eq "python-tox" -and $isWindows)) { .\synclibs.ps1; .\autogen.ps1 } - ps: If ($env:TARGET -eq "vs2008") { @@ -218,9 +277,10 @@ build_script: - ps: If ($env:TARGET -eq "vs2022-python") { .\build.ps1 -VisualStudioVersion $env:TARGET.Substring(2, 4) -Configuration $env:CONFIGURATION -Platform $env:PLATFORM -PythonPath $env:PYTHON_PATH -VSToolsOptions "--extend-with-x64 --python-path $env:PYTHON_PATH --with-dokany" } - 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 sources >/dev/null && tox -e${TOXENV}; fi +- cmd: if [%BUILD_ENVIRONMENT%]==[python-tox] ( + "%PYTHON%" -m tox -e%TOXENV% ) +- sh: if test `uname -s` = "Darwin" && 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 +- sh: if test `uname -s` = "Linux" && test ${BUILD_ENVIRONMENT} = "python-tox"; then ./synclibs.sh && ./autogen.sh && ./configure --disable-nls --disable-shared-libs && make sources >/dev/null && tox -e${TOXENV} && tox -eauditwheel -- --plat ${AUDITWHEEL_PLAT} dist/*.whl && rm -f dist/*.whl && mv wheelhouse/*.whl dist/; fi - cmd: if [%BUILD_ENVIRONMENT%]==[cygwin64] ( xcopy /i /q /s C:\projects\libevtx C:\cygwin64\home\appveyor\libevtx && C:\cygwin64\bin\bash -e -l -c "cd libevtx && 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'" && @@ -252,7 +312,7 @@ artifacts: - path: dist\*.whl deploy_script: -- ps: If ($env:APPVEYOR_REPO_TAG -eq "true" -and $isWindows -and $env:BUILD_ENVIRONMENT -eq "python") { +- ps: If ($env:APPVEYOR_REPO_TAG -eq "true" -and $isWindows -and $env:BUILD_ENVIRONMENT -eq "python-tox") { Invoke-Expression "${env:PYTHON} -m twine upload dist/*.whl --username __token__ --password ${env:PYPI_TOKEN} --skip-existing" } - sh: if test ${APPVEYOR_REPO_TAG} = "true" && test ${BUILD_ENVIRONMENT} = "python-tox"; then twine upload dist/*.whl --username __token__ --password ${PYPI_TOKEN} --skip-existing; fi diff --git a/autogen.ps1 b/autogen.ps1 index ed2049a..520fdb8 100644 --- a/autogen.ps1 +++ b/autogen.ps1 @@ -1,6 +1,6 @@ # Script to generate the necessary files for a msvscpp build # -# Version: 20230104 +# Version: 20230118 $WinFlex = "..\win_flex_bison\win_flex.exe" $WinBison = "..\win_flex_bison\win_bison.exe" @@ -9,17 +9,22 @@ $Library = Get-Content -Path configure.ac | select -skip 3 -first 1 | % { $_ -Re $Version = Get-Content -Path configure.ac | select -skip 4 -first 1 | % { $_ -Replace " \[","" } | % { $_ -Replace "\],","" } $Prefix = ${Library}.Substring(3) -Get-Content -Path "include\${Library}.h.in" > "include\${Library}.h" -Get-Content -Path "include\${Library}\definitions.h.in" | % { $_ -Replace "@VERSION@","${Version}" } > "include\${Library}\definitions.h" -Get-Content -Path "include\${Library}\features.h.in" | % { $_ -Replace "@[A-Z0-9_]*@","0" } > "include\${Library}\features.h" -Get-Content -Path "include\${Library}\types.h.in" | % { $_ -Replace "@[A-Z0-9_]*@","0" } > "include\${Library}\types.h" -Get-Content -Path "common\types.h.in" | % { $_ -Replace "@PACKAGE@","${Library}" } > "common\types.h" -Get-Content -Path "${Library}\${Library}_definitions.h.in" | % { $_ -Replace "@VERSION@","${Version}" } > "${Library}\${Library}_definitions.h" -Get-Content -Path "${Library}\${Library}.rc.in" | % { $_ -Replace "@VERSION@","${Version}" } > "${Library}\${Library}.rc" +Get-Content -Path "include\${Library}.h.in" | Out-File -Encoding ascii "include\${Library}.h" +Get-Content -Path "include\${Library}\definitions.h.in" | % { $_ -Replace "@VERSION@","${Version}" } | Out-File -Encoding ascii "include\${Library}\definitions.h" +Get-Content -Path "include\${Library}\features.h.in" | % { $_ -Replace "@[A-Z0-9_]*@","0" } | Out-File -Encoding ascii "include\${Library}\features.h" +Get-Content -Path "include\${Library}\types.h.in" | % { $_ -Replace "@[A-Z0-9_]*@","0" } | Out-File -Encoding ascii "include\${Library}\types.h" +Get-Content -Path "common\types.h.in" | % { $_ -Replace "@PACKAGE@","${Library}" } | Out-File -Encoding ascii "common\types.h" +Get-Content -Path "${Library}\${Library}_definitions.h.in" | % { $_ -Replace "@VERSION@","${Version}" } | Out-File -Encoding ascii "${Library}\${Library}_definitions.h" +Get-Content -Path "${Library}\${Library}.rc.in" | % { $_ -Replace "@VERSION@","${Version}" } | Out-File -Encoding ascii "${Library}\${Library}.rc" + +If (Test-Path "setup.cfg.in") +{ + Get-Content -Path "setup.cfg.in" | % { $_ -Replace "@VERSION@","${Version}" } | Out-File -Encoding ascii "setup.cfg" +} If (Test-Path "${Prefix}.net") { - Get-Content -Path "${Prefix}.net\${Prefix}.net.rc.in" | % { $_ -Replace "@VERSION@","${Version}" } > "${Prefix}.net\${Prefix}.net.rc" + Get-Content -Path "${Prefix}.net\${Prefix}.net.rc.in" | % { $_ -Replace "@VERSION@","${Version}" } | Out-File -Encoding ascii "${Prefix}.net\${Prefix}.net.rc" } $NamePrefix = "" @@ -38,7 +43,7 @@ ForEach (${DirectoryElement} in Get-ChildItem -Path "${Library}\*.l") $Output = Invoke-Expression -Command "& '${WinFlex}' -Cf ${DirectoryElement} 2>&1" Write-Host ${Output} - # Moving manually since win_flex -o does not provide the expected behavior. + # Moving manually since `win_flex -o filename' does not provide the expected behavior. Move-Item "lex.yy.c" ${OutputFile} -force } diff --git a/configure.ac b/configure.ac index a4f8484..5dacbd8 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ([2.71]) AC_INIT( [libevtx], - [20240101], + [20240204], [joachim.metz@gmail.com]) AC_CONFIG_SRCDIR( diff --git a/tests/test_python_module.sh b/tests/test_python_module.sh index 3befc38..de0d25d 100755 --- a/tests/test_python_module.sh +++ b/tests/test_python_module.sh @@ -1,10 +1,11 @@ #!/usr/bin/env bash # Tests Python module functions and types. # -# Version: 20231005 +# Version: 20240120 EXIT_SUCCESS=0; EXIT_FAILURE=1; +EXIT_NO_TESTS_RAN=5; EXIT_IGNORE=77; TEST_FUNCTIONS="support"; @@ -147,7 +148,11 @@ do test_python_function "${TEST_FUNCTION}"; RESULT=$?; - if test ${RESULT} -ne ${EXIT_SUCCESS}; + if test ${RESULT} -eq ${EXIT_NO_TESTS_RAN}; + then + RESULT=${EXIT_IGNORE}; + fi + if test ${RESULT} -ne ${EXIT_SUCCESS} && test ${RESULT} -ne ${EXIT_IGNORE}; then break; fi @@ -168,8 +173,11 @@ do test_python_function "${TEST_FUNCTION}"; RESULT=$?; fi - - if test ${RESULT} -ne ${EXIT_SUCCESS}; + if test ${RESULT} -eq ${EXIT_NO_TESTS_RAN}; + then + RESULT=${EXIT_IGNORE}; + fi + if test ${RESULT} -ne ${EXIT_SUCCESS} && test ${RESULT} -ne ${EXIT_IGNORE}; then break; fi diff --git a/tox.ini b/tox.ini index d24d91f..1c6c2b1 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py3{7,8,9,10,11,12} +envlist = auditwheel,py3{7,8,9,10,11,12} [testenv] usedevelop = True @@ -12,9 +12,18 @@ passenv = LIB deps = build - setuptools + setuptools >= 65 wheel commands = python -m build --no-isolation --outdir=dist --wheel python -m pip install --no-index --find-links=dist libevtx-python python tests/runtests.py + +[testenv:auditwheel] +usedevelop = True +pip_pre = True +deps = + auditwheel + setuptools >= 65 +commands = + python -m auditwheel repair {posargs}