Skip to content

Commit

Permalink
Applied updates
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz committed Feb 4, 2024
1 parent ba6d6ad commit f799473
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 31 deletions.
88 changes: 74 additions & 14 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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] (
Expand All @@ -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") {
Expand All @@ -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'" &&
Expand Down Expand Up @@ -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

25 changes: 15 additions & 10 deletions autogen.ps1
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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 = ""
Expand All @@ -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 <filename> 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
}

Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ AC_PREREQ([2.71])

AC_INIT(
[libevtx],
[20240101],
[20240204],
[[email protected]])

AC_CONFIG_SRCDIR(
Expand Down
16 changes: 12 additions & 4 deletions tests/test_python_module.sh
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
13 changes: 11 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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}

0 comments on commit f799473

Please sign in to comment.