diff --git a/.github/workflows/build-dist.yml b/.github/workflows/build-dist.yml index b658be5..b015301 100644 --- a/.github/workflows/build-dist.yml +++ b/.github/workflows/build-dist.yml @@ -21,14 +21,16 @@ jobs: steps: - uses: actions/checkout@v3 with: + fetch-depth: 0 submodules: true - name: Build wheels - uses: pypa/cibuildwheel@v2.14.1 + uses: pypa/cibuildwheel@v2.16.2 env: # Skip builds(save time / avoid build error) CIBW_SKIP: "cp36-* pp* *-musllinux_* *_i686 *-win32" CIBW_ARCHS_MACOS: x86_64 arm64 + CIBW_BUILD_FRONTEND: "build" - uses: actions/upload-artifact@v3 with: @@ -46,6 +48,7 @@ jobs: steps: - uses: actions/checkout@v3 with: + fetch-depth: 0 submodules: true - name: Set up QEMU @@ -54,11 +57,12 @@ jobs: platforms: all - name: Build wheels - uses: pypa/cibuildwheel@v2.14.1 + uses: pypa/cibuildwheel@v2.16.2 env: CIBW_ARCHS_LINUX: aarch64 CIBW_BUILD: cp*-manylinux_aarch64 CIBW_SKIP: "cp36-*" + CIBW_BUILD_FRONTEND: "build" - uses: actions/upload-artifact@v3 with: @@ -75,10 +79,13 @@ jobs: steps: - uses: actions/checkout@v3 with: + fetch-depth: 0 submodules: true - name: Build sdist - run: pipx run build --sdist + run: | + python -m pip install build + python -m build --sdist - uses: actions/upload-artifact@v3 with: diff --git a/.github/workflows/run-test.yml b/.github/workflows/run-test.yml index b497d35..d89996c 100644 --- a/.github/workflows/run-test.yml +++ b/.github/workflows/run-test.yml @@ -9,7 +9,7 @@ jobs: build: strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "pypy3.9"] + python-version: ["3.9", "3.10", "3.11", "3.12", "pypy3.9"] os: [ubuntu-latest, windows-latest, macos-latest] runs-on: ${{ matrix.os }} diff --git a/setup.py b/setup.py index c5a67c0..31c5d3f 100644 --- a/setup.py +++ b/setup.py @@ -13,11 +13,12 @@ from distutils.ccompiler import get_default_compiler from setuptools import setup, Extension from setuptools.command.sdist import sdist +from wheel.bdist_wheel import bdist_wheel SYS_LIBSOXR = False -# python -m build -C=--build-option=--use-system-libsoxr +# python -m build -C--build-option=--use-system-libsoxr if '--use-system-libsoxr' in sys.argv: sys.argv.remove('--use-system-libsoxr') SYS_LIBSOXR = True @@ -38,6 +39,7 @@ def include_dirs(self, dirs): self._include = dirs +# Submodule versioning def get_git_version(cwd=''): try: result = subprocess.run( @@ -47,8 +49,8 @@ def get_git_version(cwd=''): ver = result.stdout.strip() return ver except Exception as e: - logging.warning(f'Error retrieving submodule version: {e}') - return 'unknown' + logging.warning(f'Can not get {cwd} version: {e}') + return None CSOXR_VERSION_C = ''' @@ -57,13 +59,23 @@ def get_git_version(cwd=''): ''' -class SDistBundledCommand(sdist): - def run(self): - ver = get_git_version('libsoxr') +def write_csoxr_version(): + ver = get_git_version('libsoxr') + if ver: with open(f'src/soxr/_csoxr_version.c', 'wt') as f: f.write(CSOXR_VERSION_C % (ver)) logging.info(f'libsoxr version: {ver}') + +class CustomSDistCmd(sdist): + def run(self): + write_csoxr_version() + super().run() + + +class CustomWheelCmd(bdist_wheel): + def run(self): + write_csoxr_version() super().run() @@ -142,6 +154,6 @@ def run(self): else: logging.info('Building Python-SoXR using bundled libsoxr...') setup( - cmdclass={'sdist': SDistBundledCommand}, + cmdclass={'sdist': CustomSDistCmd, 'bdist_wheel': CustomWheelCmd}, ext_modules=cythonize(extensions, language_level='3'), )