diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 4191998..3b023b6 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -59,7 +59,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-latest, macos-latest, windows-latest ] # macos-latest arm64, macos-13 intel + os: [ ubuntu-latest, macos-latest, windows-latest, windows-2025-vs2026 ] test_script: ${{ fromJSON(needs.list-test-files.outputs.test-files) }} steps: - name: Checkout Codes @@ -73,10 +73,6 @@ jobs: python-version: 3.14 cache: 'pip' - - name: Add msbuild to PATH - if: runner.os == 'Windows' - uses: microsoft/setup-msbuild@v2 - - name: install run: | pip install pip pytest tabulate regex setuptools build wheel -U @@ -120,44 +116,45 @@ jobs: pip install -v . pytest --durations=0 tests/${{ matrix.test_script }}.py - solaris: - needs: - - list-test-files - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - test_script: ${{ fromJSON(needs.list-test-files.outputs.test-files) }} - steps: - - uses: actions/checkout@v6 - with: - submodules: recursive - ref: ${{ env.ref }} - - - name: clean dir - run: rm -rf .git - - - name: Test in Solaris - uses: vmactions/solaris-vm@v1 - with: - prepare: | - pkg install developer/gcc developer/build/gnu-make developer/build/pkg-config developer/versioning/git web/curl - copyback: false - run: | - curl -V - - echo "==============" - - export LDFLAGS="-L/usr/lib/amd64 -L/usr/lib/64" - export CFLAGS="-m64" - export LD_LIBRARY_PATH="/usr/lib/amd64:${LD_LIBRARY_PATH:-}" - - python -V - python -m venv venv - source venv/bin/activate - pip install pip pytest tabulate regex setuptools build wheel -U - pip install -v . - pytest --durations=0 tests/${{ matrix.test_script }}.py + # unable to fix, disabled + # solaris: + # needs: + # - list-test-files + # runs-on: ubuntu-latest + # strategy: + # fail-fast: false + # matrix: + # test_script: ${{ fromJSON(needs.list-test-files.outputs.test-files) }} + # steps: + # - uses: actions/checkout@v6 + # with: + # submodules: recursive + # ref: ${{ env.ref }} + # + # - name: clean dir + # run: rm -rf .git + # + # - name: Test in Solaris + # uses: vmactions/solaris-vm@v1 + # with: + # prepare: | + # pkg install developer/gcc developer/build/gnu-make developer/build/pkg-config developer/versioning/git web/curl + # copyback: false + # run: | + # curl -V + # + # echo "==============" + # + # export LDFLAGS="-L/usr/lib/amd64 -L/usr/lib/64" + # export CFLAGS="-m64" + # export LD_LIBRARY_PATH="/usr/lib/amd64:${LD_LIBRARY_PATH:-}" + # + # python -V + # python -m venv venv + # source venv/bin/activate + # pip install pip pytest tabulate regex setuptools build wheel -U + # pip install -v . + # pytest --durations=0 tests/${{ matrix.test_script }}.py wsl: needs: diff --git a/README.md b/README.md index 380224d..235bbb7 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Modern `nogil` Python bindings for the Pcre2 library with `stdlib.re` api compat * 02/24/2026 [0.2.10](https://github.com/ModelCloud/PyPcre/releases/tag/v0.2.10): Allow VisualStudio (VS) compiler version check override via env var. * 12/15/2025 [0.2.8](https://github.com/ModelCloud/PyPcre/releases/tag/v0.2.8): Fixed multi-arch Linux os compatibility where both x86_64 and i386 libs of pcre2 are installed. * 10/20/2025 [0.2.4](https://github.com/ModelCloud/PyPcre/releases/tag/v0.2.4): Removed dependency on system having python3-dev packge. python.h will be optimistically downloaded from python.org when needed. -* 10/12/2025 [0.2.3](https://github.com/ModelCloud/PyPcre/releases/tag/v0.2.3): 🤗 Full `GIL=0` compliance for Python >= 3.13T. Reduced cache thread contention. Improved performance for all api. Expanded ci testing coverage. FreeBSD, Solaris, and Windows compatibility validated. +* 10/12/2025 [0.2.3](https://github.com/ModelCloud/PyPcre/releases/tag/v0.2.3): 🤗 Full `GIL=0` compliance for Python >= 3.13T. Reduced cache thread contention. Improved performance for all api. Expanded ci testing coverage. FreeBSD, Solaris and Windows compatibility validated. * 10/09/2025 [0.1.0](https://github.com/ModelCloud/PyPcre/releases/tag/v0.1.0): 🎉 First release. Thread safe, auto JIT, auto pattern caching and optimistic linking to system library for fast install. ## Why PyPcre: @@ -47,7 +47,7 @@ The package prioritizes linking against the `libpcre2-8` shared library in syste ## Platform Support (Validated): -`Linux`, `MacOS`, `Windows`, `WSL`, `FreeBSD`, `Solaris` +`Linux`, `MacOS`, `Windows`, `WSL`, `FreeBSD` ## Usage @@ -280,7 +280,7 @@ When `pkg-config` is available the build will automatically pick up the required include and link flags via `pkg-config --cflags/--libs libpcre2-8`. Without `pkg-config`, the build script scans common installation prefixes for Linux distributions (Debian, Ubuntu, Fedora/RHEL/CentOS, openSUSE, Alpine), -FreeBSD, macOS (including Homebrew), and Solaris to locate the headers and +FreeBSD and macOS (including Homebrew) to locate the headers and libraries. If your system ships `libpcre2-8` under `/usr` but you also maintain a diff --git a/pyproject.toml b/pyproject.toml index def3ef3..9bf0001 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta" [project] name = "PyPcre" -version = "0.2.12" +version = "0.2.13" description = "Modern, GIL-friendly, Fast Python bindings for PCRE2 with auto caching and JIT of compiled patterns." readme = "README.md" requires-python = ">=3.9" diff --git a/setup_utils.py b/setup_utils.py index 30a9e3e..da13a7f 100644 --- a/setup_utils.py +++ b/setup_utils.py @@ -481,7 +481,11 @@ def _find_vswhere(): def _detect_vs_generator(): vswhere = _find_vswhere() if not vswhere: - return None + raise RuntimeError( + "unable to find vswhere.exe\n" + "Please install Visual Studio Build Tools:\n" + f"{VS_DOWNLOAD_URL}" + ) result = subprocess.run( [ @@ -497,33 +501,41 @@ def _detect_vs_generator(): ) if result.returncode != 0: - return None + raise RuntimeError( + f"vswhere failed.\n" + f"exit code: {result.returncode}\n" + f"stdout: {result.stdout.strip()}\n" + f"stderr: {result.stderr.strip()}\n" + ) + + try: + data = json.loads(result.stdout or "[]") + except json.JSONDecodeError as e: + raise RuntimeError( + f"unable to parse vswhere output. Output: {result.stdout}" + ) from e - data = json.loads(result.stdout or "[]") if not data: - return None + raise RuntimeError(f"vswhere cannot find a valid VS installation: {result.stdout}") info = data[0] ver = info.get("installationVersion", "") major = ver.split(".")[0] - year = info.get("catalog", {}).get("productLineVersion") - - if not year: - year_map = { - "15": "2017", - "16": "2019", - "17": "2022", - "18": "2026", - } - year = year_map.get(major) + year_map = { + "15": "2017", + "16": "2019", + "17": "2022", + "18": "2026", + } + year = year_map.get(str(major)) if year: return f"Visual Studio {major} {year}" raise RuntimeError( - f"Unknown Visual Studio version: installationVersion={ver}, major={major}, year={year}" + f"Unknown Visual Studio version: installationVersion={ver}, major={major}, year={year}. vswhere result: {result.stdout}" ) @@ -637,12 +649,6 @@ def _has_built_library() -> bool: # On Windows, force MSVC and the /MD runtime. Never let CMake pick MinGW. if _is_windows_platform(): vs_gen = os.environ.get("CMAKE_GENERATOR", _detect_vs_generator()) - if not vs_gen: - raise RuntimeError( - "Visual Studio not found.\n" - "Please install Visual Studio Build Tools:\n" - f"{VS_DOWNLOAD_URL}" - ) cmake_args += [ "-G", vs_gen, "-A", "x64",