Skip to content

Commit

Permalink
add packaging in setup.py and twine upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Koeng101 committed Aug 11, 2024
1 parent 390e977 commit c85cafb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel cffi
pip install setuptools wheel cffi packaging
- name: Install Zig
uses: goto-bus-stop/setup-zig@v2
Expand Down Expand Up @@ -133,6 +133,8 @@ jobs:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
for wheel in dist/**/*.whl; do
twine upload "$wheel"
for file in dist/**/*; do
if [[ $file == *.whl ]] || [[ $file == *.tar.gz ]]; then
twine upload "$file"
fi
done
16 changes: 16 additions & 0 deletions py/setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import platform
from packaging import tags
from setuptools import setup, find_packages

def get_shared_lib_ext():
Expand All @@ -10,6 +11,20 @@ def get_shared_lib_ext():
else:
return ".so"


def get_platform_tag():
if sys.platform.startswith('linux'):
return f'manylinux_2_17_{platform.machine()}'
elif sys.platform.startswith('darwin'):
if platform.machine() == 'arm64':
return f'macosx_11_0_{platform.machine()}'
else:
return f'macosx_10_9_{platform.machine()}'
elif sys.platform.startswith('win'):
return 'win_amd64'
else:
return 'any'

setup(
name='dnadesign',
version='0.1.1',
Expand All @@ -22,6 +37,7 @@ def get_shared_lib_ext():
"cffi>=1.0.0",
],

plat_name=f"{platform_tag.platform}_{platform_tag.abi}_{platform_tag.interpreter}_{platform_tag.implementation}",
include_package_data=True,
zip_safe=False,
author='Keoni Gandall',
Expand Down

0 comments on commit c85cafb

Please sign in to comment.