This is an automated email from the ASF dual-hosted git repository.

chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fory.git


The following commit(s) were added to refs/heads/main by this push:
     new 9004a03b7 fix(python): fix pyfory pypi release (#2473)
9004a03b7 is described below

commit 9004a03b7db1a2d1e803238f401b6a671859cbfa
Author: Shawn Yang <[email protected]>
AuthorDate: Fri Aug 15 02:28:48 2025 +0800

    fix(python): fix pyfory pypi release (#2473)
    
    ## What does this PR do?
    
    <!-- Describe the purpose of this PR. -->
    
    ## Related issues
    
    #2381
    #2472
    Closes #2471
    
    ## Does this PR introduce any user-facing change?
    
    <!--
    If any user-facing interface changes, please [open an
    issue](https://github.com/apache/fory/issues/new/choose) describing the
    need to do so and update the document if necessary.
    -->
    
    - [ ] Does this PR introduce any public API change?
    - [ ] Does this PR introduce any binary protocol compatibility change?
    
    ## Benchmark
    
    <!--
    When the PR has an impact on performance (if you don't know whether the
    PR will have an impact on performance, you can submit the PR first, and
    if it will have impact on performance, the code reviewer will explain
    it), be sure to attach a benchmark data here.
    -->
---
 .github/workflows/release.yaml | 21 +++++++++++++++------
 ci/deploy.sh                   | 43 ++++++++++++++++++++----------------------
 2 files changed, 35 insertions(+), 29 deletions(-)

diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 25cbba768..919d326fa 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -69,19 +69,26 @@ jobs:
              DOCKER_IMAGE="${{ env.manylinux_aarch64_image }}"
              PLAT="manylinux_2_28_aarch64"
            fi
-           docker run --rm -e PLAT=$PLAT \
+           PY_VERSION=${{ matrix.python-version }}
+           echo "PY_VERSION: $PY_VERSION"
+           PY_VERSION=${PY_VERSION//./}
+           echo "PY_VERSION without dots: $PY_VERSION"
+           docker run --rm -e PY_VERSION="$PY_VERSION" -e PLAT="$PLAT" \
              -v ${{ github.workspace }}:/work \
              -w /work "$DOCKER_IMAGE" \
              bash -c "
                set -e
-               # Install build dependencies inside the container
                yum install -y git sudo wget
                git config --global --add safe.directory /work
-
-               # Install Bazel inside the container
+               ls -alh /opt/python
+               echo \"PY_VERSION: \$PY_VERSION\"
+               ls /opt/python/cp\${PY_VERSION}-cp\${PY_VERSION}
+               ls /opt/python/cp\${PY_VERSION}-cp\${PY_VERSION}/bin
+               export 
PATH=/opt/python/cp\${PY_VERSION}-cp\${PY_VERSION}/bin:\$PATH
+               echo \"PATH: \$PATH\"
+               echo \"Using Python from: \$(which python)\"
+               echo \"Python version: \$(python -V)\"
                bash ci/run_ci.sh install_bazel
-
-               # Build the wheel inside the container
                bash ci/deploy.sh build_pyfory
              "
 
@@ -118,10 +125,12 @@ jobs:
         with:
           repository-url: https://test.pypi.org/legacy/
           skip-existing: true
+          verify-metadata: false
           packages-dir: downloaded_wheels
       - name: Publish to PyPI
         uses: pypa/gh-action-pypi-publish@release/v1
         if: ${{ startsWith(github.ref, 'refs/tags/') && !contains(github.ref, 
'-') }}
         with:
           skip-existing: true
+          verify-metadata: false
           packages-dir: downloaded_wheels
diff --git a/ci/deploy.sh b/ci/deploy.sh
index 6cce344b0..7de5af5a3 100755
--- a/ci/deploy.sh
+++ b/ci/deploy.sh
@@ -72,40 +72,37 @@ build_pyfory() {
   # Fix strange installed deps not found
   pip install setuptools -U
 
-  # Detect host architecture and only pass x86_64 config when appropriate
-  ARCH=$(uname -m)
-  if [[ "$ARCH" == "x86_64" || "$ARCH" == "amd64" ]]; then
-    bazel build --config=x86_64 //:cp_fory_so
-  else
-    bazel build //:cp_fory_so
-  fi
-
   python setup.py bdist_wheel --dist-dir=../dist
+  ls -l ../dist
 
   if [ -n "$PLAT" ]; then
     # In manylinux container, repair the wheel to embed shared libraries
     # and rename the wheel with the manylinux tag.
     PYARROW_LIB_DIR=$(python -c 'import pyarrow; 
print(":".join(pyarrow.get_library_dirs()))')
     export LD_LIBRARY_PATH="$PYARROW_LIB_DIR:$LD_LIBRARY_PATH"
-    auditwheel repair ../dist/pyfory-*-linux_*.whl --plat "$PLAT" -w ../dist/
+    auditwheel repair ../dist/pyfory-*-linux_*.whl --plat "$PLAT" --exclude 
'*arrow*' --exclude '*parquet*' --exclude '*numpy*' -w ../dist/
     rm ../dist/pyfory-*-linux_*.whl
   elif [[ "$OSTYPE" == "darwin"* ]]; then
-    # macOS: use delocate to bundle dependencies and fix wheel tags
-    pip install delocate
-    mkdir -p ../dist_repaired
-    delocate-wheel -w ../dist_repaired/ ../dist/pyfory-*-macosx*.whl
-    rm ../dist/pyfory-*-macosx*.whl
-    mv ../dist_repaired/* ../dist/
-    rmdir ../dist_repaired
+    # Check macOS version
+    MACOS_VERSION=$(sw_vers -productVersion | cut -d. -f1-2)
+    if [[ "$MACOS_VERSION" == "13"* ]]; then
+      # Check if wheel ends with x86_64.whl
+      for wheel in ../dist/pyfory-*-macosx*.whl; do
+        if [[ "$wheel" == *"x86_64.whl" ]]; then
+          echo "Fixing wheel tags for x86_64 wheel: $wheel"
+          wheel tags --platform-tag macosx_12_0_x86_64 "$wheel"
+        else
+          echo "Skipping wheel tags for non-x86_64 wheel: $wheel"
+        fi
+      done
+    else
+      # Other macOS versions: skip wheel repair
+      echo "Skipping wheel repair for macOS $MACOS_VERSION"
+    fi
   elif [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
-    # Windows: use delvewheel to bundle dependencies
-    pip install delvewheel
-    mkdir -p ../dist_repaired
-    delvewheel repair ../dist/pyfory-*-win*.whl -w ../dist_repaired/
-    rm ../dist/pyfory-*-win*.whl
-    mv ../dist_repaired/* ../dist/
-    rmdir ../dist_repaired
+    echo "Skip windows wheel repair"
   fi
+  ls -l ../dist
   popd
 }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to