-
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.
Delocate libraries into one directory per wheel.
Add a top-level package-less wheel to test. Fixes duplicate library issues when a wheel has multiple packages. Fixes issues where a wheel has no packages.
- Loading branch information
1 parent
9038521
commit 68a261e
Showing
11 changed files
with
189 additions
and
38 deletions.
There are no files selected for viewing
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
Binary file added
BIN
+2.59 KB
delocate/tests/data/fakepkg_toplevel-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
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 not stored inside of a Python package. | ||
|
||
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; | ||
} |
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); | ||
} |
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,40 @@ | ||
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( | ||
"module2", | ||
["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_toplevel", | ||
version="1.0", | ||
py_modules=["module2", "test_fakepkg_toplevel"], | ||
) |
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 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