From 95ceb45c0e84deef2fc4ba1d97ac8a485e869c5c Mon Sep 17 00:00:00 2001 From: pexarkh <40366153+pexarkh@users.noreply.github.com> Date: Mon, 22 Sep 2025 17:13:49 -0400 Subject: [PATCH 1/8] DA-6842: test build --- .github/workflows/build.yml | 261 ++++++++++++++++++------------------ 1 file changed, 128 insertions(+), 133 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 75e607f..17f9aa9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,15 +2,10 @@ name: Build Pacparser on: push: - branches: [main] - paths: - - "src/**" - - ".github/**" - - Makefile - - Dockerfile + branches: + - preveil + - pavel/* pull_request: - release: - types: [published] workflow_dispatch: inputs: tag: @@ -80,56 +75,54 @@ jobs: if: ${{ matrix.os == 'windows-latest' }} run: | make -C src -f Makefile.win32 dist + ls -R src/*.zip - - name: Upload dist (non-windows) - if: ${{ matrix.os != 'windows-latest' }} - uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 - with: - name: pacparser-dist-${{ matrix.os }} - path: src/pacparser*.zip - - - name: Upload dist (windows) - if: ${{ matrix.os == 'windows-latest' }} - uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 - with: - name: pacparser-dist-${{ matrix.os }} - path: src/dist - - build-release-binaries: - needs: build - runs-on: ubuntu-latest - steps: - - name: Download ubuntu cloudprober binaries - uses: actions/download-artifact@v4 - with: - pattern: pacparser-dist-* - - - name: Fix files - run: | - ls -R . - mv pacparser-dist-*/*.zip . - file=$(ls pacparser-*-ubuntu*.zip) - name=${file/ubuntu/windows} - name=${name/.zip/} - mv pacparser-dist-windows-latest $name - zip -r $name.zip $name - - - name: Upload pacparser release - uses: actions/upload-artifact@v4 - with: - name: pacparser-release-binaries - path: pacparser-*.zip + # - name: Upload dist (non-windows) + # if: ${{ matrix.os != 'windows-latest' }} + # uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 + # with: + # name: pacparser-dist-${{ matrix.os }} + # path: src/pacparser*.zip + + # - name: Upload dist (windows) + # if: ${{ matrix.os == 'windows-latest' }} + # uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 + # with: + # name: pacparser-dist-${{ matrix.os }} + # path: src/dist + + # build-release-binaries: + # needs: build + # runs-on: ubuntu-latest + # steps: + # - name: Download ubuntu cloudprober binaries + # uses: actions/download-artifact@v4 + # with: + # pattern: pacparser-dist-* + + # - name: Fix files + # run: | + # ls -R . + # mv pacparser-dist-*/*.zip . + # file=$(ls pacparser-*-ubuntu*.zip) + # name=${file/ubuntu/windows} + # name=${name/.zip/} + # mv pacparser-dist-windows-latest $name + # zip -r $name.zip $name + + # - name: Upload pacparser release + # uses: actions/upload-artifact@v4 + # with: + # name: pacparser-release-binaries + # path: pacparser-*.zip python-module-build: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-13] - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.12"] architecture: [x64] include: - - os: macos-latest - python-version: "3.11" - architecture: arm64 - os: macos-latest python-version: "3.12" architecture: arm64 @@ -161,18 +154,21 @@ jobs: - name: make non-windows if: ${{ matrix.os != 'windows-latest' }} - run: make -C src pymod-dist + run: | + make -C src pymod-dist + ls -R src/*.zip - name: make windows if: ${{ matrix.os == 'windows-latest' }} - run: make -C src -f Makefile.win32 pymod-dist + run: | + make -C src -f Makefile.win32 pymod-dist + ls -R src/*.zip - - name: Upload dist - uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 - with: - name: - pacparser-python-${{ matrix.python-version }}-${{ matrix.os }}-dist - path: src/pymod/pacparser-python* + # - name: Upload dist + # uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 + # with: + # name: pacparser-python-${{ matrix.python-version }}-${{ matrix.os }}-dist + # path: src/pymod/pacparser-python* - name: Build wheel non-linux if: ${{ matrix.os != 'ubuntu-latest' }} @@ -180,26 +176,26 @@ jobs: python -m pip install wheel cd src/pymod && python setup.py bdist_wheel - - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 - id: src_changes - with: - filters: | - changed: - - 'src/**' - - - name: Publish package to PyPI (non-linux) - if: | - (matrix.os != 'ubuntu-latest') && - (steps.src_changes.outputs.changed == 'true' || - startsWith(github.event.inputs.tag, 'v') || startsWith(github.ref, - 'refs/tags/v')) && (github.event_name != 'pull_request') - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI }} - run: | - python -m pip install twine - ls -R . - twine upload src/pymod/dist/* + # - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 + # id: src_changes + # with: + # filters: | + # changed: + # - 'src/**' + + # - name: Publish package to PyPI (non-linux) + # if: | + # (matrix.os != 'ubuntu-latest') && + # (steps.src_changes.outputs.changed == 'true' || + # startsWith(github.event.inputs.tag, 'v') || startsWith(github.ref, + # 'refs/tags/v')) && (github.event_name != 'pull_request') + # env: + # TWINE_USERNAME: __token__ + # TWINE_PASSWORD: ${{ secrets.PYPI }} + # run: | + # python -m pip install twine + # ls -R . + # twine upload src/pymod/dist/* build-linux-wheels: runs-on: ubuntu-latest @@ -219,8 +215,7 @@ jobs: - name: Set env run: | - echo "PACPARSER_VERSION=$(git describe --always --tags \ - --candidate=100)" >> $GITHUB_ENV + echo "PACPARSER_VERSION=$(git describe --always --tags --candidate=100)" >> $GITHUB_ENV - name: Set up Python uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 @@ -247,56 +242,56 @@ jobs: CIBW_BUILD: "cp{37,38,39,310,311,312}-manylinux*64" CIBW_ENVIRONMENT: "PACPARSER_VERSION=${{ env.PACPARSER_VERSION }}" - - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 - id: src_changes - with: - filters: | - changed: - - 'src/**' - - - name: Publish package to PyPI - if: | - startsWith(github.event.inputs.tag, 'v') || - startsWith(github.ref,'refs/tags/v') ||steps.src_changes.outputs.changed == 'true' - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI }} - run: | - twine upload src/pymod/dist/* - - build_and_push_docker_multiarch: - name: Build and push multiarch docker image - if: | - github.repository == 'manugarg/pacparser' && - (github.ref == 'refs/heads/main' || startswith(github.ref, 'refs/heads/docker') || - startsWith(github.ref, 'refs/tags/v')) - runs-on: ubuntu-latest - steps: - - name: Check out code into the Go module directory - if: ${{ !contains(github.event_name, 'workflow_dispatch') }} - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Check out code into the Go module directory - if: ${{ contains(github.event_name, 'workflow_dispatch') }} - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: ${{ github.event.inputs.tag }} - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to GHCR - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push release Docker Image (main-ghcr) - run: make docker_multiarch DOCKER_IMAGE=ghcr.io/manugarg/pactester + # - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 + # id: src_changes + # with: + # filters: | + # changed: + # - 'src/**' + + # - name: Publish package to PyPI + # if: | + # startsWith(github.event.inputs.tag, 'v') || + # startsWith(github.ref,'refs/tags/v') ||steps.src_changes.outputs.changed == 'true' + # env: + # TWINE_USERNAME: __token__ + # TWINE_PASSWORD: ${{ secrets.PYPI }} + # run: | + # twine upload src/pymod/dist/* + + # build_and_push_docker_multiarch: + # name: Build and push multiarch docker image + # if: | + # github.repository == 'manugarg/pacparser' && + # (github.ref == 'refs/heads/main' || startswith(github.ref, 'refs/heads/docker') || + # startsWith(github.ref, 'refs/tags/v')) + # runs-on: ubuntu-latest + # steps: + # - name: Check out code into the Go module directory + # if: ${{ !contains(github.event_name, 'workflow_dispatch') }} + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + + # - name: Check out code into the Go module directory + # if: ${{ contains(github.event_name, 'workflow_dispatch') }} + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # ref: ${{ github.event.inputs.tag }} + + # - name: Set up QEMU + # uses: docker/setup-qemu-action@v3 + + # - name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v3 + + # - name: Login to GHCR + # uses: docker/login-action@v3 + # with: + # registry: ghcr.io + # username: ${{ github.repository_owner }} + # password: ${{ secrets.GITHUB_TOKEN }} + + # - name: Build and push release Docker Image (main-ghcr) + # run: make docker_multiarch DOCKER_IMAGE=ghcr.io/manugarg/pactester From 197c29f71e60a2ca8d7cb8a4a07669db5a5975f1 Mon Sep 17 00:00:00 2001 From: pexarkh <40366153+pexarkh@users.noreply.github.com> Date: Mon, 22 Sep 2025 20:59:48 -0400 Subject: [PATCH 2/8] DA-6842 --- .github/workflows/build.yml | 138 ++++++++++++++++++------------------ 1 file changed, 69 insertions(+), 69 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 17f9aa9..382596e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,10 +20,10 @@ jobs: build: strategy: matrix: - os: [ubuntu-latest, windows-latest, macos-13, macos-latest] + os: [windows-latest, macos-13, macos-latest] # ubuntu-latest include: - - os: ubuntu-latest - os_suffix: "ubuntu-x86_64" + # - os: ubuntu-latest + # os_suffix: "ubuntu-x86_64" - os: macos-latest os_suffix: "macos-arm64" - os: macos-13 @@ -33,14 +33,14 @@ jobs: runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: actions/checkout@v5 if: ${{ !contains(github.event_name, 'workflow_dispatch') }} with: fetch-depth: 0 - name: Check out code for workflow_dispatch if: ${{ contains(github.event_name, 'workflow_dispatch') }} - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + uses: actions/checkout@v5 with: fetch-depth: 0 ref: ${{ github.event.inputs.tag }} @@ -77,19 +77,19 @@ jobs: make -C src -f Makefile.win32 dist ls -R src/*.zip - # - name: Upload dist (non-windows) - # if: ${{ matrix.os != 'windows-latest' }} - # uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 - # with: - # name: pacparser-dist-${{ matrix.os }} - # path: src/pacparser*.zip + - name: Upload artifacts (non-windows) + if: ${{ matrix.os != 'windows-latest' }} + uses: actions/upload-artifact@v4 + with: + name: pacparser-dist-${{ matrix.os }} + path: src/pacparser*.zip - # - name: Upload dist (windows) - # if: ${{ matrix.os == 'windows-latest' }} - # uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 - # with: - # name: pacparser-dist-${{ matrix.os }} - # path: src/dist + - name: Upload dist (windows) + if: ${{ matrix.os == 'windows-latest' }} + uses: actions/upload-artifact@v4 + with: + name: pacparser-dist-${{ matrix.os }} + path: src/dist # build-release-binaries: # needs: build @@ -197,67 +197,67 @@ jobs: # ls -R . # twine upload src/pymod/dist/* - build-linux-wheels: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - if: ${{ !contains(github.event_name, 'workflow_dispatch') }} - with: - fetch-depth: 0 - - - name: Check out code for workflow_dispatch - if: ${{ contains(github.event_name, 'workflow_dispatch') }} - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - fetch-depth: 0 - ref: ${{ github.event.inputs.tag }} + # build-linux-wheels: + # runs-on: ubuntu-latest - - name: Set env - run: | - echo "PACPARSER_VERSION=$(git describe --always --tags --candidate=100)" >> $GITHUB_ENV + # steps: + # - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + # if: ${{ !contains(github.event_name, 'workflow_dispatch') }} + # with: + # fetch-depth: 0 - - name: Set up Python - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 + # - name: Check out code for workflow_dispatch + # if: ${{ contains(github.event_name, 'workflow_dispatch') }} + # uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + # with: + # fetch-depth: 0 + # ref: ${{ github.event.inputs.tag }} - - name: Set up setuptools - run: | - python --version - python -mpip install setuptools + # - name: Set env + # run: | + # echo "PACPARSER_VERSION=$(git describe --always --tags --candidate=100)" >> $GITHUB_ENV - - name: make - run: make -C src pymod + # - name: Set up Python + # uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 - - name: Build sdist - run: cd src/pymod && python setup.py sdist + # - name: Set up setuptools + # run: | + # python --version + # python -mpip install setuptools - - name: Install cibuildwheel and twine - run: python -m pip install cibuildwheel twine + # - name: make + # run: make -C src pymod - - name: Build wheel using cibuildwheel - run: | - cp src/spidermonkey/libjs.a src/pacparser.o src/pacparser.h src/pymod - cd src/pymod && python -m cibuildwheel --output-dir dist - env: - CIBW_BUILD: "cp{37,38,39,310,311,312}-manylinux*64" - CIBW_ENVIRONMENT: "PACPARSER_VERSION=${{ env.PACPARSER_VERSION }}" + # - name: Build sdist + # run: cd src/pymod && python setup.py sdist - # - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 - # id: src_changes - # with: - # filters: | - # changed: - # - 'src/**' + # - name: Install cibuildwheel and twine + # run: python -m pip install cibuildwheel twine - # - name: Publish package to PyPI - # if: | - # startsWith(github.event.inputs.tag, 'v') || - # startsWith(github.ref,'refs/tags/v') ||steps.src_changes.outputs.changed == 'true' - # env: - # TWINE_USERNAME: __token__ - # TWINE_PASSWORD: ${{ secrets.PYPI }} - # run: | - # twine upload src/pymod/dist/* + # - name: Build wheel using cibuildwheel + # run: | + # cp src/spidermonkey/libjs.a src/pacparser.o src/pacparser.h src/pymod + # cd src/pymod && python -m cibuildwheel --output-dir dist + # env: + # CIBW_BUILD: "cp{37,38,39,310,311,312}-manylinux*64" + # CIBW_ENVIRONMENT: "PACPARSER_VERSION=${{ env.PACPARSER_VERSION }}" + + # - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 + # id: src_changes + # with: + # filters: | + # changed: + # - 'src/**' + + # - name: Publish package to PyPI + # if: | + # startsWith(github.event.inputs.tag, 'v') || + # startsWith(github.ref,'refs/tags/v') ||steps.src_changes.outputs.changed == 'true' + # env: + # TWINE_USERNAME: __token__ + # TWINE_PASSWORD: ${{ secrets.PYPI }} + # run: | + # twine upload src/pymod/dist/* # build_and_push_docker_multiarch: # name: Build and push multiarch docker image From f20c20ead2224d1a6169ffec4145183481427ea6 Mon Sep 17 00:00:00 2001 From: pexarkh <40366153+pexarkh@users.noreply.github.com> Date: Tue, 23 Sep 2025 18:22:59 -0400 Subject: [PATCH 3/8] DA-6842 --- src/Makefile | 19 +++++++++++++------ tools/buildmac.sh | 24 ++++++++++++++++++++++++ tools/cleanmac.sh | 16 ++++++++++++++++ 3 files changed, 53 insertions(+), 6 deletions(-) create mode 100755 tools/buildmac.sh create mode 100755 tools/cleanmac.sh diff --git a/src/Makefile b/src/Makefile index 3f7e6a5..5b8fdf2 100644 --- a/src/Makefile +++ b/src/Makefile @@ -27,12 +27,14 @@ SHELL := /usr/local/bin/bash else SHELL := /bin/bash endif +$(info SHELL = $(SHELL)) VERSION ?= $(shell git describe --always --tags --candidate=100) - -GIT_TAG := $(shell git describe --exact-match --exclude tip --tags HEAD 2>/dev/null || /bin/true) - +$(info VERSION = $(VERSION)) +GIT_TAG := $(shell git describe --exact-match --exclude tip --tags HEAD 2>/dev/null || true) +$(info GIT_TAG = $(GIT_TAG)) OS_ARCH := $(subst /,_,$(shell uname -s | sed /\ /s//_/)) +$(info OS_ARCH = $(OS_ARCH)) LIBRARY_NAME = libpacparser LIB_VER = 1 @@ -57,9 +59,9 @@ endif ifeq ($(OS_ARCH),Darwin) PREFIX ?= /usr/local - MAC_MAJOR_VERSION := $(shell sw_vers -productVersion | cut -d. -f1) - MAC_MAJOR_VERSION := 11.0 - MAC_GT_OS11 := $(shell [ $(MAC_MAJOR_VERSION) -le 10 ] && echo false) + #MAC_MAJOR_VERSION := $(shell sw_vers -productVersion | cut -d. -f1) + MAC_MAJOR_VERSION := 11 + MAC_GT_OS11 := $(shell [ $(MAC_MAJOR_VERSION) -gt 11 ] && echo true || echo false) SO_SUFFIX = dylib LIBRARY = $(LIBRARY_NAME).$(LIB_VER).$(SO_SUFFIX) MKSHLIB = $(CC) -dynamiclib -framework System @@ -83,11 +85,16 @@ ifndef PYTHON PYTHON = python endif +$(info LIBRARY = $(LIBRARY)) +$(info LIB_OPTS = $(LIB_OPTS)) + # Spidermonkey library. MAINT_CFLAGS += -Ispidermonkey/js/src LIBRARY_LINK = $(LIBRARY_NAME).$(SO_SUFFIX) PREFIX := $(DESTDIR)$(PREFIX) +$(info PREFIX = $(PREFIX)) + LIB_PREFIX = $(PREFIX)/lib INC_PREFIX = $(PREFIX)/include BIN_PREFIX = $(PREFIX)/bin diff --git a/tools/buildmac.sh b/tools/buildmac.sh new file mode 100755 index 0000000..879acc7 --- /dev/null +++ b/tools/buildmac.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +set -euxo pipefail + +# ver=$1 +# [ -z $ver ] && echo "Please specify package version." && exit + +# $stage_dir is where we'll install our package files. +stage_dir=/tmp/pacparser_$RANDOM +rm -rf /tmp/pacparser_* +mkdir -p $stage_dir +echo "DESTDIR=$stage_dir" + +if [[ ! -f src/Makefile ]]; then + echo "Call this script from the root of the source directory" + exit 1 +fi + +# Build pactester and pacparser library and install in $stage_dir +make -C src 2>&1 | tee mk.log +DESTDIR=$stage_dir make -C src install 2>&1 | tee mk-install.log +# Build python module and install it in $stage_dir +make -C src pymod 2>&1 | tee mk-pymod.log +DESTDIR=$stage_dir make -C src install-pymod 2>&1 | tee mk-pymod-install.log diff --git a/tools/cleanmac.sh b/tools/cleanmac.sh new file mode 100755 index 0000000..226893c --- /dev/null +++ b/tools/cleanmac.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -euxo pipefail + +rm -rf \ + rust_ffi/target/ \ + src/jsapi_buildstamp \ + src/libpacparser.1.dylib \ + src/libpacparser.dylib \ + src/pacparser.o \ + src/pymod/pacparser_o_buildstamp \ + src/spidermonkey/js-buildstamp \ + src/spidermonkey/js/src/Darwin_DBG.OBJ/ \ + src/spidermonkey/js/src/jsautocfg.h \ + src/spidermonkey/libjs.a \ + /tmp/pacparser_* From 7bd02e7a447ade642621f0bf2f20be924bbda216 Mon Sep 17 00:00:00 2001 From: pexarkh <40366153+pexarkh@users.noreply.github.com> Date: Wed, 24 Sep 2025 01:50:17 -0400 Subject: [PATCH 4/8] DA-6842 --- .github/workflows/build.yml | 187 ++++++++++++++++++------------------ src/Makefile | 6 +- src/pymod/setup.py | 29 +++--- src/version.mk | 1 + tools/cleanmac.sh | 4 +- tools/sample-pac.py | 68 +++++++++++++ 6 files changed, 185 insertions(+), 110 deletions(-) create mode 100644 src/version.mk create mode 100644 tools/sample-pac.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 382596e..b27e16e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,13 +45,24 @@ jobs: fetch-depth: 0 ref: ${{ github.event.inputs.tag }} - - name: make non-windows + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.12" + architecture: ${{ matrix.architecture }} + + - name: Set up setuptools + run: | + python --version + python -m pip install setuptools build wheel + + - name: non-windows whl if: ${{ matrix.os != 'windows-latest' }} - run: make -C src + run: make -C src pymod-dist - - name: make windows + - name: windows whl if: ${{ matrix.os == 'windows-latest' }} - run: make -C src -f Makefile.win32 + run: make -C src -f Makefile.win32 pymod-dist - name: Get ref_name id: get_ref_name @@ -65,31 +76,19 @@ jobs: echo "ref_name=${{ github.ref_name }}" >> $GITHUB_OUTPUT || exit 1 fi - - name: make non-windows dist - if: ${{ matrix.os != 'windows-latest' }} - run: | - DIST_OS_SUFFIX=${{ matrix.os_suffix }} make -C src dist - ls -R src/*.zip - - - name: make windows dist - if: ${{ matrix.os == 'windows-latest' }} - run: | - make -C src -f Makefile.win32 dist - ls -R src/*.zip - - - name: Upload artifacts (non-windows) + - name: Upload whl (non-windows) if: ${{ matrix.os != 'windows-latest' }} uses: actions/upload-artifact@v4 with: - name: pacparser-dist-${{ matrix.os }} - path: src/pacparser*.zip + name: pacparser-whl-${{ matrix.os }} + path: src/pymod/dist/pacparser*.whl - - name: Upload dist (windows) + - name: Upload whl (windows) if: ${{ matrix.os == 'windows-latest' }} uses: actions/upload-artifact@v4 with: - name: pacparser-dist-${{ matrix.os }} - path: src/dist + name: pacparser-whl-${{ matrix.os }} + path: src/pymod/dist/pacparser*.whl # build-release-binaries: # needs: build @@ -116,86 +115,86 @@ jobs: # name: pacparser-release-binaries # path: pacparser-*.zip - python-module-build: - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macos-13] - python-version: ["3.12"] - architecture: [x64] - include: - - os: macos-latest - python-version: "3.12" - architecture: arm64 - runs-on: ${{ matrix.os }} + # python-module-build: + # strategy: + # matrix: + # os: [ubuntu-latest, windows-latest, macos-13] + # python-version: ["3.12"] + # architecture: [x64] + # include: + # - os: macos-latest + # python-version: "3.12" + # architecture: arm64 + # runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - if: ${{ !contains(github.event_name, 'workflow_dispatch') }} - with: - fetch-depth: 0 + # steps: + # - uses: actions/checkout@v5 + # if: ${{ !contains(github.event_name, 'workflow_dispatch') }} + # with: + # fetch-depth: 0 - - name: Check out code for workflow_dispatch - if: ${{ contains(github.event_name, 'workflow_dispatch') }} - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - fetch-depth: 0 - ref: ${{ github.event.inputs.tag }} + # - name: Check out code for workflow_dispatch + # if: ${{ contains(github.event_name, 'workflow_dispatch') }} + # uses: actions/checkout@v5 + # with: + # fetch-depth: 0 + # ref: ${{ github.event.inputs.tag }} - - name: Set up Python - uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 - with: - python-version: ${{ matrix.python-version }} - architecture: ${{ matrix.architecture }} + # - name: Set up Python + # uses: actions/setup-python@v6 + # with: + # python-version: '3.12' + # architecture: ${{ matrix.architecture }} - - name: Set up setuptools - run: | - python --version - python -mpip install setuptools + # - name: Set up setuptools + # run: | + # python --version + # python -m pip install setuptools - - name: make non-windows - if: ${{ matrix.os != 'windows-latest' }} - run: | - make -C src pymod-dist - ls -R src/*.zip + # - name: make non-windows + # if: ${{ matrix.os != 'windows-latest' }} + # run: | + # make -C src pymod-dist + # ls -R src/*.zip - - name: make windows - if: ${{ matrix.os == 'windows-latest' }} - run: | - make -C src -f Makefile.win32 pymod-dist - ls -R src/*.zip + # - name: make windows + # if: ${{ matrix.os == 'windows-latest' }} + # run: | + # make -C src -f Makefile.win32 pymod-dist + # ls -R src/*.zip - # - name: Upload dist - # uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 - # with: - # name: pacparser-python-${{ matrix.python-version }}-${{ matrix.os }}-dist - # path: src/pymod/pacparser-python* + # - name: Upload dist + # uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 + # with: + # name: pacparser-python-${{ matrix.python-version }}-${{ matrix.os }}-dist + # path: src/pymod/pacparser-python* - - name: Build wheel non-linux - if: ${{ matrix.os != 'ubuntu-latest' }} - run: | - python -m pip install wheel - cd src/pymod && python setup.py bdist_wheel - - # - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 - # id: src_changes - # with: - # filters: | - # changed: - # - 'src/**' - - # - name: Publish package to PyPI (non-linux) - # if: | - # (matrix.os != 'ubuntu-latest') && - # (steps.src_changes.outputs.changed == 'true' || - # startsWith(github.event.inputs.tag, 'v') || startsWith(github.ref, - # 'refs/tags/v')) && (github.event_name != 'pull_request') - # env: - # TWINE_USERNAME: __token__ - # TWINE_PASSWORD: ${{ secrets.PYPI }} - # run: | - # python -m pip install twine - # ls -R . - # twine upload src/pymod/dist/* + # - name: Build wheel non-linux + # if: ${{ matrix.os != 'ubuntu-latest' }} + # run: | + # python -m pip install wheel + # cd src/pymod && python setup.py bdist_wheel + + # - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 + # id: src_changes + # with: + # filters: | + # changed: + # - 'src/**' + + # - name: Publish package to PyPI (non-linux) + # if: | + # (matrix.os != 'ubuntu-latest') && + # (steps.src_changes.outputs.changed == 'true' || + # startsWith(github.event.inputs.tag, 'v') || startsWith(github.ref, + # 'refs/tags/v')) && (github.event_name != 'pull_request') + # env: + # TWINE_USERNAME: __token__ + # TWINE_PASSWORD: ${{ secrets.PYPI }} + # run: | + # python -m pip install twine + # ls -R . + # twine upload src/pymod/dist/* # build-linux-wheels: # runs-on: ubuntu-latest diff --git a/src/Makefile b/src/Makefile index 5b8fdf2..352ffe8 100644 --- a/src/Makefile +++ b/src/Makefile @@ -20,7 +20,7 @@ # This file is not part of the source code repository. It's generated by the # packaging script. --include version.mk +include version.mk ifeq ($(shell uname),FreeBSD) SHELL := /usr/local/bin/bash @@ -82,11 +82,13 @@ PREFIX ?= /usr MAINT_CFLAGS := -g -DXP_UNIX -Wall -DVERSION=$(VERSION) ifndef PYTHON - PYTHON = python + PYTHON = python3 endif +$(info PYTHON = $(PYTHON)) $(info LIBRARY = $(LIBRARY)) $(info LIB_OPTS = $(LIB_OPTS)) +$(info -------------------------) # Spidermonkey library. MAINT_CFLAGS += -Ispidermonkey/js/src diff --git a/src/pymod/setup.py b/src/pymod/setup.py index b3baaea..98eb97b 100644 --- a/src/pymod/setup.py +++ b/src/pymod/setup.py @@ -64,25 +64,28 @@ def sanitize_version(ver): def git_version(): return sanitize_version( subprocess.check_output( - "git describe --always --tags --candidate=100".split(" "), text=True + "git describe --always --tags".split(" "), text=True ) ) def pacparser_version(): - if ( - subprocess.call("git rev-parse --git-dir".split(" "), stderr=subprocess.DEVNULL) - == 0 - ): - return git_version() - - # Check if we have version.mk. It's added in the manual release tarball. version_file = os.path.join(setup_dir(), "..", "version.mk") - if os.path.exists(version_file): - with open(version_file) as f: - return sanitize_version(f.read().replace("VERSION=", "")) - - return sanitize_version(os.environ.get("PACPARSER_VERSION", "1.0.0")) + with open(version_file) as f: + v = f.read().replace("VERSION=", "").strip() + return v + # if ( + # subprocess.call("git rev-parse --git-dir".split(" "), stderr=subprocess.DEVNULL) + # == 0 + # ): + # return git_version() + # # Check if we have version.mk. It's added in the manual release tarball. + # version_file = os.path.join(setup_dir(), "..", "version.mk") + # print(f"version_file={version_file}") + # if os.path.exists(version_file): + # with open(version_file) as f: + # return sanitize_version(f.read().replace("VERSION=", "")) + # return sanitize_version(os.environ.get("PACPARSER_VERSION", "1.0.0")) class DistCmd(setuptools.Command): diff --git a/src/version.mk b/src/version.mk new file mode 100644 index 0000000..f9a2e77 --- /dev/null +++ b/src/version.mk @@ -0,0 +1 @@ +VERSION=2.0.1 diff --git a/tools/cleanmac.sh b/tools/cleanmac.sh index 226893c..507fc9d 100755 --- a/tools/cleanmac.sh +++ b/tools/cleanmac.sh @@ -13,4 +13,6 @@ rm -rf \ src/spidermonkey/js/src/Darwin_DBG.OBJ/ \ src/spidermonkey/js/src/jsautocfg.h \ src/spidermonkey/libjs.a \ - /tmp/pacparser_* + src/pymod/build/ \ + src/pymod/dist/ \ + src/pymod/pacparser.egg-info/ diff --git a/tools/sample-pac.py b/tools/sample-pac.py new file mode 100644 index 0000000..6ef2640 --- /dev/null +++ b/tools/sample-pac.py @@ -0,0 +1,68 @@ +""" +This sample PAC string demonstrates various common PAC file features: + +Direct connections for local/internal IP ranges (10.x.x.x, 172.16.x.x, 192.168.x.x, 127.x.x.x) +Specific proxy routing for internal corporate domains +Blocking domains by routing to a black hole proxy +Protocol-based routing (different handling for HTTP vs HTTPS) +SOCKS proxy usage for specific sites +Failover proxies (multiple proxies with fallback to DIRECT) +Time-based load balancing between proxies + +The PAC file uses standard PAC functions like: + +isPlainHostName() - checks if hostname has no dots +shExpMatch() - shell expression matching (wildcards) +isInNet() - checks if IP is in a network range +dnsResolve() - resolves hostname to IP +dnsDomainIs() - checks if host is in a domain +dateRange() - checks date ranges + +This should provide a good test case for your Python PAC parser with various routing rules and PAC functions to parse. +""" + +pac = """function FindProxyForURL(url, host) { + // If the hostname matches local addresses, go direct + if (isPlainHostName(host) || + shExpMatch(host, "*.local") || + isInNet(dnsResolve(host), "10.0.0.0", "255.0.0.0") || + isInNet(dnsResolve(host), "172.16.0.0", "255.240.0.0") || + isInNet(dnsResolve(host), "192.168.0.0", "255.255.0.0") || + isInNet(dnsResolve(host), "127.0.0.0", "255.255.255.0")) { + return "DIRECT"; + } + + // Use specific proxy for internal corporate domains + if (dnsDomainIs(host, ".internal.company.com") || + dnsDomainIs(host, ".corp.example.com")) { + return "PROXY internal-proxy.company.com:8080"; + } + + // Block certain domains + if (shExpMatch(host, "*.blocked-site.com") || + shExpMatch(host, "*.ads.example.com")) { + return "PROXY 127.0.0.1:9999"; // Black hole proxy + } + + // Use different proxies based on protocol + if (url.substring(0, 5) == "http:") { + return "PROXY http-proxy.company.com:3128; DIRECT"; + } + + if (url.substring(0, 6) == "https:") { + return "PROXY https-proxy.company.com:3129; PROXY backup-proxy.company.com:3128; DIRECT"; + } + + // Special handling for specific sites + if (dnsDomainIs(host, ".youtube.com") || + dnsDomainIs(host, ".googlevideo.com")) { + return "SOCKS5 socks-proxy.company.com:1080"; + } + + // Load balance between multiple proxies for general traffic + if (dateRange("MON", "WED")) { + return "PROXY proxy1.company.com:8080; PROXY proxy2.company.com:8080; DIRECT"; + } else { + return "PROXY proxy2.company.com:8080; PROXY proxy1.company.com:8080; DIRECT"; + } +}""" From 9ee82f3a262b7c3112edfbd91fd317b571db7172 Mon Sep 17 00:00:00 2001 From: pexarkh <40366153+pexarkh@users.noreply.github.com> Date: Wed, 24 Sep 2025 02:10:30 -0400 Subject: [PATCH 5/8] DA-6842 --- .github/workflows/build.yml | 27 +++++++++++++++------------ src/Makefile.win32 | 4 ++-- src/pymod/pacparser/__init__.py | 2 +- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b27e16e..2fe6dff 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,6 +45,18 @@ jobs: fetch-depth: 0 ref: ${{ github.event.inputs.tag }} + # - name: Get ref_name + # id: get_ref_name + # if: ${{ matrix.os != 'windows-latest' }} + # run: | + # if [ "${{ github.event_name }}" == "pull_request" ]; then + # echo "ref_name=${{ github.base_ref }}" + # echo "ref_name=${{ github.base_ref }}" >> $GITHUB_OUTPUT || exit 1 + # else + # echo "ref_name=${{ github.ref_name }}" + # echo "ref_name=${{ github.ref_name }}" >> $GITHUB_OUTPUT || exit 1 + # fi + - name: Set up Python uses: actions/setup-python@v6 with: @@ -62,19 +74,10 @@ jobs: - name: windows whl if: ${{ matrix.os == 'windows-latest' }} - run: make -C src -f Makefile.win32 pymod-dist - - - name: Get ref_name - id: get_ref_name - if: ${{ matrix.os != 'windows-latest' }} run: | - if [ "${{ github.event_name }}" == "pull_request" ]; then - echo "ref_name=${{ github.base_ref }}" - echo "ref_name=${{ github.base_ref }}" >> $GITHUB_OUTPUT || exit 1 - else - echo "ref_name=${{ github.ref_name }}" - echo "ref_name=${{ github.ref_name }}" >> $GITHUB_OUTPUT || exit 1 - fi + make -C src -f Makefile.win32 pymod-dist + choco install msys2 + find . -iname '*.whl' - name: Upload whl (non-windows) if: ${{ matrix.os != 'windows-latest' }} diff --git a/src/Makefile.win32 b/src/Makefile.win32 index 8dedb10..e6b00de 100644 --- a/src/Makefile.win32 +++ b/src/Makefile.win32 @@ -22,7 +22,7 @@ # packaging script. -include version.mk -ifeq ($(OS),Windows_NT) +ifeq ($(OS),Windows_NT) RM = del /Q /F CP = copy /Y ifdef ComSpec @@ -41,7 +41,7 @@ VERSION ?= $(shell git describe --always --tags --candidate=100) LIB_VER=1 CFLAGS=-g -DXP_WIN -DWINVER=0x0501 -DVERSION=$(VERSION) -Ispidermonkey/js/src -Wall CC=gcc -PYTHON ?= python +PYTHON ?= python3 .PHONY: clean pymod install-pymod diff --git a/src/pymod/pacparser/__init__.py b/src/pymod/pacparser/__init__.py index b4a81e1..0a49054 100644 --- a/src/pymod/pacparser/__init__.py +++ b/src/pymod/pacparser/__init__.py @@ -33,7 +33,7 @@ import re import sys -_URL_REGEX = re.compile('^[^:]*:\/\/([^\/:]+)') +_URL_REGEX = re.compile(r'^[^:]*://([^/:]+)') class URLError(Exception): def __init__(self, url): From 5c4c3be1a1da27be9e2dec491f7144c152c7f3cb Mon Sep 17 00:00:00 2001 From: pexarkh <40366153+pexarkh@users.noreply.github.com> Date: Wed, 24 Sep 2025 17:58:10 -0400 Subject: [PATCH 6/8] DA-6842 --- .github/workflows/build.yml | 258 +----------------------------------- 1 file changed, 6 insertions(+), 252 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2fe6dff..dc003b2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,10 +1,10 @@ -name: Build Pacparser +name: Build Pacparser for Mac Universal on: push: branches: - preveil - - pavel/* + - feature/* pull_request: workflow_dispatch: inputs: @@ -18,19 +18,7 @@ permissions: jobs: build: - strategy: - matrix: - os: [windows-latest, macos-13, macos-latest] # ubuntu-latest - include: - # - os: ubuntu-latest - # os_suffix: "ubuntu-x86_64" - - os: macos-latest - os_suffix: "macos-arm64" - - os: macos-13 - os_suffix: "macos-x86_64" - - os: windows-latest - os_suffix: "windows-x86_64" - runs-on: ${{ matrix.os }} + runs-on: macos-13 steps: - uses: actions/checkout@v5 @@ -45,255 +33,21 @@ jobs: fetch-depth: 0 ref: ${{ github.event.inputs.tag }} - # - name: Get ref_name - # id: get_ref_name - # if: ${{ matrix.os != 'windows-latest' }} - # run: | - # if [ "${{ github.event_name }}" == "pull_request" ]; then - # echo "ref_name=${{ github.base_ref }}" - # echo "ref_name=${{ github.base_ref }}" >> $GITHUB_OUTPUT || exit 1 - # else - # echo "ref_name=${{ github.ref_name }}" - # echo "ref_name=${{ github.ref_name }}" >> $GITHUB_OUTPUT || exit 1 - # fi - - name: Set up Python uses: actions/setup-python@v6 with: python-version: "3.12" - architecture: ${{ matrix.architecture }} - name: Set up setuptools run: | python --version python -m pip install setuptools build wheel - - name: non-windows whl - if: ${{ matrix.os != 'windows-latest' }} + - name: Build a wheel run: make -C src pymod-dist - - name: windows whl - if: ${{ matrix.os == 'windows-latest' }} - run: | - make -C src -f Makefile.win32 pymod-dist - choco install msys2 - find . -iname '*.whl' - - - name: Upload whl (non-windows) - if: ${{ matrix.os != 'windows-latest' }} - uses: actions/upload-artifact@v4 - with: - name: pacparser-whl-${{ matrix.os }} - path: src/pymod/dist/pacparser*.whl - - - name: Upload whl (windows) - if: ${{ matrix.os == 'windows-latest' }} + - name: Upload the wheet uses: actions/upload-artifact@v4 with: - name: pacparser-whl-${{ matrix.os }} + name: pacparser-wheel path: src/pymod/dist/pacparser*.whl - - # build-release-binaries: - # needs: build - # runs-on: ubuntu-latest - # steps: - # - name: Download ubuntu cloudprober binaries - # uses: actions/download-artifact@v4 - # with: - # pattern: pacparser-dist-* - - # - name: Fix files - # run: | - # ls -R . - # mv pacparser-dist-*/*.zip . - # file=$(ls pacparser-*-ubuntu*.zip) - # name=${file/ubuntu/windows} - # name=${name/.zip/} - # mv pacparser-dist-windows-latest $name - # zip -r $name.zip $name - - # - name: Upload pacparser release - # uses: actions/upload-artifact@v4 - # with: - # name: pacparser-release-binaries - # path: pacparser-*.zip - - # python-module-build: - # strategy: - # matrix: - # os: [ubuntu-latest, windows-latest, macos-13] - # python-version: ["3.12"] - # architecture: [x64] - # include: - # - os: macos-latest - # python-version: "3.12" - # architecture: arm64 - # runs-on: ${{ matrix.os }} - - # steps: - # - uses: actions/checkout@v5 - # if: ${{ !contains(github.event_name, 'workflow_dispatch') }} - # with: - # fetch-depth: 0 - - # - name: Check out code for workflow_dispatch - # if: ${{ contains(github.event_name, 'workflow_dispatch') }} - # uses: actions/checkout@v5 - # with: - # fetch-depth: 0 - # ref: ${{ github.event.inputs.tag }} - - # - name: Set up Python - # uses: actions/setup-python@v6 - # with: - # python-version: '3.12' - # architecture: ${{ matrix.architecture }} - - # - name: Set up setuptools - # run: | - # python --version - # python -m pip install setuptools - - # - name: make non-windows - # if: ${{ matrix.os != 'windows-latest' }} - # run: | - # make -C src pymod-dist - # ls -R src/*.zip - - # - name: make windows - # if: ${{ matrix.os == 'windows-latest' }} - # run: | - # make -C src -f Makefile.win32 pymod-dist - # ls -R src/*.zip - - # - name: Upload dist - # uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4 - # with: - # name: pacparser-python-${{ matrix.python-version }}-${{ matrix.os }}-dist - # path: src/pymod/pacparser-python* - - # - name: Build wheel non-linux - # if: ${{ matrix.os != 'ubuntu-latest' }} - # run: | - # python -m pip install wheel - # cd src/pymod && python setup.py bdist_wheel - - # - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 - # id: src_changes - # with: - # filters: | - # changed: - # - 'src/**' - - # - name: Publish package to PyPI (non-linux) - # if: | - # (matrix.os != 'ubuntu-latest') && - # (steps.src_changes.outputs.changed == 'true' || - # startsWith(github.event.inputs.tag, 'v') || startsWith(github.ref, - # 'refs/tags/v')) && (github.event_name != 'pull_request') - # env: - # TWINE_USERNAME: __token__ - # TWINE_PASSWORD: ${{ secrets.PYPI }} - # run: | - # python -m pip install twine - # ls -R . - # twine upload src/pymod/dist/* - - # build-linux-wheels: - # runs-on: ubuntu-latest - - # steps: - # - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - # if: ${{ !contains(github.event_name, 'workflow_dispatch') }} - # with: - # fetch-depth: 0 - - # - name: Check out code for workflow_dispatch - # if: ${{ contains(github.event_name, 'workflow_dispatch') }} - # uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - # with: - # fetch-depth: 0 - # ref: ${{ github.event.inputs.tag }} - - # - name: Set env - # run: | - # echo "PACPARSER_VERSION=$(git describe --always --tags --candidate=100)" >> $GITHUB_ENV - - # - name: Set up Python - # uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0 - - # - name: Set up setuptools - # run: | - # python --version - # python -mpip install setuptools - - # - name: make - # run: make -C src pymod - - # - name: Build sdist - # run: cd src/pymod && python setup.py sdist - - # - name: Install cibuildwheel and twine - # run: python -m pip install cibuildwheel twine - - # - name: Build wheel using cibuildwheel - # run: | - # cp src/spidermonkey/libjs.a src/pacparser.o src/pacparser.h src/pymod - # cd src/pymod && python -m cibuildwheel --output-dir dist - # env: - # CIBW_BUILD: "cp{37,38,39,310,311,312}-manylinux*64" - # CIBW_ENVIRONMENT: "PACPARSER_VERSION=${{ env.PACPARSER_VERSION }}" - - # - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 - # id: src_changes - # with: - # filters: | - # changed: - # - 'src/**' - - # - name: Publish package to PyPI - # if: | - # startsWith(github.event.inputs.tag, 'v') || - # startsWith(github.ref,'refs/tags/v') ||steps.src_changes.outputs.changed == 'true' - # env: - # TWINE_USERNAME: __token__ - # TWINE_PASSWORD: ${{ secrets.PYPI }} - # run: | - # twine upload src/pymod/dist/* - - # build_and_push_docker_multiarch: - # name: Build and push multiarch docker image - # if: | - # github.repository == 'manugarg/pacparser' && - # (github.ref == 'refs/heads/main' || startswith(github.ref, 'refs/heads/docker') || - # startsWith(github.ref, 'refs/tags/v')) - # runs-on: ubuntu-latest - # steps: - # - name: Check out code into the Go module directory - # if: ${{ !contains(github.event_name, 'workflow_dispatch') }} - # uses: actions/checkout@v4 - # with: - # fetch-depth: 0 - - # - name: Check out code into the Go module directory - # if: ${{ contains(github.event_name, 'workflow_dispatch') }} - # uses: actions/checkout@v4 - # with: - # fetch-depth: 0 - # ref: ${{ github.event.inputs.tag }} - - # - name: Set up QEMU - # uses: docker/setup-qemu-action@v3 - - # - name: Set up Docker Buildx - # uses: docker/setup-buildx-action@v3 - - # - name: Login to GHCR - # uses: docker/login-action@v3 - # with: - # registry: ghcr.io - # username: ${{ github.repository_owner }} - # password: ${{ secrets.GITHUB_TOKEN }} - - # - name: Build and push release Docker Image (main-ghcr) - # run: make docker_multiarch DOCKER_IMAGE=ghcr.io/manugarg/pactester From 3787478ae16615eae91eb506b87599854ed9be91 Mon Sep 17 00:00:00 2001 From: pexarkh <40366153+pexarkh@users.noreply.github.com> Date: Wed, 24 Sep 2025 18:09:59 -0400 Subject: [PATCH 7/8] cleanup --- tools/buildmac.sh | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100755 tools/buildmac.sh diff --git a/tools/buildmac.sh b/tools/buildmac.sh deleted file mode 100755 index 879acc7..0000000 --- a/tools/buildmac.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash - -set -euxo pipefail - -# ver=$1 -# [ -z $ver ] && echo "Please specify package version." && exit - -# $stage_dir is where we'll install our package files. -stage_dir=/tmp/pacparser_$RANDOM -rm -rf /tmp/pacparser_* -mkdir -p $stage_dir -echo "DESTDIR=$stage_dir" - -if [[ ! -f src/Makefile ]]; then - echo "Call this script from the root of the source directory" - exit 1 -fi - -# Build pactester and pacparser library and install in $stage_dir -make -C src 2>&1 | tee mk.log -DESTDIR=$stage_dir make -C src install 2>&1 | tee mk-install.log -# Build python module and install it in $stage_dir -make -C src pymod 2>&1 | tee mk-pymod.log -DESTDIR=$stage_dir make -C src install-pymod 2>&1 | tee mk-pymod-install.log From ce067f5d5fa9a5532a837c13732ba29a833537f0 Mon Sep 17 00:00:00 2001 From: pexarkh <40366153+pexarkh@users.noreply.github.com> Date: Tue, 18 Nov 2025 23:11:18 -0500 Subject: [PATCH 8/8] - --- .github/workflows/build.yml | 9 ++++++--- README.md | 5 ++--- src/pymod/setup.py | 1 + 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dc003b2..5f3ea49 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,6 +19,9 @@ permissions: jobs: build: runs-on: macos-13 + strategy: + matrix: + python-version: ["3.12", "3.13"] steps: - uses: actions/checkout@v5 @@ -36,7 +39,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v6 with: - python-version: "3.12" + python-version: ${{ matrix.python-version }} - name: Set up setuptools run: | @@ -46,8 +49,8 @@ jobs: - name: Build a wheel run: make -C src pymod-dist - - name: Upload the wheet + - name: Upload the wheel uses: actions/upload-artifact@v4 with: - name: pacparser-wheel + name: pacparser-wheel-py${{ matrix.python-version }} path: src/pymod/dist/pacparser*.whl diff --git a/README.md b/README.md index 39a5083..08a9d01 100644 --- a/README.md +++ b/README.md @@ -30,11 +30,10 @@ pacparser itself. As a result, pacparser is as close to standard as it gets :) ### Install -For Python module, you can use pip. Pre-built module is available for `64-bit Linux, -Windows, MacOS-Intel, and MacOS-ARM`, for Python `3.7, 3.8, 3.9, 3.10 and 3.11`. +For Python module, you can use pip. Pre-built module is available for `64-bit MacOS Universal (Intel & ARM)`, for Python `3.12 and 3.13`. ``` python -m pip install pacparser -python -m pip install pacparser==1.3.8.dev15 (specific version) +python -m pip install pacparser==2.0.1 (specific version) ``` For other pre-built binaries, download them from the project's [releases]( diff --git a/src/pymod/setup.py b/src/pymod/setup.py index 98eb97b..ebe1246 100644 --- a/src/pymod/setup.py +++ b/src/pymod/setup.py @@ -166,6 +166,7 @@ def main(patched_func): }, name="pacparser", version=pacparser_version(), + python_requires=">=3.12", description="Pacparser package", author="Manu Garg", author_email="manugarg@gmail.com",