Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
mballance committed Oct 27, 2023
2 parents 64c0dc2 + e2e9f4e commit a5f2809
Show file tree
Hide file tree
Showing 2 changed files with 139 additions and 7 deletions.
117 changes: 113 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,125 @@ on:
- workflow_dispatch

jobs:
ci-macos:
linux:
runs-on: ubuntu-latest
container: quay.io/pypa/manylinux2014_x86_64
steps:
- name: checkout
uses: actions/checkout@v2
- name: Setup dependencies
run: |
set -eux
for py in cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311; do
/opt/python/${py}/bin/python -m pip install ninja wheel cython
done
- name: Fetch source dependencies
env:
IVPM_PYTHON: /opt/python/cp310-cp310/bin/python
run: |
set -eux
${IVPM_PYTHON} -m pip install ivpm twine auditwheel
${IVPM_PYTHON} -m ivpm update -a
ls packages/python
ls packages/python/bin
./packages/python/bin/python -m pip install cython setuptools wheel auditwheel build twine
- name: Build wheel
env:
BUILD_NUM: ${{ github.run_id }}
run: |
set -eux
echo "Building core"
./packages/python/bin/python setup.py build_ext --inplace
for py in cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311; do
echo "Building Wheel for ${py}"
/opt/python/${py}/bin/python setup.py bdist_wheel
done
- name: Audit Wheels
env:
IVPM_PYTHON: /opt/python/cp310-cp310/bin/python
run: |
for whl in dist/*.whl; do
${IVPM_PYTHON} -m auditwheel repair $whl
done
- name: Publish to PyPi
if: startsWith(github.ref, 'refs/heads/main')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
./packages/python/bin/twine upload wheelhouse/*.whl
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Fetch dependencies
run: |
python3 --version
python3 -m pip install ivpm
python3 -m ivpm update
./packages/python/bin/python -m pip install cython setuptools wheel build
python3 -m ivpm update -a
./packages/python/bin/python3 -m pip install cython setuptools wheel build twine
- name: Build wheel
env:
BUILD_NUM: ${{ github.run_id }}
run: |
./packages/python/bin/python setup.py bdist_wheel
./packages/python/bin/python3 setup.py bdist_wheel
- name: Publish to PyPi
if: startsWith(github.ref, 'refs/heads/main')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
./packages/python/bin/python3 -m twine upload dist/*.whl
windows:
runs-on: ${{ matrix.platform }}
strategy:
matrix:
include:
- platform: windows-latest
build_arch: x64
python_arch: x64
spec: '3.8'
- platform: windows-latest
build_arch: x64
python_arch: x64
spec: '3.9'
- platform: windows-latest
build_arch: x64
python_arch: x64
spec: '3.10'
- platform: windows-latest
build_arch: x64
python_arch: x64
spec: '3.11'
steps:
- name: checkout
uses: actions/checkout@v2

- name: Install python ${{ matrix.spec }}
uses: actions/setup-python@v2
with:
architecture: ${{ matrix.python_arch }}
python-version: ${{ matrix.spec }}

- name: Build/Test Package
shell: bash
env:
BUILD_NUM: ${{ github.run_id }}
run: |
python -V
python -m pip install ivpm
python -m ivpm update -a
./packages/python/Scripts/python -m pip install cython setuptools wheel build twine
./packages/python/Scripts/python setup.py build bdist_wheel
ls dist
- name: Publish to PyPi
if: startsWith(github.ref, 'refs/heads/main')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
shell: bash
run: |
./packages/python/Scripts/python -m twine upload dist/*.whl
29 changes: 26 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,24 @@ def copy_extensions_to_source(self):

if sys.platform == "darwin":
ext = ".dylib"
elif sys.platform == "win32":
ext = ".dll"
else:
ext = ".so"

pref = "lib"
if sys.platform == "win32":
pref = ""
else:
pref = "lib"

copy_file(
os.path.join(cwd, "build", "src", "%sdebug-mgr%s" % (pref, ext)),
os.path.join(package_dir, "%sdebug-mgr%s" % (pref, ext)))

if sys.platform == "win32":
copy_file(
os.path.join(cwd, "build", "src", "debug-mgr.lib" ),
os.path.join(package_dir, "debug-mgr.lib" % (pref, ext)))

dest_filename = os.path.join(package_dir, filename)

Expand All @@ -171,10 +181,23 @@ def copy_extensions_to_source(self):

if sys.platform == "darwin":
libext = ".dylib"
libpref = "lib"
elif sys.platform == "win32":
libext = ".dll"
libpref = "lib"
else:
libext = ".so"
libpref = "lib"

libpref = "lib"
if sys.platform == "win32":
package_data = [
"debug-mgr.dll",
"debug-mgr.lib"
]
else:
package_data = [
"%sdebug-mgr.%s" % (libpref, libext)
]

ext = Extension("debug_mgr.core",
extra_compile_args=extra_compile_args,
Expand All @@ -194,7 +217,7 @@ def copy_extensions_to_source(self):
version=version,
packages=['debug_mgr'],
package_dir = {'' : 'python'},
package_data={ 'debug_mgr': ["%sdebug-mgr%s" % (libpref, libext)] },
package_data={ 'debug_mgr': package_data },
author = "Matthew Ballance",
author_email = "[email protected]",
description = ("Simple debug manager for use of C++ Python extensions"),
Expand Down

0 comments on commit a5f2809

Please sign in to comment.