Skip to content

Commit

Permalink
refactor: deprecate sdist option
Browse files Browse the repository at this point in the history
  • Loading branch information
kiyoon committed Oct 18, 2024
1 parent 23debd1 commit dc85f45
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 52 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
bash build_reduce_linux.sh ${{ inputs.reduce-release-tag }}
- name: Build python wheel
run: |
bash build_python.sh wheel ${{ inputs.version-tag }} ${{ matrix.platform.target }}
bash build_python.sh ${{ inputs.version-tag }} ${{ matrix.platform.target }}
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
- name: Build python wheel
run: |
export PATH="/Users/runner/.local/bin:$PATH"
bash build_python.sh wheel ${{ inputs.version-tag }} ${{ matrix.platform.target }}
bash build_python.sh ${{ inputs.version-tag }} ${{ matrix.platform.target }}
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ Go to Github Actions and run the `Build and Release` workflow.

Version rule:

4.14.post2: 4.14 is the reduce version, postN can increase with the changes of the package and the builds.
e.g.: 4.14.0.2

- 4.14 is the reduce version
- the last digit is the build/API version number


### Running locally
Expand Down Expand Up @@ -100,10 +103,9 @@ Build the wheel. It copies the `python` to `build_python/`, built binary into it

```bash
# One of the following
bash build_python.sh wheel 4.14 manylinux_2_17_x86_64.manylinux2014_x86_64
bash build_python.sh wheel 4.14 macosx_10_12_x86_64
bash build_python.sh wheel 4.14 macosx_11_0_arm64
bash build_python.sh sdist 4.14 # not used
bash build_python.sh 4.14 manylinux_2_17_x86_64.manylinux2014_x86_64
bash build_python.sh 4.14 macosx_10_12_x86_64
bash build_python.sh 4.14 macosx_11_0_arm64
```

Test the wheel
Expand Down
68 changes: 23 additions & 45 deletions build_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,35 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
BUILD_DIR="$SCRIPT_DIR/build"

help() {
echo "Usage: $0 wheel <VERSION_NUM> <PLATFORM_NAME>"
echo " or: $0 sdist <VERSION_NUM>"
echo "Usage: $0 <PACKAGE_VERSION_NUM> <PLATFORM_NAME>"
}

if [[ $# -lt 2 ]]; then
help
exit 1
elif [[ $# -eq 2 ]]; then
if [[ $1 != "sdist" ]]; then
help
exit 1
fi
fi

WHEEL_OR_SDIST=$1
VERSION_NUM=$2
elif [[ $# -eq 3 ]]; then
if [[ $1 != "wheel" ]]; then
help
exit 1
fi
VERSION_NUM=$1
PLATFORM_NAME=$2

WHEEL_OR_SDIST=$1
VERSION_NUM=$2
PLATFORM_NAME=$3
valid_platforms=("macosx_11_0_arm64" \
"macosx_10_12_x86_64" \
"manylinux_2_17_x86_64.manylinux2014_x86_64" \
"manylinux_2_28_x86_64" \
"manylinux_2_17_i686.manylinux2014_i686" "manylinux_2_17_aarch64.manylinux2014_aarch64" \
"manylinux_2_17_armv7l.manylinux2014_armv7l" "manylinux_2_17_ppc64le.manylinux2014_ppc64le" \
"manylinux_2_17_s390x.manylinux2014_s390x")

valid_platforms=("macosx_11_0_arm64" \
"macosx_10_12_x86_64" \
"manylinux_2_17_x86_64.manylinux2014_x86_64" \
"manylinux_2_28_x86_64" \
"manylinux_2_17_i686.manylinux2014_i686" "manylinux_2_17_aarch64.manylinux2014_aarch64" \
"manylinux_2_17_armv7l.manylinux2014_armv7l" "manylinux_2_17_ppc64le.manylinux2014_ppc64le" \
"manylinux_2_17_s390x.manylinux2014_s390x")

platform_found=false
for platform in "${valid_platforms[@]}"; do
if [[ "$platform" == "$PLATFORM_NAME" ]]; then
platform_found=true
break
fi
done

if [[ "$platform_found" == false ]]; then
echo "Unknown platform name: $PLATFORM_NAME"
help
exit 1
platform_found=false
for platform in "${valid_platforms[@]}"; do
if [[ "$platform" == "$PLATFORM_NAME" ]]; then
platform_found=true
break
fi
else
done

if [[ "$platform_found" == false ]]; then
echo "Unknown platform name: $PLATFORM_NAME"
help
exit 1
fi
Expand Down Expand Up @@ -85,12 +67,8 @@ $SED -i "s/__version__ = \"0.0.0\"/__version__ = \"$VERSION_NUM\"/g" "$PYTHON_BU

cd "$PYTHON_BUILD_DIR" || { echo "Failure"; exit 1; }

if [ "$WHEEL_OR_SDIST" == "wheel" ]; then
cp -r "$BUILD_DIR/"* "$PYTHON_BUILD_DIR/src/reduce_binary"
pyproject-build --installer=uv --wheel
wheel tags --python-tag py3 --abi-tag none --platform "$PLATFORM_NAME" dist/*.whl --remove
else
pyproject-build --installer=uv --sdist
fi
cp -r "$BUILD_DIR/"* "$PYTHON_BUILD_DIR/src/reduce_binary"
pyproject-build --installer=uv --wheel
wheel tags --python-tag py3 --abi-tag none --platform "$PLATFORM_NAME" dist/*.whl --remove


0 comments on commit dc85f45

Please sign in to comment.