Commit bf5e7225 authored by Michael Davidsaver's avatar Michael Davidsaver

CI: ensure DSO only package isn't purelib

parent e41543a8
......@@ -99,6 +99,19 @@ jobs:
python setup.py -v build_ext -i
(cd src && python -m dsodemo.cli)
cd ..
- name: Test Example DSO only
shell: bash
run: |
set -x
cd example
python setup.py clean -a
git clean -fdx .
rm -f dist/*.whl
python setup-dso-only.py -v bdist_wheel
python -m wheel unpack -d junk dist/*.whl
find junk
ls junk/*/*.dist-info/WHEEL
! ls junk/*/*/purelib
manylinux:
runs-on: ubuntu-latest
......
#!/usr/bin/env python
from setuptools_dso import DSO, Extension, setup
from setuptools_dso.probe import ProbeToolchain
def define_DSOs(cmd):
# 'cmd' is instance of distutils Command with attributes:
# 'build_lib', 'build_temp', 'inplace', 'distribution', etc.
# example of inspecting the target toolchain.
# could be used to alter source list, macro definitions, or compiler flags.
probe = ProbeToolchain()
assert probe.try_compile('#include <stdlib.h>')
assert not probe.try_compile('intentionally invalid syntax')
assert probe.check_include('stdlib.h')
assert not probe.check_include('no-such-header.h')
assert probe.sizeof('short')==2
assert probe.check_symbol('RAND_MAX', headers=['stdlib.h'])
assert probe.check_symbol('abort', headers=['stdlib.h'])
assert not probe.check_symbol('intentionally_undeclared_symbol', headers=['stdlib.h'])
dso = DSO('dsodemo.lib.demo', ['src/foo.c', 'src/bar.cpp'],
define_macros = [('BUILD_FOO', None)],
# demonstrate passing other compiler flags, either conditionally or not.
# these are not actually used.
extra_compile_args = ['-DALL'],
lang_compile_args = {
'c':['-DISC'],
'c++':['-DISCXX'],
},
# demonstrate how to set an SONAME.
# eg. on linux the result will be two files:
# dsodemo/lib/libdemo.so
# dsodemo/lib/libdemo.so.1.0
soversion='1.0',
)
return [dso]
ext = Extension('dsodemo.ext.dtest', ['src/extension.cpp'],
dsos=['dsodemo.lib.demo'],
)
setup(
name='dsodemo',
version="0.1",
# setup/build time dependencies listed in pyproject.toml
# cf. PEP 518
#setup_requires = ['setuptools_dso'],
# also need at runtime for DSO filename lookup since demo uses ctypes
install_requires = ['setuptools_dso'],
packages=['dsodemo', 'dsodemo.ext', 'dsodemo.lib'],
package_dir={'': 'src'},
# 'x_dsos' may be None, a list of DSO instances,
# or a callable returning a list of DSOs.
#x_dsos = [dso],
x_dsos = define_DSOs,
)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment