adding python src and renamin _ext

This commit is contained in:
Erik Frojdh 2023-06-02 09:34:28 +02:00
parent 1985beca05
commit 9d890adef8
4 changed files with 5 additions and 4 deletions

View File

@ -7,7 +7,7 @@ debug: ## Build extension with debug prints and assertions
python setup.py build_ext --inplace -UNDEBUG -DCR_VERBOSE python setup.py build_ext --inplace -UNDEBUG -DCR_VERBOSE
clean: ## Remove the build folder and the shared library clean: ## Remove the build folder and the shared library
rm -rf build/ creader.cpython* rm -rf build/ _creader.cpython*
test: ## Run unit tests using pytest test: ## Run unit tests using pytest
python -m pytest python -m pytest

1
creader/__init__.py Normal file
View File

@ -0,0 +1 @@
from _creader import *

View File

@ -3,7 +3,7 @@
import setuptools import setuptools
import numpy as np import numpy as np
c_ext = setuptools.Extension("creader", c_ext = setuptools.Extension("_creader",
sources = [ sources = [
"src/creader_module.c", "src/creader_module.c",
"src/cluster_reader.c", "src/cluster_reader.c",

View File

@ -70,7 +70,7 @@ static PyMethodDef creader_methods[] = {
// Module defenition // Module defenition
static struct PyModuleDef creader_def = { static struct PyModuleDef creader_def = {
PyModuleDef_HEAD_INIT, PyModuleDef_HEAD_INIT,
"creader", "_creader",
module_docstring, module_docstring,
-1, -1,
creader_methods, // m_methods creader_methods, // m_methods
@ -81,7 +81,7 @@ static struct PyModuleDef creader_def = {
}; };
// Initialize module and add classes // Initialize module and add classes
PyMODINIT_FUNC PyInit_creader(void) { PyMODINIT_FUNC PyInit__creader(void) {
PyObject *m = PyModule_Create(&creader_def); PyObject *m = PyModule_Create(&creader_def);
if (m == NULL) if (m == NULL)