move binary to _apportable, shim with Python script

Signed-off-by: Claudio Luck <claudio.luck@pep.foundation>
master
Claudio Luck 5 years ago
parent c117f3ed1a
commit 127880fbf8
  1. 8
      apportable.py
  2. 8
      apportable_pyext.c
  3. 6
      setup.py

@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
from _apportable import *
class ApportableError(Exception):
pass

@ -396,13 +396,13 @@ static struct PyModuleDef moduledef = {
#define INITERROR return NULL
PyMODINIT_FUNC
PyInit_apportable(void)
PyInit__apportable(void)
#else /* PY_MAJOR_VERSION >= 3 */
#define INITERROR return
void
initapportable(void)
init_apportable(void)
#endif
{
struct module_state *st;
@ -411,7 +411,7 @@ initapportable(void)
#if PY_MAJOR_VERSION >= 3
PyObject *module = PyModule_Create(&moduledef);
#else
PyObject *module = Py_InitModule("apportable", apportable_methods);
PyObject *module = Py_InitModule("_apportable", apportable_methods);
#endif
if (module == NULL)
@ -419,7 +419,7 @@ initapportable(void)
st = GETSTATE(module);
apportable_init(&(st->apportable), 1);
st->error = PyErr_NewException("apportable.Error", NULL, NULL);
st->error = PyErr_NewException("apportable.ApportableError", NULL, NULL);
if (st->error == NULL) {
Py_DECREF(module);
INITERROR;

@ -9,8 +9,8 @@ else:
ext_libs = []
apportable = Extension(
'apportable',
_apportable = Extension(
'_apportable',
define_macros = [('APPORTABLE', '1')],
libraries = [] + ext_libs,
sources = ['apportable.c', 'apportable_pyext.c']
@ -21,5 +21,5 @@ setup(
name = 'libapportable-test',
version = '1.0',
description = 'Apportable tests',
ext_modules = [apportable],
ext_modules = [_apportable],
)

Loading…
Cancel
Save