You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by li...@apache.org on 2022/12/06 16:35:33 UTC

[arrow-adbc] branch main updated: ci: fix wrongly tagged wheels being uploaded (#220)

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

lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new ef1365b  ci: fix wrongly tagged wheels being uploaded (#220)
ef1365b is described below

commit ef1365b8dceace88ba23a3d21b73e5c7bc5ecafb
Author: David Li <li...@gmail.com>
AuthorDate: Tue Dec 6 11:35:28 2022 -0500

    ci: fix wrongly tagged wheels being uploaded (#220)
    
    - The Windows wheels were accidentally being built twice, leading to a `py3-none-any` wheel being uploaded
    - The macOS wheels were retagging to `universal2` instead of the arch-specific tag
---
 .github/workflows/packaging-wheels.yml    |  8 ++++----
 ci/scripts/python_util.sh                 |  2 ++
 ci/scripts/python_wheel_fix_tag.py        |  9 +++++++--
 ci/scripts/python_wheel_unix_build.sh     | 15 ++++++++++-----
 ci/scripts/python_wheel_windows_build.bat |  4 +---
 5 files changed, 24 insertions(+), 14 deletions(-)

diff --git a/.github/workflows/packaging-wheels.yml b/.github/workflows/packaging-wheels.yml
index 47ee541..0811ab0 100644
--- a/.github/workflows/packaging-wheels.yml
+++ b/.github/workflows/packaging-wheels.yml
@@ -363,9 +363,9 @@ jobs:
           name: python${{ matrix.python_version }}-windows
           retention-days: 7
           path: |
-            python/adbc_driver_manager/dist/*.whl
-            python/adbc_driver_postgres/dist/*.whl
-            python/adbc_driver_sqlite/dist/*.whl
+            python/adbc_driver_manager/repaired_wheels/*.whl
+            python/adbc_driver_postgres/repaired_wheels/*.whl
+            python/adbc_driver_sqlite/repaired_wheels/*.whl
 
       - name: Test wheel
         shell: cmd
@@ -379,7 +379,7 @@ jobs:
         shell: pwsh
         if: github.ref == 'refs/heads/main' && (github.event.schedule || inputs.upload_artifacts)
         run: |
-          foreach ($wheel in Get-ChildItem python\adbc_driver_*\dist\*.whl) {
+          foreach ($wheel in Get-ChildItem python\adbc_driver_*\repaired_wheels\*.whl) {
               .\ci\scripts\python_wheel_upload.ps1 $wheel.FullName
           }
         env:
diff --git a/ci/scripts/python_util.sh b/ci/scripts/python_util.sh
index 65cffd2..0d0fa67 100644
--- a/ci/scripts/python_util.sh
+++ b/ci/scripts/python_util.sh
@@ -17,6 +17,8 @@
 # specific language governing permissions and limitations
 # under the License.
 
+set -ex
+
 COMPONENTS="adbc_driver_manager adbc_driver_postgres adbc_driver_sqlite"
 
 function build_drivers {
diff --git a/ci/scripts/python_wheel_fix_tag.py b/ci/scripts/python_wheel_fix_tag.py
index b82ef24..7ad4cdb 100755
--- a/ci/scripts/python_wheel_fix_tag.py
+++ b/ci/scripts/python_wheel_fix_tag.py
@@ -30,10 +30,15 @@ from pathlib import Path
 
 def main():
     parser = argparse.ArgumentParser()
-    parser.add_argument("wheel", nargs="+")
+    parser.add_argument(
+        "--plat-name",
+        default=None,
+        help=f"Tag to use (defaults to {sysconfig.get_platform()})",
+    )
+    parser.add_argument("wheel", nargs="+", help="Wheels to retag")
     args = parser.parse_args()
 
-    plat_tag = sysconfig.get_platform()
+    plat_tag = args.plat_name or sysconfig.get_platform()
     plat_tag = plat_tag.replace("-", "_")
     plat_tag = plat_tag.replace(".", "_")
     print("Using platform tag: ", plat_tag)
diff --git a/ci/scripts/python_wheel_unix_build.sh b/ci/scripts/python_wheel_unix_build.sh
index b5d27a2..487111d 100755
--- a/ci/scripts/python_wheel_unix_build.sh
+++ b/ci/scripts/python_wheel_unix_build.sh
@@ -61,6 +61,15 @@ function check_wheels {
 echo "=== Set up platform variables ==="
 setup_build_vars "${arch}"
 
+echo "${PYTHON_ARCH}"
+
+# XXX: when we manually retag the wheel, we have to use the right arch
+# tag accounting for cross-compiling, hence the replacements
+PLAT_NAME=$(python -c "import sysconfig; print(sysconfig.get_platform()\
+    .replace('-x86_64', '-${PYTHON_ARCH}')\
+    .replace('-arm64', '-${PYTHON_ARCH}')\
+    .replace('-universal2', '-${PYTHON_ARCH}'))")
+
 echo "=== Building C/C++ driver components ==="
 # Sets ADBC_POSTGRES_LIBRARY, ADBC_SQLITE_LIBRARY
 build_drivers "${source_dir}" "${build_dir}"
@@ -73,10 +82,6 @@ check_visibility $ADBC_SQLITE_LIBRARY
 # Get the latest pip so we have in-tree-build by default
 python -m pip install --upgrade pip auditwheel cibuildwheel delocate setuptools wheel
 
-# XXX: when we manually retag the wheel, we have to use the right arch
-# tag, hence the replacements
-PLAT_NAME=$(python -c "import sysconfig; print(sysconfig.get_platform().replace('-x86_64', '${PYTHON_ARCH}').replace('-arm64', '${PYTHON_ARCH}'))")
-
 for component in $COMPONENTS; do
     pushd ${source_dir}/python/$component
 
@@ -99,7 +104,7 @@ for component in $COMPONENTS; do
         python -m pip wheel -w dist -vvv .
 
         # Retag the wheel
-        python "${script_dir}/python_wheel_fix_tag.py" dist/$component-*.whl
+        python "${script_dir}/python_wheel_fix_tag.py" --plat-name="${PLAT_NAME}" dist/$component-*.whl
 
         check_wheels dist/$component-*.whl
     fi
diff --git a/ci/scripts/python_wheel_windows_build.bat b/ci/scripts/python_wheel_windows_build.bat
index 832940e..be50563 100644
--- a/ci/scripts/python_wheel_windows_build.bat
+++ b/ci/scripts/python_wheel_windows_build.bat
@@ -91,10 +91,8 @@ FOR %%c IN (adbc_driver_manager adbc_driver_postgres adbc_driver_sqlite) DO (
     )
 
     echo "=== (%PYTHON_VERSION%) Repair %%c wheel ==="
-    python -m pip wheel -w dist -vvv . || exit /B 1
-
     FOR %%w IN (dist\*.whl) DO (
-        delvewheel repair -w dist\ %%w
+        delvewheel repair -w repaired_wheels\ %%w
     )
 
     popd