Skip to content

Commit

Permalink
Merge branch 'pull-98'
Browse files Browse the repository at this point in the history
# Conflicts:
#	setup.py
  • Loading branch information
trolldbois committed Apr 22, 2023
2 parents a5c2b2d + 11795d7 commit 55174cb
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 56 deletions.
55 changes: 38 additions & 17 deletions .github/workflows/ctypeslib-linux.yml
Expand Up @@ -6,16 +6,39 @@ on: [push, pull_request]


jobs:
test:
check-package-build:
name: Build & inspect our package.
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# get all history and tags for setuptools_scm to find the right version
fetch-depth: 0
- name: Install build dependencies
run: |
pip install setuptools setuptools_scm wheel build
- name: Build package wheel
run: python -m build -w
- name: Upload built artifacts.
uses: actions/upload-artifact@v3
# By default, the artifacts and log files generated by workflows are retained for 90 days before they are automatically deleted.
with:
name: Packages
path: ./dist/*
# - uses: hynek/build-and-inspect-python-package@v1
# id: build-package
# packages are uploaded to Packages

test:
needs: check-package-build
runs-on: ubuntu-latest
strategy:
matrix:
# os: [ubuntu-latest, macos-latest, windows-latest]
# python-version: [ 3.5, 3.6, 3.7, 3.8, 3.9 ]
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11' ]
clang-version: ['11', '14']
clang-version: ['11', '12', '13', '14']
# clang 15+ is C2X standard and requires cleaning up C code in test libs
# https://github.com/madler/zlib/issues/633

Expand All @@ -32,8 +55,8 @@ jobs:
platform: x64
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install clang==${{ matrix.clang-version }}.* coveralls
python -m pip install --upgrade pip
pip install setuptools setuptools_scm clang==${{ matrix.clang-version }}.* coveralls coverage[toml]
- name: build test libs
run: |
CFLAGS="-Wall -Wextra -Werror -std=c99 -pedantic -fpic"
Expand All @@ -57,30 +80,28 @@ jobs:
if: ${{runner.os == 'macOS' }}
run: |
echo "DYLD_LIBRARY_PATH=$(pwd)/test/data/:$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
- name: Install clang2py
- uses: actions/download-artifact@v3
with:
name: Packages
path: ~/packages/
- name: Install the package that was built
run: |
python setup.py develop
- name: Test with Unittest and coverage
pip install ~/packages/ctypeslib2*.whl
- name: Run tests with Unittest and coverage
run: |
coverage run --source=ctypeslib setup.py test
coverage run --source=ctypeslib -m unittest test.alltests
- name: Coveralls
uses: AndreMiras/coveralls-python-action@develop
uses: coverallsapp/github-action@v2
with:
parallel: true
flag-name: Unit Test
flag-name: run-${{ join(matrix.*, ' - ') }}

coveralls_finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: AndreMiras/coveralls-python-action@develop
uses: coverallsapp/github-action@v2
with:
parallel-finished: true

# - name: Coveralls
# run: |
# coveralls
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
5 changes: 4 additions & 1 deletion BUILD.md
@@ -1,5 +1,8 @@
build package requirement
`pip install build`

build dist
`python setup.py bdist_wheel`
`python -m build`

upload
`twine upload dist/....latest_version`
40 changes: 40 additions & 0 deletions pyproject.toml
@@ -1,4 +1,44 @@
[build-system]
requires = ["setuptools>=56.2", "setuptools_scm[toml]>=7"]
build-backend = "setuptools.build_meta"

[project]
name = "ctypeslib2"
authors = [{name = "Loic Jaquemet", email = "loic.jaquemet+python@gmail.com"}]
license = {text = "License :: OSI Approved :: MIT License"}
description = "ctypeslib2 - FFI toolkit, relies on clang"
readme = "README.md"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.8",
"Topic :: Software Development :: Libraries :: Python Modules",
]
dependencies = ["clang>=11"]
dynamic = ["version"]

[project.urls]
Homepage = "https://github.com/trolldbois/ctypeslib"
Download = "https://github.com/trolldbois/ctypeslib/releases"

[project.scripts]
clang2py = "ctypeslib.clang2py:main"

[tool.setuptools]
packages = ["ctypeslib", "ctypeslib.codegen"]
include-package-data = false

[tool.setuptools.package-data]
ctypeslib = [
"data/fundamental_type_name.tpl",
"data/headers.tpl",
"data/pointer_type.tpl",
"data/string_cast.tpl",
"data/structure_type.tpl",
]

[tool.setuptools_scm]

[tool.black]
line-length = 120
Expand Down
2 changes: 0 additions & 2 deletions setup.cfg

This file was deleted.

38 changes: 2 additions & 36 deletions setup.py
Expand Up @@ -3,39 +3,5 @@

from setuptools import setup

setup(
name="ctypeslib2",
version="2.3.4",
description="ctypeslib2 - FFI toolkit, relies on clang",
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
author="Loic Jaquemet",
author_email="loic.jaquemet+python@gmail.com",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.8",
"Topic :: Software Development :: Libraries :: Python Modules",
],
url="https://github.com/trolldbois/ctypeslib",
download_url="https://github.com/trolldbois/ctypeslib/releases",
license="License :: OSI Approved :: MIT License",
packages=['ctypeslib',
'ctypeslib.codegen',
],
package_data={'ctypeslib': ['data/fundamental_type_name.tpl',
'data/headers.tpl',
'data/pointer_type.tpl',
'data/string_cast.tpl',
'data/structure_type.tpl',
]},
entry_points={
'console_scripts': [
'clang2py = ctypeslib.clang2py:main',
]},
test_suite="test.alltests",
install_requires=[
'clang>=11',
]
)
if __name__ == "__main__":
setup()

0 comments on commit 55174cb

Please sign in to comment.