diff --git a/.github/scripts/install-wavpack-linux.sh b/.github/scripts/install-wavpack-linux.sh index 009cc71..e3af60e 100644 --- a/.github/scripts/install-wavpack-linux.sh +++ b/.github/scripts/install-wavpack-linux.sh @@ -1,23 +1,36 @@ #!/bin/bash +# Check if WAVPACK_VERSION argument is provided +if [ -z "$1" ]; then + echo "Error: WAVPACK_VERSION argument is required." + exit 1 +else + WAVPACK_VERSION=$1 +fi + # Check if TARGET_FOLDER argument is provided -if [ -n "$1" ]; then - TARGET_FOLDER=$1 - # Create the target folder if it doesn't exist +if [ -z "$2" ]; then + TARGET_FOLDER=$(pwd) +else + TARGET_FOLDER=$2 mkdir -p "$TARGET_FOLDER" - # Change directory to the target folder - cd "$TARGET_FOLDER" fi +CWD=$(pwd) +cd "$TARGET_FOLDER" + +echo "Installing WavPack $WAVPACK_VERSION into $TARGET_FOLDER - CWD: $CWD" + sudo apt update sudo apt install wget sudo apt install -y gettext -WAVPACK_LATEST_VERSION="$(cat .github/wavpack_latest_version.txt)" - -wget "https://www.wavpack.com/wavpack-$WAVPACK_LATEST_VERSION.tar.bz2" -tar -xf wavpack-$WAVPACK_LATEST_VERSION.tar.bz2 -cd wavpack-$WAVPACK_LATEST_VERSION +wget "https://www.wavpack.com/wavpack-${WAVPACK_VERSION}.tar.bz2" +tar -xf wavpack-$WAVPACK_VERSION.tar.bz2 +cd wavpack-$WAVPACK_VERSION ./configure sudo make install -cd .. \ No newline at end of file +cd .. + +echo "WavPack $WAVPACK_VERSION installed into $TARGET_FOLDER Changing directory to: $CWD" +cd "$CWD" diff --git a/.github/workflows/build-wavpack-binaries.yml b/.github/workflows/build-wavpack-binaries.yml index 792821b..63e5b27 100644 --- a/.github/workflows/build-wavpack-binaries.yml +++ b/.github/workflows/build-wavpack-binaries.yml @@ -23,35 +23,41 @@ jobs: echo "GLIBC Version: $GLIBC_VERSION" echo "GLIBC_VERSION=$GLIBC_VERSION" >> $GITHUB_ENV - name: Build wavpack libraries + id: build-wavpack run: | - WAVPACK_LATEST_VERSION="$(cat .github/wavpack_latest_version.txt)" - TARGET_FOLDER="./wavpack_src" + WAVPACK_LATEST_VERSION="$(cat ./.github/wavpack_latest_version.txt)" + echo "wavpack latest version: $WAVPACK_LATEST_VERSION" + TARGET_FOLDER="$(pwd)/wavpack_src" chmod +x ./.github/scripts/install-wavpack-linux.sh - ./.github/scripts/install-wavpack-linux.sh $TARGET_FOLDER + ./.github/scripts/install-wavpack-linux.sh $WAVPACK_LATEST_VERSION $TARGET_FOLDER # copy the built library to the libraries/folder LIB_FOLDER_NAME="$WAVPACK_LATEST_VERSION/linux-x86_64-glibc$GLIBC_VERSION" - echo "LIB_FOLDER_NAME=$LIB_FOLDER_NAME" >> $GITHUB_ENV + echo "LIB_FOLDER_NAME=$LIB_FOLDER_NAME" >> "$GITHUB_OUTPUT" WAVPACK_NUMCODECS_LIB_PATH="src/wavpack_numcodecs/libraries/$LIB_FOLDER_NAME" + echo "WAVPACK_NUMCODECS_LIB_PATH=$WAVPACK_NUMCODECS_LIB_PATH" >> $GITHUB_ENV # find compiled library - LIBWAVPACK_PATH="$(find $TARGET_FOLDER/src/.libs -type f | grep libwavpack.so)" - mv $LIBWAVPACK_PATH $WAVPACK_NUMCODECS_LIB_PATH/libwavpack.so - rm -r $TARGET_FOLDER + LIBWAVPACK_PATH="$(find $TARGET_FOLDER/wavpack-$WAVPACK_LATEST_VERSION/src/.libs -type f | grep libwavpack.so)" + mkdir -p $WAVPACK_NUMCODECS_LIB_PATH + cp $LIBWAVPACK_PATH $WAVPACK_NUMCODECS_LIB_PATH/libwavpack.so + sudo rm -f -r $TARGET_FOLDER - name: Install wavpack numcodecs run: | pip install .[test] - name: Test imports run: | pytest -s tests/test_imports.py - - name: Test with pytest + - name: Create commits run: | - pytest -v + git config user.name 'Alessio Buccino' + git config user.email 'alejoe91@users.noreply.github.com' + git config core.fileMode false + git add -f $WAVPACK_NUMCODECS_LIB_PATH/libwavpack.so + git commit -m "Updated ${{ steps.build-wavpack.outputs.LIB_FOLDER_NAME }} wavpack binaries" - name: Make PR with updated binaries - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v7 with: - commit-message: "Update $LIB_FOLDER_NAME wavpack binaries" - title: "Update wavpack binaries" - body: "This PR updates the wavpack binaries." - branch: "update-wavpack-binaries" + title: "Update wavpack binaries for ${{ steps.build-wavpack.outputs.LIB_FOLDER_NAME }}" + body: "This PR updates the wavpack binaries for ${{ steps.build-wavpack.outputs.LIB_FOLDER_NAME }}" + branch-suffix: short-commit-hash base: "main" - add-paths: "src/wavpack_numcodecs/libraries" diff --git a/.github/workflows/python-package-cython.yml b/.github/workflows/python-package-cython.yml index a810880..34a32b4 100644 --- a/.github/workflows/python-package-cython.yml +++ b/.github/workflows/python-package-cython.yml @@ -23,8 +23,9 @@ jobs: - name: Install WavPack (ubuntu) if: matrix.os == 'ubuntu-latest' run: | + WAVPACK_LATEST_VERSION="$(cat ./.github/wavpack_latest_version.txt)" chmod +x ./.github/scripts/install-wavpack-linux.sh - ./.github/scripts/install-wavpack-linux.sh + ./.github/scripts/install-wavpack-linux.sh $WAVPACK_LATEST_VERSION # check libraries ls /usr/local/lib/ | grep wavpack @@ -43,7 +44,6 @@ jobs: which python - name: Install dependencies run: | - pip install Cython pip install .[test] - name: Test imports and version run: | diff --git a/.github/workflows/python-package-multi-threading.yml b/.github/workflows/python-package-multi-threading.yml index d2d750c..d33d508 100644 --- a/.github/workflows/python-package-multi-threading.yml +++ b/.github/workflows/python-package-multi-threading.yml @@ -23,8 +23,9 @@ jobs: - name: Install WavPack (ubuntu) if: matrix.os == 'ubuntu-latest' run: | + WAVPACK_LATEST_VERSION="$(cat ./.github/wavpack_latest_version.txt)" chmod +x ./.github/scripts/install-wavpack-linux.sh - ./.github/scripts/install-wavpack-linux.sh + ./.github/scripts/install-wavpack-linux.sh $WAVPACK_LATEST_VERSION # check libraries ls /usr/local/lib/ | grep wavpack diff --git a/.github/workflows/python-package-no-cython.yml b/.github/workflows/python-package-no-cython.yml index bc728c3..75135a8 100644 --- a/.github/workflows/python-package-no-cython.yml +++ b/.github/workflows/python-package-no-cython.yml @@ -23,8 +23,9 @@ jobs: - name: Install WavPack (ubuntu) if: matrix.os == 'ubuntu-latest' run: | + WAVPACK_LATEST_VERSION="$(cat ./.github/wavpack_latest_version.txt)" chmod +x ./.github/scripts/install-wavpack-linux.sh - ./.github/scripts/install-wavpack-linux.sh + ./.github/scripts/install-wavpack-linux.sh $WAVPACK_LATEST_VERSION # check libraries ls /usr/local/lib/ | grep wavpack diff --git a/pyproject.toml b/pyproject.toml index 600fd8a..197e48d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "wavpack-numcodecs" -version = "0.2.0" +version = "0.2.1" description = "Numcodecs implementation of WavPack audio codec." authors = [ {name = "Alessio Buccino", email = "alessiop.buccino@gmail.com"}, diff --git a/setup.py b/setup.py index 44b8c90..0732c0a 100644 --- a/setup.py +++ b/setup.py @@ -46,7 +46,7 @@ def get_build_extensions(): f"Could not find a matching glibc version for the shipped libraries. " f"Available builds: {available_glibc_versions}" ) - distr_folder = f"linux-x86_64_glibc{glibc_version}" + distr_folder = f"linux-x86_64-glibc{glibc_version}" extra_link_args = [f"-L{wavpack_libraries_folder}/{distr_folder}"] runtime_library_dirs = [ diff --git a/src/wavpack_numcodecs/libraries/5.6.0/linux-x86_64_glibc2.35/libwavpack.so b/src/wavpack_numcodecs/libraries/5.6.0/linux-x86_64-glibc2.35/libwavpack.so similarity index 100% rename from src/wavpack_numcodecs/libraries/5.6.0/linux-x86_64_glibc2.35/libwavpack.so rename to src/wavpack_numcodecs/libraries/5.6.0/linux-x86_64-glibc2.35/libwavpack.so diff --git a/src/wavpack_numcodecs/libraries/5.7.0/linux-x86_64_glibc2.35/libwavpack.so b/src/wavpack_numcodecs/libraries/5.7.0/linux-x86_64_glibc2.35/libwavpack.so deleted file mode 100755 index be05311..0000000 Binary files a/src/wavpack_numcodecs/libraries/5.7.0/linux-x86_64_glibc2.35/libwavpack.so and /dev/null differ