Skip to content

Commit

Permalink
Merge branch 'master' into fix_mememory_leak
Browse files Browse the repository at this point in the history
  • Loading branch information
henryykt committed Mar 27, 2020
2 parents a3b4ca0 + 7c0466e commit 5deeada
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 9 deletions.
5 changes: 3 additions & 2 deletions Makefile
Expand Up @@ -20,10 +20,11 @@ rabbitmq-c: submodules


rabbitmq-clean:
-(cd $(RABBIT_DIR) && make clean)
-(rm -rf $(RABBIT_DIR)/build || true)
-(cd $(RABBIT_DIR) && make clean || echo "warning... rabbitmq-clean failed")

rabbitmq-distclean:
-(cd $(RABBIT_DIR) && make distclean)
-(cd $(RABBIT_DIR) && make distclean || echo "warning... rabbitmq-distclean failed")

clean-build:
-rm -rf build
Expand Down
26 changes: 21 additions & 5 deletions build-manylinux1-wheels.sh
Expand Up @@ -2,24 +2,40 @@
# Script modified from https://github.com/pypa/python-manylinux-demo
set -e -x

# Install a system package required by our library
yum install -y librabbitmq-devel make librabbitmq python-devel gcc automake

# Install system packages required by our library
yum install -y cmake openssl-devel gcc automake

# Compile wheels
for PYBIN in /opt/python/*/bin; do
#${PYBIN}/pip install -r /workspace/dev-requirements.txt
# cp27-cp27mu builds fail with: undefined symbol: PyUnicodeUCS2_AsASCIIString
if [[ "${PYBIN}" == *"cp27-cp27mu"* ]]; then
continue
fi

# Ensure a fresh build of rabbitmq-c.
rm -rf /workspace/rabbitmq-c/build
(cd /workspace && ${PYBIN}/python setup.py install)
${PYBIN}/pip wheel /workspace/ -w wheelhouse/
done

# Bundle external shared libraries into the wheels
#ls wheelhouse/*
for whl in wheelhouse/*linux*.whl; do
auditwheel repair $whl -w /workspace/wheelhouse/
done

# Install packages and test
for PYBIN in /opt/python/*/bin/; do
if [[ "${PYBIN}" == *"cp27-cp27mu"* ]]; then
continue
fi

# amqp 5.0.0a1 and vine 5.0.0a1 breaks python2
# https://github.com/celery/vine/issues/34
if [[ "${PYBIN}" == *"python/cp2"* ]]; then
${PYBIN}/pip install --force-reinstall "vine==1.3.0"
${PYBIN}/pip install --force-reinstall "amqp==2.5.2"
fi

${PYBIN}/pip install librabbitmq -f /workspace/wheelhouse
${PYBIN}/python -c "import librabbitmq"
#(cd $HOME; ${PYBIN}/nosetests pymanylinuxdemo)
Expand Down
32 changes: 30 additions & 2 deletions setup.py
Expand Up @@ -51,6 +51,10 @@ def append_env(L, e):
sys.argv[1:] = unprocessed

incdirs.append(LRMQSRC())
if find_cmake() != "":
incdirs.append(LRMQDIST('build', 'librabbitmq'))


PyC_files = map(PYCP, [
'connection.c',
])
Expand Down Expand Up @@ -107,6 +111,7 @@ def run(self):
here = os.path.abspath(os.getcwd())
config = sysconfig.get_config_vars()
make = find_make()
cmake = find_cmake()

try:
vars = {'ld': config['LDFLAGS'],
Expand Down Expand Up @@ -134,15 +139,29 @@ def run(self):

os.chdir(LRMQDIST())

if not os.path.isfile('configure'):
if cmake == "" and not os.path.isfile('configure'):
print('- autoreconf')
os.system('autoreconf -i')

if not os.path.isfile('config.h'):
if cmake == "" and not os.path.isfile('config.h'):
print('- configure rabbitmq-c...')
if os.system('/bin/sh configure --disable-tools \
--disable-docs --disable-dependency-tracking'):
return

if cmake:
print('- cmake rabbitmq-c...')
if os.system('mkdir -p build'):
return

os.chdir('build')
if not os.path.isfile('Makefile'):
if os.system(cmake + ' ..'):
return

if os.system(make + ' rabbitmq rabbitmq-static'):
return

finally:
os.environ.update(restore)
finally:
Expand All @@ -164,6 +183,15 @@ def find_make(alt=('gmake', 'gnumake', 'make', 'nmake')):
return make


def find_cmake():
for path in os.environ['PATH'].split(':'):
make = os.path.join(path, 'cmake')
if os.path.isfile(make):
return make

return ""


if sys.version_info[0] < 3:
with open(os.path.join(BASE_PATH, 'README.rst'), 'U') as f:
long_description = f.read()
Expand Down

0 comments on commit 5deeada

Please sign in to comment.