Skip to content

Instantly share code, notes, and snippets.

@hoefling
Last active August 12, 2016 13:19
Show Gist options
  • Save hoefling/c113a46f1690118ef4bde3114b2960c7 to your computer and use it in GitHub Desktop.
Save hoefling/c113a46f1690118ef4bde3114b2960c7 to your computer and use it in GitHub Desktop.
test generator for zope interface issue https://github.com/zopefoundation/zope.interface/issues/47
#!/usr/bin/env bash
[ -d "/tmp/zopetest" ] && rm -rf /tmp/zopetest
mkdir /tmp/zopetest
touch /tmp/zopetest/__init__.py
cat > /tmp/zopetest/interface.py << EOL
import zope.interface
class IFoo(zope.interface.Interface):
"""Foo blah blah"""
def bar(q):
"""bar blah blah"""
EOL
cat > /tmp/tester.py << EOL
if __name__ == '__main__':
from zopetest.interface import IFoo
print('import succeeded')
EOL
if [ "$1" == '--cythonize' ]; then
cd /tmp/
cython --embed /tmp/zopetest/interface.py
gcc -pthread -fPIC -I/usr/include/python3.5m -c /tmp/zopetest/interface.c -o /tmp/zopetest/interface.o -std=gnu11 -march=native -fPIC -fwrapv -Wall -fno-strict-aliasing -s -O2 -D NDEBUG
x86_64-pc-linux-gnu-gcc -pthread -shared /tmp/zopetest/interface.o -L/usr/lib64 -lpython3.5m -o /tmp/zopetest/interface.so -shared -lpython3.5m -lpthread -lm -lutil -ldl
rm -f /tmp/zopetest/interface{.py,.c,.o,}
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment