diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 39dc500a..afa67eea 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -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 }} diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..74e6a1e3 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,6 @@ +recursive-include tests/* + +include ffi/* +include preprocess/* +include scripts/build.py +include Makefile diff --git a/build.py b/scripts/build.py similarity index 79% rename from build.py rename to scripts/build.py index 67e047b5..27e9f5da 100644 --- a/build.py +++ b/scripts/build.py @@ -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) diff --git a/setup.py b/setup.py index 31735d54..7abe81e0 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,4 @@ +import sys from setuptools import setup from wheel.bdist_wheel import bdist_wheel @@ -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, )