From 308e30bc0748b4725dcdd1a24bd3ed8754c8f80d Mon Sep 17 00:00:00 2001 From: Amy He Date: Fri, 6 Sep 2024 17:49:41 -0700 Subject: [PATCH 1/2] update workflow yml: 1. upgrade actions/upload-artifact; 2. include macos-aarch64 in compile binaries; 3. exclude macos, linux-aarch from pypi-build; 4. update yum repo files as a temp fix for Mirrorlist end-of-life; 5. change of job name in compile binaries --- .github/workflows/compile-binaries.yaml | 18 +++++++----------- .github/workflows/pypi-build.yml | 20 +++++++++++++------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/.github/workflows/compile-binaries.yaml b/.github/workflows/compile-binaries.yaml index 67c826d3..9a1b9474 100644 --- a/.github/workflows/compile-binaries.yaml +++ b/.github/workflows/compile-binaries.yaml @@ -23,7 +23,7 @@ on: jobs: compile_binaries: - name: Build wheels on ${{ matrix.os }} + name: Compile binaries on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: @@ -33,6 +33,9 @@ jobs: - os: ubuntu-latest arch: aarch64 - os: macos-latest + arch: x86_64 + - os: macos-latest + arch: aarch64 - os: windows-latest steps: @@ -61,8 +64,6 @@ jobs: run: | cd /vina/build/linux/release make - mv vina vina-${{ matrix.arch }} - mv vina_split vina_split-${{ matrix.arch }} - name: Compile Vina for macOS if: matrix.os == 'macos-latest' run: | @@ -80,13 +81,8 @@ jobs: .\compile.bat shell: powershell - name: Upload artifacts for inspection - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: - name: binaries + name: binaries-${{ matrix.os }}${{ matrix.arch }} path: | - ./**/release/vina - ./**/release/vina-${{ matrix.arch }} - ./**/release/vina_split - ./**/release/vina_split-${{ matrix.arch }} - ./**/release/vina.exe - ./**/release/vina_split.exe + ./**/release/vina* \ No newline at end of file diff --git a/.github/workflows/pypi-build.yml b/.github/workflows/pypi-build.yml index eaafa3e5..e3628905 100644 --- a/.github/workflows/pypi-build.yml +++ b/.github/workflows/pypi-build.yml @@ -27,7 +27,9 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-latest] + include: + - os: ubuntu-latest + arch: x86_64 steps: - name: Checkout @@ -61,13 +63,17 @@ jobs: env: CIBW_SKIP: pp* CIBW_ARCHS: auto64 - CIBW_ARCHS_LINUX: auto64 aarch64 + CIBW_ARCHS_LINUX: ${{ matrix.arch }} CIBW_BEFORE_BUILD: | pip install --upgrade pip setuptools CIBW_BEFORE_ALL_MACOS: | brew install boost swig CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 CIBW_BEFORE_ALL_LINUX: | + sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo + sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo + sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo + yum clean all && yum -y update yum install -y wget python-devel pcre-devel # Install SWIG wget https://downloads.sourceforge.net/swig/swig-4.0.2.tar.gz @@ -87,9 +93,9 @@ jobs: rm -rf boost_1_* rm -rf swig-4* - name: Upload artifacts for inspection - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: - name: dist + name: wheels path: ./wheelhouse/*.whl build_sdist: @@ -117,9 +123,9 @@ jobs: cd ./build/python python setup.py sdist - name: Upload artifacts for inspection - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: - name: dist + name: sdist path: ./build/python/dist/*.tar.gz upload_pypi: @@ -139,7 +145,7 @@ jobs: run: | python -m pip install --upgrade pip setuptools twine - name: Download artifacts - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: dist path: ./dist From 4c20237ed006e123708e352afd79f17744cb6d92 Mon Sep 17 00:00:00 2001 From: Amy He Date: Fri, 6 Sep 2024 17:59:54 -0700 Subject: [PATCH 2/2] 1. for compile binaries: edit Makefile BASE to find boost installed by apt-get (Linux) and homebrew (intel, Apple Silicon); 2. for newer boost versions: replace boost/filesystem/*.hpp by boost/filesystem.hpp in source; 3. explictly check for PEP 440 compliance of version: include packaging as build dependency, only return compliant version from setup.py --- build/linux/release/Makefile | 2 +- build/mac/release/Makefile | 2 +- build/python/pyproject.toml | 2 +- build/python/setup.py | 19 ++++++++++++++++--- src/lib/vina.h | 4 +--- src/split/split.cpp | 4 +--- 6 files changed, 21 insertions(+), 12 deletions(-) diff --git a/build/linux/release/Makefile b/build/linux/release/Makefile index eb23376b..6bbd6def 100644 --- a/build/linux/release/Makefile +++ b/build/linux/release/Makefile @@ -1,4 +1,4 @@ -BASE=/usr/local +BASE=/usr BOOST_VERSION= BOOST_INCLUDE = $(BASE)/include C_PLATFORM=-static -pthread diff --git a/build/mac/release/Makefile b/build/mac/release/Makefile index 6433c332..c55df31e 100644 --- a/build/mac/release/Makefile +++ b/build/mac/release/Makefile @@ -1,4 +1,4 @@ -BASE=/usr/local +BASE=$(shell brew --prefix) BOOST_VERSION= BOOST_INCLUDE = $(BASE)/include C_PLATFORM=-pthread diff --git a/build/python/pyproject.toml b/build/python/pyproject.toml index 34a99cce..cbb00f93 100644 --- a/build/python/pyproject.toml +++ b/build/python/pyproject.toml @@ -1,3 +1,3 @@ [build-system] -requires = ["setuptools>=50.3", "wheel"] +requires = ["setuptools>=50.3", "wheel", "packaging"] build-backend = "setuptools.build_meta" diff --git a/build/python/setup.py b/build/python/setup.py index 6d1c6a7d..37ad08df 100644 --- a/build/python/setup.py +++ b/build/python/setup.py @@ -19,7 +19,7 @@ from distutils.util import convert_path from distutils.sysconfig import customize_compiler from distutils.ccompiler import show_compilers - +from packaging.version import Version, InvalidVersion # Path to the directory that contains this setup.py file. base_dir = os.path.abspath(os.path.dirname(__file__)) @@ -53,13 +53,25 @@ def find_version(): 3. __init__.py (as failback) """ + + def is_compliant(version_str): + try: + # Attempt to parse the version string using packaging's Version class + Version(version_str) + return True + except InvalidVersion: + # If parsing fails, the version is not PEP 440 compliant + print(f"{version_str} is not PEP 440 compliant") + return False + version_file = os.path.join(base_dir, 'vina', 'version.py') if os.path.isfile(version_file): with open(version_file) as f: version = f.read().strip() print('Version found: %s (from version.py)' % version) - return version + if is_compliant(version): + return version try: git_output = subprocess.check_output(['git', 'describe', '--abbrev=7', '--dirty=@mod', '--always', '--tags']) @@ -70,7 +82,8 @@ def find_version(): version = git_output.replace('-', '.dev', 1).replace('@', '-', 1).replace('-', '+', 1).replace('-','') print('Version found %s (from git describe)' % version) - return version + if is_compliant(version): + return version except: pass diff --git a/src/lib/vina.h b/src/lib/vina.h index a44cf9b3..0379601b 100644 --- a/src/lib/vina.h +++ b/src/lib/vina.h @@ -33,9 +33,7 @@ #include #include #include -#include -#include -#include // filesystem::basename +#include #include // hardware_concurrency // FIXME rm ? #include //#include diff --git a/src/split/split.cpp b/src/split/split.cpp index b42e78aa..b6234dbf 100644 --- a/src/split/split.cpp +++ b/src/split/split.cpp @@ -28,9 +28,7 @@ #include // getline? #include // for ceila #include -#include -#include -#include // filesystem::basename +#include #include "file.h" #include "parse_error.h"