Skip to content

Commit

Permalink
sdist: include tests and build files
Browse files Browse the repository at this point in the history
  • Loading branch information
Tester authored and Tester committed Dec 27, 2023
1 parent 0924e2a commit e05b868
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 7 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ on:
- bugfix/*
- feature/*
jobs:
sdist:
name: build sdist wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: |
python -m pip install --upgrade pip
python -m pip install build setuptools wheel
python -m build --sdist
- uses: actions/upload-artifact@v3
with:
path: ./dist/*.tar.gz
bdist:
name: build bdist wheels and test
runs-on: ${{ matrix.os }}
Expand Down
6 changes: 6 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
recursive-include tests/*

include ffi/*
include preprocess/*
include scripts/build.py
include Makefile
10 changes: 5 additions & 5 deletions build.py → scripts/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@
],
source_extension=".c",
include_dirs=[
os.path.join(os.path.dirname(__file__), "include"),
os.path.join(os.path.dirname(__file__), "ffi"),
"../include",
"../ffi",
],
sources=[
os.path.join(os.path.dirname(__file__), "ffi/shim.c"),
"../ffi/shim.c",
],
extra_compile_args=(
["-Wno-implicit-function-declaration"] if uname.system == "Darwin" else []
),
# extra_link_args=["-Wl,-rpath,$ORIGIN/../libcurl/" + arch],
)

with open(os.path.join(os.path.dirname(__file__), "ffi/cdef.c")) as f:
print(os.listdir('..'))
with open("../ffi/cdef.c") as f:
cdef_content = f.read()
ffibuilder.cdef(cdef_content)

Expand Down
11 changes: 9 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import sys
from setuptools import setup
from wheel.bdist_wheel import bdist_wheel

Expand All @@ -13,8 +14,14 @@ def get_tag(self):
return python, abi, plat


# this option is only valid in setup.py
kwargs = {"cffi_modules": ["scripts/build.py:ffibuilder"]}
if len(sys.argv) > 1 and sys.argv[1] != 'bdist_wheel':
kwargs = {}

print(sys.argv, kwargs)

setup(
# this option is only valid in setup.py
cffi_modules=["./build.py:ffibuilder"],
cmdclass={"bdist_wheel": bdist_wheel_abi3}, # type: ignore
**kwargs,
)

0 comments on commit e05b868

Please sign in to comment.