Created
May 6, 2020 13:48
-
-
Save antocuni/a1404859da8a01609c90b1bb76ad5d95 to your computer and use it in GitHub Desktop.
pip/manylinux bug
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
#!/bin/bash | |
set -e | |
# Compile wheels | |
PYTHONS=( | |
cp27-cp27m | |
cp27-cp27mu | |
) | |
# remove leftovers from previous builds, if any | |
rm -rf /foo/build | |
for pydir in "${PYTHONS[@]}"; do | |
pybin=/opt/python/$pydir/bin | |
echo $pydir | |
# if you downgrade to pip==20.0.2, it works | |
#"${pybin}/pip" install -U pip==20.0.2 | |
"${pybin}/python" -V | |
"${pybin}/pip" --version | |
"${pybin}/python" -c 'import setuptools; print "setuptools", setuptools.__version__' | |
echo | |
echo "creating wheel" | |
"${pybin}/pip" wheel /foo/ -w wheelhouse/ | |
# if you uncomment the next line and manually remove the build directory | |
# between runs, it works | |
#rm -rf /foo/build | |
whl=/wheelhouse/foo-*-$pydir-*.whl | |
echo | |
echo "inspecting $whl" | |
pushd `mktemp -d` | |
unzip -q $whl | |
objdump -T foo.so | grep PyUnicode | |
"${pybin}/pip" install $whl | |
"${pybin}/python" -c 'import foo' | |
popd | |
echo | |
echo | |
done |
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
#include <Python.h> | |
static PyObject* hello(PyObject* self, PyObject* args) | |
{ | |
return PyUnicode_FromString("hello world"); | |
} | |
static PyMethodDef FooMethods[] = { | |
{"hello", (PyCFunction)hello, METH_NOARGS, ""}, | |
{NULL, NULL, 0, NULL} | |
}; | |
PyMODINIT_FUNC | |
initfoo(void) | |
{ | |
PyObject* m; | |
m = Py_InitModule("foo", FooMethods); | |
} |
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
from setuptools import setup, Extension | |
setup(name="foo", | |
ext_modules = [ | |
Extension('foo', ['foo.c']), | |
]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment