Commit 3dd9b40a authored by ale's avatar ale

Make the Python module pip-installable

parent 14478bf7
......@@ -2,6 +2,7 @@ include $(top_srcdir)/Makefile.defs
PYTHON_BUILD_ARGS := --plat-name=$(shell $(srcdir)/crosscompileargs)
PYTHON_SETUP_PY = env \
BUILD_MODULE=y \
SSO_LIB_DIR=$(top_builddir)/src/sso/.libs \
SRCDIR=$(srcdir) BUILDDIR=$(builddir) \
$(PYTHON) setup.py
......
......@@ -7,11 +7,21 @@ BUILDDIR = os.getenv('BUILDDIR', SRCDIR)
SSO_LIB_DIR = os.getenv('SSO_LIB_DIR', '.')
libsso_srcdir = os.path.join(SRCDIR, '..')
setup(name='libsso',
ext_modules=[Extension('sso._sso_c', ['sso/sso.i'],
# If BUILD_MODULE is not defined, bundle libsso into the Python
# extension so that this package is pip-installable directly.
ext_sources = ['sso/sso.i']
libraries = ['sso']
if not os.getenv('BUILD_MODULE'):
ext_sources.extend(os.path.join(libsso_srcdir, 'sso', x) for x in [
'base64.c', 'randombytes.c', 'sso.c', 'tweetnacl.c',
])
libraries = []
setup(name='sso',
ext_modules=[Extension('sso._sso_c', ext_sources,
swig_opts=['-c++', '-modern', '-I' + libsso_srcdir],
include_dirs=[libsso_srcdir],
libraries=['sso'],
libraries=libraries,
library_dirs=[SSO_LIB_DIR],
)],
package_dir={'sso': 'sso'},
......
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