|
|
| 294 |
# self.threat_patch(env) |
294 |
# self.threat_patch(env) |
| 295 |
|
295 |
|
| 296 |
# TODO: Add the options, there is no space for the configure_arguments |
296 |
# TODO: Add the options, there is no space for the configure_arguments |
| 297 |
env.run(['python', os.path.join(env.srcdir, 'setup.py'), 'build', |
297 |
env.run([sys.executable, os.path.join(env.srcdir, 'setup.py'), 'build', |
| 298 |
'--build-base=' + env.objdir], directory=env.srcdir) |
298 |
'--build-base=' + env.objdir], directory=env.srcdir) |
| 299 |
|
299 |
|
| 300 |
if self.attribute('no_installation').value != True: |
300 |
if self.attribute('no_installation').value != True: |
|
|
| 302 |
if(env.sudoEnabled): |
302 |
if(env.sudoEnabled): |
| 303 |
sudoOp = ['sudo'] |
303 |
sudoOp = ['sudo'] |
| 304 |
|
304 |
|
| 305 |
env.run(sudoOp + ['python', os.path.join(env.srcdir, 'setup.py'), 'install', |
305 |
env.run(sudoOp + [sys.executable, os.path.join(env.srcdir, 'setup.py'), 'install', |
| 306 |
'--install-base=' + env.installdir, |
306 |
'--install-base=' + env.installdir, |
| 307 |
'--install-purelib=' + env.installdir + '/lib', |
307 |
'--install-purelib=' + env.installdir + '/lib', |
| 308 |
# --install-platlib=' + env.installdir + '/lib.$PLAT, |
308 |
# --install-platlib=' + env.installdir + '/lib.$PLAT, |
| 309 |
'--install-scripts=' + env.installdir + '/scripts', |
309 |
'--install-scripts=' + env.installdir + '/scripts', |
|
|
| 317 |
to remove the older code. |
317 |
to remove the older code. |
| 318 |
""" |
318 |
""" |
| 319 |
|
319 |
|
| 320 |
env.run(['python', os.path.join(env.srcdir, 'setup.py'), 'clean', |
320 |
env.run([sys.executable, os.path.join(env.srcdir, 'setup.py'), 'clean', |
| 321 |
'--build-base=' + env.objdir], |
321 |
'--build-base=' + env.objdir], |
| 322 |
directory=env.srcdir) |
322 |
directory=env.srcdir) |
| 323 |
|
323 |
|
|
|
| 326 |
to remove the older code. |
326 |
to remove the older code. |
| 327 |
""" |
327 |
""" |
| 328 |
|
328 |
|
| 329 |
env.run(['python', os.path.join(env.srcdir, 'setup.py'), 'distclean'], |
329 |
env.run([sys.executable, os.path.join(env.srcdir, 'setup.py'), 'distclean'], |
| 330 |
directory=env.srcdir) |
330 |
directory=env.srcdir) |
| 331 |
|
331 |
|
| 332 |
def check_version(self, env): |
332 |
def check_version(self, env): |
| 333 |
"""Verifies only if python exists in the machine.""" |
333 |
"""Verifies only if python exists in the machine.""" |
| 334 |
|
334 |
|
| 335 |
try: |
335 |
try: |
| 336 |
env.run(['python', '--version']) |
336 |
env.run([sys.executable, '--version']) |
| 337 |
except TaskError as e: |
337 |
except TaskError as e: |
| 338 |
return False |
338 |
return False |
| 339 |
|
339 |
|
|
|
| 370 |
waf_binary = os.path.join(srcdir, 'waf') |
370 |
waf_binary = os.path.join(srcdir, 'waf') |
| 371 |
else: |
371 |
else: |
| 372 |
waf_binary = 'waf' |
372 |
waf_binary = 'waf' |
| 373 |
return waf_binary |
373 |
return [sys.executable, waf_binary] |
| 374 |
|
374 |
|
| 375 |
def _env(self, objdir): |
375 |
def _env(self, objdir): |
| 376 |
""" Verifies if the main environment variables where defined and |
376 |
""" Verifies if the main environment variables where defined and |
|
|
| 390 |
# env['WAFLOCK'] = '.lock-waf_%s_build'%sys.platform #'.lock-%s' % os.path.basename(objdir) |
390 |
# env['WAFLOCK'] = '.lock-waf_%s_build'%sys.platform #'.lock-%s' % os.path.basename(objdir) |
| 391 |
return env |
391 |
return env |
| 392 |
|
392 |
|
| 393 |
def _is_1_6_x(self, env): |
|
|
| 394 |
""" Searches for the waf version, it should be bigger than 1.6.0.""" |
| 395 |
|
| 396 |
return env.check_program(self._binary(env.srcdir), version_arg='--version', |
| 397 |
version_regexp=b'(\d+)\.(\d+)\.(\d+)', |
| 398 |
version_required=(1, 6, 0)) |
| 399 |
|
| 400 |
def build(self, env, jobs): |
393 |
def build(self, env, jobs): |
| 401 |
""" Specific build implementation method. In order: |
394 |
""" Specific build implementation method. In order: |
| 402 |
1. It apply possible patches, |
395 |
1. It apply possible patches, |
|
|
| 413 |
extra_configure_options = [env.replace_variables(tmp) for tmp in |
406 |
extra_configure_options = [env.replace_variables(tmp) for tmp in |
| 414 |
bake.Utils.split_args(env.replace_variables(self.attribute('configure_arguments').value))] |
407 |
bake.Utils.split_args(env.replace_variables(self.attribute('configure_arguments').value))] |
| 415 |
|
408 |
|
| 416 |
if self._is_1_6_x(env): |
409 |
env.run(self._binary(env.srcdir) + extra_configure_options, |
| 417 |
env.run([self._binary(env.srcdir)] + extra_configure_options, |
410 |
directory=env.srcdir, |
| 418 |
directory=env.srcdir, |
411 |
env=self._env(env.objdir)) |
| 419 |
env=self._env(env.objdir)) |
|
|
| 420 |
else: |
| 421 |
env.run([self._binary(env.srcdir)] + extra_configure_options, |
| 422 |
directory=env.srcdir, |
| 423 |
env=self._env(env.objdir)) |
| 424 |
|
412 |
|
| 425 |
extra_build_options = [] |
413 |
extra_build_options = [] |
| 426 |
if self.attribute('build_arguments').value != '': |
414 |
if self.attribute('build_arguments').value != '': |
|
|
| 430 |
if not jobs == -1: |
418 |
if not jobs == -1: |
| 431 |
jobsrt = ['-j', str(jobs)] |
419 |
jobsrt = ['-j', str(jobs)] |
| 432 |
|
420 |
|
| 433 |
env.run([self._binary(env.srcdir)] + extra_build_options + jobsrt, |
421 |
env.run(self._binary(env.srcdir) + extra_build_options + jobsrt, |
| 434 |
directory=env.srcdir, |
422 |
directory=env.srcdir, |
| 435 |
env=self._env(env.objdir)) |
423 |
env=self._env(env.objdir)) |
| 436 |
|
424 |
|
|
|
| 442 |
|
430 |
|
| 443 |
try : |
431 |
try : |
| 444 |
options = bake.Utils.split_args(env.replace_variables(self.attribute('install_arguments').value)) |
432 |
options = bake.Utils.split_args(env.replace_variables(self.attribute('install_arguments').value)) |
| 445 |
env.run(sudoOp + [self._binary(env.srcdir), 'install'] + options, |
433 |
env.run(sudoOp + self._binary(env.srcdir) + ['install'] + options, |
| 446 |
directory=env.srcdir, |
434 |
directory=env.srcdir, |
| 447 |
env=self._env(env.objdir)) |
435 |
env=self._env(env.objdir)) |
| 448 |
except TaskError as e: |
436 |
except TaskError as e: |
|
|
| 450 |
' install %s: Verify if you have the required rights. Original' |
438 |
' install %s: Verify if you have the required rights. Original' |
| 451 |
' message: %s' % (env._module_name, e._reason)) |
439 |
' message: %s' % (env._module_name, e._reason)) |
| 452 |
|
440 |
|
| 453 |
|
|
|
| 454 |
def clean(self, env): |
441 |
def clean(self, env): |
| 455 |
""" Call waf with the clean option to remove the results of the |
442 |
""" Call waf with the clean option to remove the results of the |
| 456 |
last build. |
443 |
last build. |
| 457 |
""" |
444 |
""" |
| 458 |
|
445 |
|
| 459 |
env.run([self._binary(env.srcdir), '-k', 'clean'], |
446 |
env.run(self._binary(env.srcdir) + ['-k', 'clean'], |
| 460 |
directory=env.srcdir, |
447 |
directory=env.srcdir, |
| 461 |
env=self._env(env.objdir)) |
448 |
env=self._env(env.objdir)) |
| 462 |
|
449 |
|
|
|
| 465 |
last build. |
452 |
last build. |
| 466 |
""" |
453 |
""" |
| 467 |
|
454 |
|
| 468 |
env.run([self._binary(env.srcdir), '-k', 'distclean'], |
455 |
env.run(self._binary(env.srcdir) + ['-k', 'distclean'], |
| 469 |
directory=env.srcdir, |
456 |
directory=env.srcdir, |
| 470 |
env=self._env(env.objdir)) |
457 |
env=self._env(env.objdir)) |
| 471 |
|
458 |
|
| 472 |
|
|
|
| 473 |
def check_version(self, env): |
459 |
def check_version(self, env): |
| 474 |
""" Verifies the waf version.""" |
460 |
""" Verifies the waf version.""" |
| 475 |
|
461 |
|