-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b54bd7b
commit 317b3d9
Showing
10 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
Binary file added
BIN
+3.01 KB
delocate/tests/data/fakepkg_namespace-1.0-cp36-abi3-macosx_10_9_universal2.whl
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
This contains a single compiled module stored in a subpackage of a namespace. | ||
|
||
This reuses the `libextfunc2.dylib` library from the `fakepkg_rpath` wheel. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
int extfunc2() | ||
{ | ||
return 3; | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#define PY_SSIZE_T_CLEAN | ||
#include <Python.h> | ||
|
||
int extfunc2(void); /*proto*/ | ||
|
||
static PyObject* func2(PyObject* self) { | ||
return PyLong_FromLong(2); | ||
} | ||
|
||
static PyObject* func3(PyObject* self) { | ||
return PyLong_FromLong((long)extfunc2()); | ||
} | ||
|
||
static PyMethodDef module2_methods[] = { | ||
{"func2", (PyCFunction)func2, METH_NOARGS, NULL}, | ||
{"func3", (PyCFunction)func3, METH_NOARGS, NULL}, | ||
{NULL, NULL, 0, NULL} /* sentinel */ | ||
}; | ||
|
||
static struct PyModuleDef module2 = { | ||
PyModuleDef_HEAD_INIT, | ||
"module2", | ||
NULL, | ||
-1, | ||
module2_methods | ||
}; | ||
|
||
PyMODINIT_FUNC | ||
PyInit_module2(void) | ||
{ | ||
return PyModule_Create(&module2); | ||
} |
Empty file.
6 changes: 6 additions & 0 deletions
6
wheel_makers/fakepkg_namespace/namespace/subpkg/tests/test_fakepkg.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from namespace.subpkg.module2 import func2, func3 # type: ignore | ||
|
||
|
||
def test_fakepkg(): | ||
assert func2() == 2 | ||
assert func3() == 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import subprocess | ||
from pathlib import Path | ||
|
||
from setuptools import Extension, setup # type: ignore | ||
|
||
HERE = Path(__file__).parent.resolve(strict=True) | ||
LIBS = HERE / "libs" | ||
ARCH_FLAGS = ["-arch", "arm64", "-arch", "x86_64"] # Dual architecture. | ||
|
||
subprocess.run( | ||
[ | ||
"cc", | ||
str(LIBS / "extfunc2.c"), | ||
"-dynamiclib", | ||
"-install_name", | ||
"@rpath/libextfunc2_rpath.dylib", | ||
"-o", | ||
str(LIBS / "libextfunc2_rpath.dylib"), | ||
] | ||
+ ARCH_FLAGS, | ||
check=True, | ||
) | ||
|
||
ext_modules = [ | ||
Extension( | ||
"namespace.subpkg.module2", | ||
["namespace/subpkg/module2.c"], | ||
libraries=["extfunc2_rpath"], | ||
extra_compile_args=ARCH_FLAGS, | ||
extra_link_args=[f"-L{LIBS}", "-rpath", "libs/"], | ||
py_limited_api=True, | ||
) | ||
] | ||
|
||
setup( | ||
ext_modules=ext_modules, | ||
name="fakepkg_namespace", | ||
version="1.0", | ||
packages=[ | ||
'namespace.subpkg', | ||
'namespace.subpkg.tests', | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters