Skip to content

Include C3 monitoring interceptors and update packaging validation #464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
environment:
global:
LIBRDKAFKA_NUGET_VERSION: 0.11.6-RC3
LIBRDKAFKA_NUGET_VERSION: 0.11.6-RC5
CIBW_SKIP: cp33-* cp34-*
CIBW_TEST_REQUIRES: pytest requests avro
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ wheelhouse
dl-*
*.whl
.pytest_cache
staging
33 changes: 18 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
matrix:
include:
# Source package verification with Python 2.7 and librdkafka v0.11.6-RC3
# Source package verification with Python 2.7 and librdkafka v0.11.6-RC5
- os: linux
language: python
dist: trusty
python: "2.7"
env: LD_LIBRARY_PATH="$PWD/tmp-build/lib" LIBRDKAFKA_VERSION=v0.11.6-RC3
# Source package verification with Python 3.6 and librdkafka v0.11.6-RC3
env: LD_LIBRARY_PATH="$PWD/tmp-build/lib" LIBRDKAFKA_VERSION=v0.11.6-RC5
# Source package verification with Python 3.6 and librdkafka v0.11.6-RC5
- os: linux
language: python
dist: trusty
python: "3.6"
env: LD_LIBRARY_PATH="$PWD/tmp-build/lib" LIBRDKAFKA_VERSION=v0.11.6-RC3
# Source package verification with Python 2.7 and librdkafka v0.11.6-RC3
env: LD_LIBRARY_PATH="$PWD/tmp-build/lib" LIBRDKAFKA_VERSION=v0.11.6-RC5
# Source package verification with Python 2.7 and librdkafka v0.11.6-RC5
- os: osx
python: "2.7"
env: LD_LIBRARY_PATH="$PWD/tmp-build/lib" LIBRDKAFKA_VERSION=v0.11.6-RC3
env: DYLD_LIBRARY_PATH="$PWD/tmp-build/lib" LIBRDKAFKA_VERSION=v0.11.6-RC5
before_install:
- pip install -U pip && pip install virtualenv
- brew update && brew upgrade pyenv
- pyenv install -f 2.7.15
- pip install virtualenv
- virtualenv -p ~/.pyenv/versions/2.7.15/bin/python ./env
- source env/bin/activate
# Source package verification with Python 3.6 and librdkafka v0.11.6-RC3
# Source package verification with Python 3.6 and librdkafka v0.11.6-RC5
- os: osx
python: "3.6"
env: LD_LIBRARY_PATH="$PWD/tmp-build/lib" LIBRDKAFKA_VERSION=v0.11.6-RC3
env: DYLD_LIBRARY_PATH="$PWD/tmp-build/lib" LIBRDKAFKA_VERSION=v0.11.6-RC5
before_install:
- pip install -U pip && pip install virtualenv
- brew update && brew upgrade pyenv
Expand All @@ -36,35 +36,38 @@ matrix:
- source env/bin/activate
# cibuildwheel for osx
- os: osx
env: CIBW_BEFORE_BUILD="tools/bootstrap-librdkafka.sh --require-ssl v0.11.6-RC3 tmp" CFLAGS="-Itmp/include" LDFLAGS="-Ltmp/lib"
env: CIBW_BEFORE_BUILD="tools/bootstrap-librdkafka.sh --require-ssl v0.11.6-RC5 tmp" CFLAGS="-Itmp/include" LDFLAGS="-Ltmp/lib"
before_install:
- brew update && brew upgrade pyenv
- pip install virtualenv
# cibuildwheel for manylinux
- os: linux
dist: trusty
sudo: required
env: CIBW_BEFORE_BUILD="tools/prepare-cibuildwheel-linux.sh v0.11.6-RC3"
env: CIBW_BEFORE_BUILD="tools/prepare-cibuildwheel-linux.sh v0.11.6-RC5"
language: python
python: "2.7"
services: docker

install:
- tools/install-interceptors.sh
- pip install -U pip && pip install virtualenv
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then python -m ensurepip && virtualenv /tmp/venv && source /tmp/venv/bin/activate ; fi
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then rvm get stable; fi
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then rvm get stable; fi
- if [[ -z $CIBW_BEFORE_BUILD ]]; then pip install pytest-timeout flake8 ; fi
- if [[ -z $CIBW_BEFORE_BUILD ]]; then rm -rf tmp-build ; tools/bootstrap-librdkafka.sh --require-ssl ${LIBRDKAFKA_VERSION} tmp-build ; fi
- if [[ -n $TRAVIS_TAG && -n $CIBW_BEFORE_BUILD ]]; then pip install cibuildwheel; fi


script:
- if [[ -z $CIBW_BEFORE_BUILD ]]; then pip install -v --global-option=build_ext --global-option="-Itmp-build/include/" --global-option="-Ltmp-build/lib" . .[avro] ; fi
- if [[ -z $CIBW_BEFORE_BUILD ]]; then flake8 ; fi
- if [[ -z $CIBW_BEFORE_BUILD ]]; then py.test -v --timeout 20 --ignore=tmp-build --import-mode append ; fi
- if [[ -n $TRAVIS_TAG && -n $CIBW_BEFORE_BUILD ]]; then cibuildwheel --output-dir wheelhouse ; ls -la wheelhouse/ ; fi
# Make plugins available for tests
- ldd staging/libs/* || otool -L staging/libs/* || true
- if [[ -z $CIBW_BEFORE_BUILD && $TRAVIS_OS_NAME == "osx" ]]; then DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:staging/libs py.test -v --timeout 20 --ignore=tmp-build --import-mode append ; fi
- if [[ -z $CIBW_BEFORE_BUILD && $TRAVIS_OS_NAME == "linux" ]]; then LD_LIBRARY_PATH=$LD_LIBRARY_PATH:staging/libs py.test -v --timeout 20 --ignore=tmp-build --import-mode append ; fi
- if [[ -n $TRAVIS_TAG && -n $CIBW_BEFORE_BUILD ]]; then cibuildwheel --output-dir wheelhouse1 && tools/fixup-wheels.sh wheelhouse1 wheelhouse ; fi
- if [[ -n $TRAVIS_TAG && $TRAVIS_OS_NAME == linux && -n $CIBW_BEFORE_BUILD ]]; then tools/test-manylinux.sh ; fi

- if [[ -n $TRAVIS_TAG && $TRAVIS_OS_NAME == osx && -n $CIBW_BEFORE_BUILD ]]; then tools/test-osx.sh; fi

deploy:
provider: s3
Expand Down
58 changes: 58 additions & 0 deletions confluent_kafka/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,61 @@ def __init__(self, broker_name,

def __str__(self):
return "{}/{} throttled for {} ms".format(self.broker_name, self.broker_id, int(self.throttle_time * 1000))


def _resolve_plugins(plugins):
""" Resolve embedded plugins from the wheel's library directory.

For internal module use only.

:param str plugins: The plugin.library.paths value
"""
import os
from sys import platform

# Location of __init__.py and the embedded library directory
basedir = os.path.dirname(__file__)

if platform in ('win32', 'cygwin'):
paths_sep = ';'
ext = '.dll'
libdir = basedir
elif platform in ('linux', 'linux2'):
paths_sep = ':'
ext = '.so'
libdir = os.path.join(basedir, '.libs')
elif platform == 'darwin':
paths_sep = ':'
ext = '.dylib'
libdir = os.path.join(basedir, '.dylibs')
else:
# Unknown platform, there are probably no embedded plugins.
return plugins

if not os.path.isdir(libdir):
# No embedded library directory, probably not a wheel installation.
return plugins

resolved = []
for plugin in plugins.split(paths_sep):
if '/' in plugin or '\\' in plugin:
# Path specified, leave unchanged
resolved.append(plugin)
continue

# See if the plugin can be found in the wheel's
# embedded library directory.
# The user might not have supplied a file extension, so try both.
good = None
for file in [plugin, plugin + ext]:
fpath = os.path.join(libdir, file)
if os.path.isfile(fpath):
good = fpath
break

if good is not None:
resolved.append(good)
else:
resolved.append(plugin)

return paths_sep.join(resolved)
Loading