Skip to content

Commit

Permalink
Fixed python extension build (#1992)
Browse files Browse the repository at this point in the history
* Fixed python extension build

* Added comment
  • Loading branch information
merlimat committed Jun 19, 2018
1 parent 693ea90 commit 5ba840a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
19 changes: 14 additions & 5 deletions pulsar-client-cpp/docker/build-wheel-file-within-docker.sh
Expand Up @@ -18,19 +18,28 @@
# under the License.
#

set -e
set -ex

cd /pulsar/pulsar-client-cpp

find . -name CMakeCache.txt | xargs rm
find . -name CMakeFiles | xargs rm -rf
find . -name CMakeCache.txt | xargs -r rm
find . -name CMakeFiles | xargs -r rm -rf

cmake . -DPYTHON_INCLUDE_DIR=/opt/python/$PYTHON_SPEC/include/python$PYTHON_VERSION \
-DPYTHON_LIBRARY=/opt/python/$PYTHON_SPEC/lib \
-DLINK_STATIC=ON
-DLINK_STATIC=ON \
-DBUILD_TESTS=OFF

make clean
make _pulsar
make _pulsar -j3

cd python
python setup.py bdist_wheel

# Audit wheel is required to convert a wheel that is tagged as generic
# 'linux' into a 'multilinux' wheel.
# Only wheel files tagged as multilinux can be uploaded to PyPI
# Audit wheel will make sure no external dependencies are needed for
# the shared library and that only symbols supported by most linux
# distributions are used.
auditwheel repair dist/pulsar_client-*-$PYTHON_SPEC-linux_x86_64.whl
2 changes: 1 addition & 1 deletion pulsar-client-cpp/docker/build-wheels.sh
Expand Up @@ -44,5 +44,5 @@ for line in "${PYTHON_VERSIONS[@]}"; do
IMAGE_NAME=$BUILD_IMAGE_NAME:manylinux-$PYTHON_SPEC

echo "Using image: $IMAGE_NAME"
docker run -i -v $PWD:/pulsar $IMAGE_NAME /build-wheel-file-within-docker.sh
docker run -i -v $PWD:/pulsar $IMAGE_NAME /pulsar/pulsar-client-cpp/docker/build-wheel-file-within-docker.sh
done
6 changes: 3 additions & 3 deletions pulsar-client-cpp/python/pulsar/__init__.py
Expand Up @@ -100,9 +100,9 @@ def send_callback(res, msg):

from _pulsar import Result, CompressionType, ConsumerType, PartitionsRoutingMode # noqa: F401

from functions.function import Function
from functions.context import Context
from functions.serde import SerDe, IdentitySerDe, PickleSerDe
from pulsar.functions.function import Function
from pulsar.functions.context import Context
from pulsar.functions.serde import SerDe, IdentitySerDe, PickleSerDe

class MessageId:
"""
Expand Down
2 changes: 1 addition & 1 deletion pulsar-client-cpp/python/setup.py
Expand Up @@ -60,7 +60,7 @@ def build_extension(self, ext):
setup(
name="pulsar-client",
version=VERSION,
py_modules=['pulsar'],
packages=['pulsar', 'pulsar.functions'],
cmdclass={'build_ext': my_build_ext},
ext_modules=[Extension('_pulsar', [])],

Expand Down

0 comments on commit 5ba840a

Please sign in to comment.