@@ -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 ()
170197else :
@@ -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