# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1731111557 -3600
#      Sat Nov 09 01:19:17 2024 +0100
# Branch stable
# Node ID 05addf266f6f8044db7fd78a76742ec4038ddf10
# Parent  2b7e3177f99c06febf64e7e77c2a5d8ec6ef3307
wheel: add a platform level to the wheel directories

One day, we will gather all wheel in a single directory and be able to pick the
right one programmatically. This days is not today…

This will help clarify things if we fetch all artifacts at the same time.

diff --git a/contrib/heptapod-ci.yml b/contrib/heptapod-ci.yml
--- a/contrib/heptapod-ci.yml
+++ b/contrib/heptapod-ci.yml
@@ -56,17 +56,17 @@
     FLAVOR: ""
     MERCURIAL_SETUP_FORCE_TRANSLATIONS: "1"
     CI_CLEVER_CLOUD_FLAVOR: "XS"
-  before_script:
+  script:
+    - PLATFORM=`/opt/python/cp313-cp313/bin/python -c 'import sys; print(sys.platform)'`
     - echo $WHEEL_TYPE
     - test -n "$WHEEL_TYPE"
     - echo $FLAVOR
-    - mkdir -p wheels/$WHEEL_TYPE/$BUILD_PY_ID
-  script:
+    - mkdir -p wheels/$PLATFORM/$WHEEL_TYPE/$BUILD_PY_ID
     - /opt/python/$BUILD_PY_ID/bin/python setup.py bdist_wheel --dist-dir tmp-wheelhouse
-    - auditwheel repair tmp-wheelhouse/*.whl -w wheels/$WHEEL_TYPE/$BUILD_PY_ID
+    - auditwheel repair tmp-wheelhouse/*.whl -w wheels/$PLATFORM/$WHEEL_TYPE/$BUILD_PY_ID
   artifacts:
     paths:
-      - wheels/$WHEEL_TYPE/$BUILD_PY_ID
+      - wheels/
     expire_in: 1 week
 
 build-c-wheel:
@@ -111,13 +111,15 @@
         - PORT_START=`expr 19051 + 1009 '*' $CI_CONCURRENT_ID`
         - PORT_ARG="--port $PORT_START"
         - echo $PORT_ARG
+        - PLATFORM=`$PYTHON -c 'import sys; print(sys.platform)'`
+        - echo $PLATFORM
         - WHEEL_ARG=""
         - SHARDING_ARGS=""
         - if test -n "$WHEEL_TYPE"; then
              PY_TAG=`$PYTHON -c 'import sys; v=sys.version_info; t=f"cp{v.major}{v.minor}"; print(f"{t}-{t}")'`;
              echo "$PY_TAG";
              test -n "PY_TAG";
-             WHEEL="`ls -1 $CI_PROJECT_DIR/wheels/$WHEEL_TYPE/$PY_TAG/*.whl`";
+             WHEEL="`ls -1 $CI_PROJECT_DIR/wheels/$PLATFORM/$WHEEL_TYPE/$PY_TAG/*.whl`";
              test -n "$WHEEL";
              echo installing from $WHEEL;
              WHEEL_ARG="--hg-wheel $WHEEL";
@@ -429,11 +431,12 @@
     variables:
       MERCURIAL_SETUP_FORCE_TRANSLATIONS: "1"
     script:
+      - PLATFORM=`$PYTHON -c 'import sys; print(sys.platform)'`
       - rm -rf tmp-wheels
       - cibuildwheel --output-dir tmp-wheels/
       - for py_version in cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312 cp313-cp313; do
-          mkdir -p wheels/c/$py_version/;
-          mv tmp-wheels/*$py_version*.whl wheels/c/$py_version/;
+          mkdir -p wheels/$PLATFORM/c/$py_version/;
+          mv tmp-wheels/*$py_version*.whl wheels/$PLATFORM/c/$py_version/;
         done
       - rm -rf tmp-wheels
     artifacts: