@@ -114,12 +114,13 @@ def system_context(ctx, openzwave=None, static=False):
114
114
#~ os.environ["CC"] = "gcc"
115
115
#~ os.environ["CXX"] = "g++"
116
116
#~ os.environ["PKG_CONFIG_PATH"] = "PKG_CONFIG_PATH:/usr/local/lib/x86_64-linux-gnu/pkgconfig/"
117
+ log .info ("Found platform {0}" .format (sys .platform ))
117
118
if static :
118
119
ctx ['include_dirs' ] += [
119
120
"{0}/cpp/src" .format (openzwave ),
120
121
"{0}/cpp/src/value_classes" .format (openzwave ),
121
122
"{0}/cpp/src/platform" .format (openzwave ) ]
122
- if sys .platform == "win32" :
123
+ if sys .platform . startswith ( "win" ) :
123
124
ctx ['libraries' ] += [ "setupapi" , "msvcrt" , "ws2_32" , "dnsapi" ]
124
125
125
126
if static :
@@ -133,7 +134,20 @@ def system_context(ctx, openzwave=None, static=False):
133
134
for ssubstitute in ['/' , '/value_classes/' , '/platform/' ]:
134
135
ctx ['extra_compile_args' ] += [ extra .replace ('//' , ssubstitute ) ]
135
136
136
- elif sys .platform == "darwin" :
137
+ elif sys .platform .startswith ("cygwin" ):
138
+ if static :
139
+ ctx ['libraries' ] += [ "udev" , "stdc++" ,'resolv' ]
140
+ ctx ['extra_objects' ] = [ "{0}/libopenzwave.a" .format (openzwave ) ]
141
+ ctx ['include_dirs' ] += [ "{0}/cpp/build/linux" .format (openzwave ) ]
142
+ else :
143
+ import pyozw_pkgconfig
144
+ ctx ['libraries' ] += [ "openzwave" ]
145
+ extra = pyozw_pkgconfig .cflags ('libopenzwave' )
146
+ if extra != '' :
147
+ for ssubstitute in ['/' , '/value_classes/' , '/platform/' ]:
148
+ ctx ['extra_compile_args' ] += [ extra .replace ('//' , ssubstitute ) ]
149
+
150
+ elif sys .platform .startswith ("darwin" ) :
137
151
ctx ['extra_link_args' ] += [ "-framework" , "CoreFoundation" , "-framework" , "IOKit" ]
138
152
ctx ['extra_compile_args' ] += [ "-stdlib=libc++" , "-mmacosx-version-min=10.7" ]
139
153
@@ -148,7 +162,7 @@ def system_context(ctx, openzwave=None, static=False):
148
162
for ssubstitute in ['/' , '/value_classes/' , '/platform/' ]:
149
163
ctx ['extra_compile_args' ] += [ extra .replace ('//' , ssubstitute ) ]
150
164
151
- elif sys .platform == "freebsd" :
165
+ elif sys .platform . startswith ( "freebsd" ) :
152
166
if static :
153
167
ctx ['libraries' ] += [ "usb" , "stdc++" ,'resolv' ]
154
168
ctx ['extra_objects' ] = [ "{0}/libopenzwave.a" .format (openzwave ) ]
@@ -161,7 +175,7 @@ def system_context(ctx, openzwave=None, static=False):
161
175
for ssubstitute in ['/' , '/value_classes/' , '/platform/' ]:
162
176
ctx ['extra_compile_args' ] += [ extra .replace ('//' , ssubstitute ) ]
163
177
164
- elif sys .platform [: 5 ] == "linux" :
178
+ elif sys .platform . startswith ( "sunos" ) :
165
179
if static :
166
180
ctx ['libraries' ] += [ "udev" , "stdc++" ,'resolv' ]
167
181
ctx ['extra_objects' ] = [ "{0}/libopenzwave.a" .format (openzwave ) ]
@@ -173,9 +187,23 @@ def system_context(ctx, openzwave=None, static=False):
173
187
if extra != '' :
174
188
for ssubstitute in ['/' , '/value_classes/' , '/platform/' ]:
175
189
ctx ['extra_compile_args' ] += [ extra .replace ('//' , ssubstitute ) ]
190
+
191
+ elif sys .platform .startswith ("linux" ):
192
+ if static :
193
+ ctx ['libraries' ] += [ "udev" , "stdc++" ,'resolv' ]
194
+ ctx ['extra_objects' ] = [ "{0}/libopenzwave.a" .format (openzwave ) ]
195
+ ctx ['include_dirs' ] += [ "{0}/cpp/build/linux" .format (openzwave ) ]
196
+ else :
197
+ import pyozw_pkgconfig
198
+ ctx ['libraries' ] += [ "openzwave" ]
199
+ extra = pyozw_pkgconfig .cflags ('libopenzwave' )
200
+ if extra != '' :
201
+ for ssubstitute in ['/' , '/value_classes/' , '/platform/' ]:
202
+ ctx ['extra_compile_args' ] += [ extra .replace ('//' , ssubstitute ) ]
203
+
176
204
else :
177
205
# Unknown systemm
178
- raise RuntimeError ("Can't detect plateform" )
206
+ raise RuntimeError ("Can't detect plateform {0}" . format ( sys . platform ) )
179
207
180
208
return ctx
181
209
@@ -264,17 +292,24 @@ def printer():
264
292
sys .stderr .write ('{0}\n ' .format (line ))
265
293
log .error ('{0}\n ' .format (line ))
266
294
267
- if sys .platform == "win32" :
295
+ if sys .platform . startswith ( "win" ) :
268
296
proc = Popen ('make' , stdout = PIPE , stderr = PIPE , cwd = '{0}' .format (self .openzwave ))
269
297
270
- elif sys .platform == "darwin" :
298
+ elif sys .platform . startswith ( "cygwin" ) :
271
299
proc = Popen ('make' , stdout = PIPE , stderr = PIPE , cwd = '{0}' .format (self .openzwave ))
272
300
273
- elif sys .platform == "freebsd" :
301
+ elif sys .platform . startswith ( "darwin" ) :
274
302
proc = Popen ('make' , stdout = PIPE , stderr = PIPE , cwd = '{0}' .format (self .openzwave ))
275
303
276
- elif sys .platform [: 5 ] == "linux" :
304
+ elif sys .platform . startswith ( "freebsd" ) :
277
305
proc = Popen ('make' , stdout = PIPE , stderr = PIPE , cwd = '{0}' .format (self .openzwave ))
306
+
307
+ elif sys .platform .startswith ("sunos" ):
308
+ proc = Popen ('make' , stdout = PIPE , stderr = PIPE , cwd = '{0}' .format (self .openzwave ))
309
+
310
+ elif sys .platform .startswith ("linux" ):
311
+ proc = Popen ('make' , stdout = PIPE , stderr = PIPE , cwd = '{0}' .format (self .openzwave ))
312
+
278
313
else :
279
314
# Unknown systemm
280
315
raise RuntimeError ("Can't detect plateform {0}" .format (sys .platform ))
@@ -284,11 +319,11 @@ def printer():
284
319
Thread (target = stream_watcher , name = 'stderr-watcher' ,
285
320
args = ('STDERR' , proc .stderr )).start ()
286
321
287
- printer = Thread (target = printer , name = 'printer' )
288
- printer .start ()
289
- while printer .is_alive ():
322
+ tprinter = Thread (target = printer , name = 'printer' )
323
+ tprinter .start ()
324
+ while tprinter .is_alive ():
290
325
time .sleep (1 )
291
- printer .join ()
326
+ tprinter .join ()
292
327
return True
293
328
294
329
def install_so (self ):
@@ -325,17 +360,24 @@ def printer():
325
360
if identifier == 'STDERR' :
326
361
sys .stderr .write ('{0}\n ' .format (line ))
327
362
log .error ('{0}\n ' .format (line ))
328
- if sys .platform == "win32" :
363
+ if sys .platform . startswith ( "win" ) :
329
364
proc = Popen ([ 'make' , 'install' ], stdout = PIPE , stderr = PIPE , cwd = '{0}' .format (self .openzwave ))
330
365
331
- elif sys .platform == "darwin" :
366
+ elif sys .platform . startswith ( "cygwin" ) :
332
367
proc = Popen ([ 'make' , 'install' ], stdout = PIPE , stderr = PIPE , cwd = '{0}' .format (self .openzwave ))
333
368
334
- elif sys .platform == "freebsd" :
369
+ elif sys .platform . startswith ( "darwin" ) :
335
370
proc = Popen ([ 'make' , 'install' ], stdout = PIPE , stderr = PIPE , cwd = '{0}' .format (self .openzwave ))
336
371
337
- elif sys .platform [: 5 ] == "linux" :
372
+ elif sys .platform . startswith ( "freebsd" ) :
338
373
proc = Popen ([ 'make' , 'install' ], stdout = PIPE , stderr = PIPE , cwd = '{0}' .format (self .openzwave ))
374
+
375
+ elif sys .platform .startswith ("sunos" ):
376
+ proc = Popen ('make' , stdout = PIPE , stderr = PIPE , cwd = '{0}' .format (self .openzwave ))
377
+
378
+ elif sys .platform .startswith ("linux" ):
379
+ proc = Popen ('make' , stdout = PIPE , stderr = PIPE , cwd = '{0}' .format (self .openzwave ))
380
+
339
381
else :
340
382
# Unknown systemm
341
383
raise RuntimeError ("Can't detect plateform {0}" .format (sys .platform ))
@@ -354,17 +396,24 @@ def printer():
354
396
try :
355
397
import pyozw_pkgconfig
356
398
ldpath = pyozw_pkgconfig .libs_only_l ('libopenzwave' )[2 :]
357
- if sys .platform == "win32" :
399
+ if sys .platform . startswith ( "win" ) :
358
400
proc = Popen ([ 'ldconfig' , ldpath ], stdout = PIPE , stderr = PIPE , cwd = '{0}' .format (self .openzwave ))
359
401
360
- elif sys .platform == "darwin" :
402
+ elif sys .platform . startswith ( "cygwin" ) :
361
403
proc = Popen ([ 'ldconfig' , ldpath ], stdout = PIPE , stderr = PIPE , cwd = '{0}' .format (self .openzwave ))
362
404
363
- elif sys .platform == "freebsd" :
405
+ elif sys .platform . startswith ( "darwin" ) :
364
406
proc = Popen ([ 'ldconfig' , ldpath ], stdout = PIPE , stderr = PIPE , cwd = '{0}' .format (self .openzwave ))
365
407
366
- elif sys .platform [: 5 ] == "linux" :
408
+ elif sys .platform . startswith ( "freebsd" ) :
367
409
proc = Popen ([ 'ldconfig' , ldpath ], stdout = PIPE , stderr = PIPE , cwd = '{0}' .format (self .openzwave ))
410
+
411
+ elif sys .platform .startswith ("sunos" ):
412
+ proc = Popen ('make' , stdout = PIPE , stderr = PIPE , cwd = '{0}' .format (self .openzwave ))
413
+
414
+ elif sys .platform .startswith ("linux" ):
415
+ proc = Popen ('make' , stdout = PIPE , stderr = PIPE , cwd = '{0}' .format (self .openzwave ))
416
+
368
417
else :
369
418
# Unknown systemm
370
419
raise RuntimeError ("Can't detect plateform {0}" .format (sys .platform ))
@@ -427,17 +476,24 @@ def printer():
427
476
sys .stderr .write ('{0}\n ' .format (line ))
428
477
log .error ('{0}\n ' .format (line ))
429
478
430
- if sys .platform == "win32" :
479
+ if sys .platform . startswith ( "win" ) :
431
480
proc = Popen ('make clean' , stdout = PIPE , stderr = PIPE , cwd = '{0}' .format (self .openzwave ))
432
481
433
- elif sys .platform == "darwin" :
482
+ elif sys .platform . startswith ( "cygwin" ) :
434
483
proc = Popen ('make clean' , stdout = PIPE , stderr = PIPE , cwd = '{0}' .format (self .openzwave ))
435
484
436
- elif sys .platform == "freebsd clean" :
437
- proc = Popen ('make' , stdout = PIPE , stderr = PIPE , cwd = '{0}' .format (self .openzwave ))
485
+ elif sys .platform . startswith ( "darwin" ) :
486
+ proc = Popen ('make clean ' , stdout = PIPE , stderr = PIPE , cwd = '{0}' .format (self .openzwave ))
438
487
439
- elif sys .platform [: 5 ] == "linux" :
488
+ elif sys .platform . startswith ( "freebsd" ) :
440
489
proc = Popen ('make clean' , stdout = PIPE , stderr = PIPE , cwd = '{0}' .format (self .openzwave ))
490
+
491
+ elif sys .platform .startswith ("sunos" ):
492
+ proc = Popen ('make' , stdout = PIPE , stderr = PIPE , cwd = '{0}' .format (self .openzwave ))
493
+
494
+ elif sys .platform .startswith ("linux" ):
495
+ proc = Popen ('make' , stdout = PIPE , stderr = PIPE , cwd = '{0}' .format (self .openzwave ))
496
+
441
497
else :
442
498
# Unknown systemm
443
499
raise RuntimeError ("Can't detect plateform {0}" .format (sys .platform ))
@@ -941,7 +997,7 @@ def finalize_options(self):
941
997
942
998
def run (self ):
943
999
#In case of --uninstall, it will build openzwave to remove it ... stupid.
944
- #In develop mode, build is donr by the makefile
1000
+ #In develop mode, build is done by the makefile
945
1001
#~ build_openzwave = self.distribution.get_command_obj('build_openzwave')
946
1002
#~ build_openzwave.develop = True
947
1003
#~ self.run_command('build_openzwave')
0 commit comments