Skip to content

Commit ea29f3d

Browse files
henryyktauvipy
authored andcommitted
Fix manylinux1 (#146)
Remove use of six in setup.py Use cmake to build rabbitmq-c
1 parent eba309a commit ea29f3d

File tree

3 files changed

+43
-11
lines changed

3 files changed

+43
-11
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ rabbitmq-c: submodules
2020

2121

2222
rabbitmq-clean:
23-
-(cd $(RABBIT_DIR) && make clean)
23+
-(cd $(RABBIT_DIR) && make clean || echo "warning... rabbitmq-clean failed")
2424

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

2828
clean-build:
2929
-rm -rf build

build-manylinux1-wheels.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
# Script modified from https://github.com/pypa/python-manylinux-demo
33
set -e -x
44

5-
# Install a system package required by our library
6-
yum install -y librabbitmq-devel make librabbitmq python-devel gcc automake
7-
5+
# Install system packages required by our library
6+
yum install -y cmake openssl-devel gcc automake
87

98
# Compile wheels
109
for PYBIN in /opt/python/*/bin; do
11-
#${PYBIN}/pip install -r /workspace/dev-requirements.txt
10+
(cd /workspace && ${PYBIN}/python setup.py install)
1211
${PYBIN}/pip wheel /workspace/ -w wheelhouse/
1312
done
1413

@@ -20,6 +19,12 @@ done
2019

2120
# Install packages and test
2221
for PYBIN in /opt/python/*/bin/; do
22+
# vine 5.0.0a1 breaks python2
23+
# https://github.com/celery/vine/issues/34
24+
if [[ "$PYBIN" == *"python/cp2"* ]]; then
25+
${PYBIN}/pip install -f "vine==1.3.0"
26+
fi
27+
2328
${PYBIN}/pip install librabbitmq -f /workspace/wheelhouse
2429
${PYBIN}/python -c "import librabbitmq"
2530
#(cd $HOME; ${PYBIN}/nosetests pymanylinuxdemo)

setup.py

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ def append_env(L, e):
5151
sys.argv[1:] = unprocessed
5252

5353
incdirs.append(LRMQSRC())
54+
if find_cmake() != "":
55+
incdirs.append(LRMQDIST('build', 'librabbitmq'))
56+
57+
5458
PyC_files = map(PYCP, [
5559
'connection.c',
5660
])
@@ -107,6 +111,7 @@ def run(self):
107111
here = os.path.abspath(os.getcwd())
108112
config = sysconfig.get_config_vars()
109113
make = find_make()
114+
cmake = find_cmake()
110115

111116
try:
112117
vars = {'ld': config['LDFLAGS'],
@@ -128,21 +133,34 @@ def run(self):
128133
if os.path.isfile('Makefile'):
129134
os.system(' '.join([make, 'submodules']))
130135
else:
131-
os.system(' '.join(['git', 'clone', '-b', 'v0.8.0',
136+
os.system(' '.join(['git', 'clone', '-b', 'v0.8.0',
132137
'https://github.com/alanxz/rabbitmq-c.git',
133138
'rabbitmq-c']))
134139

135140
os.chdir(LRMQDIST())
136141

137-
if not os.path.isfile('configure'):
142+
if cmake == "" and not os.path.isfile('configure'):
138143
print('- autoreconf')
139144
os.system('autoreconf -i')
140145

141-
if not os.path.isfile('config.h'):
146+
if cmake == "" and not os.path.isfile('config.h'):
142147
print('- configure rabbitmq-c...')
143148
if os.system('/bin/sh configure --disable-tools \
144149
--disable-docs --disable-dependency-tracking'):
145150
return
151+
152+
if cmake:
153+
print('- cmake rabbitmq-c...')
154+
if os.system('mkdir -p build'):
155+
return
156+
157+
os.chdir('build')
158+
if os.system(cmake + ' ..'):
159+
return
160+
161+
if os.system(make + ' rabbitmq rabbitmq-static'):
162+
return
163+
146164
finally:
147165
os.environ.update(restore)
148166
finally:
@@ -164,7 +182,16 @@ def find_make(alt=('gmake', 'gnumake', 'make', 'nmake')):
164182
return make
165183

166184

167-
if six.PY2:
185+
def find_cmake():
186+
for path in os.environ['PATH'].split(':'):
187+
make = os.path.join(path, 'cmake')
188+
if os.path.isfile(make):
189+
return make
190+
191+
return ""
192+
193+
194+
if sys.version_info[0] < 3:
168195
with open(os.path.join(BASE_PATH, 'README.rst'), 'U') as f:
169196
long_description = f.read()
170197
else:
@@ -243,7 +270,7 @@ def find_make(alt=('gmake', 'gnumake', 'make', 'nmake')):
243270
license='MPL',
244271
description='AMQP Client using the rabbitmq-c library.',
245272
long_description=long_description,
246-
test_suite="tests",
273+
test_suite="tests",
247274
zip_safe=False,
248275
packages=packages,
249276
cmdclass=cmdclass,

0 commit comments

Comments
 (0)