Wraps :py:func:`waflib.Context.Context.execute` on the context class
(self)
| 567 | Decorator that enables context commands to run *configure* as needed. |
| 568 | """ |
| 569 | def execute(self): |
| 570 | """ |
| 571 | Wraps :py:func:`waflib.Context.Context.execute` on the context class |
| 572 | """ |
| 573 | if not Configure.autoconfig: |
| 574 | return execute_method(self) |
| 575 | |
| 576 | env = ConfigSet.ConfigSet() |
| 577 | do_config = False |
| 578 | try: |
| 579 | env.load(os.path.join(Context.top_dir, Options.lockfile)) |
| 580 | except EnvironmentError: |
| 581 | Logs.warn('Configuring the project') |
| 582 | do_config = True |
| 583 | else: |
| 584 | if env.run_dir != Context.run_dir: |
| 585 | do_config = True |
| 586 | else: |
| 587 | h = 0 |
| 588 | for f in env.files: |
| 589 | try: |
| 590 | h = Utils.h_list((h, Utils.readf(f, 'rb'))) |
| 591 | except EnvironmentError: |
| 592 | do_config = True |
| 593 | break |
| 594 | else: |
| 595 | do_config = h != env.hash |
| 596 | |
| 597 | if do_config: |
| 598 | cmd = env.config_cmd or 'configure' |
| 599 | if Configure.autoconfig == 'clobber': |
| 600 | tmp = Options.options.__dict__ |
| 601 | if env.options: |
| 602 | Options.options.__dict__ = env.options |
| 603 | try: |
| 604 | run_command(cmd) |
| 605 | finally: |
| 606 | Options.options.__dict__ = tmp |
| 607 | else: |
| 608 | run_command(cmd) |
| 609 | run_command(self.cmd) |
| 610 | else: |
| 611 | return execute_method(self) |
| 612 | return execute |
| 613 | Build.BuildContext.execute = autoconfigure(Build.BuildContext.execute) |
| 614 |