[PATCH 3/6] waf: Fix freebsd-to-rtems.py.

Christian Mauderer christian.mauderer at embedded-brains.de
Mon Apr 9 07:13:20 UTC 2018


Am 09.04.2018 um 03:36 schrieb Chris Johns:
> On 06/04/2018 22:26, Christian Mauderer wrote:
>> Update #3351
>> ---
>>  builder.py          | 3 +++
>>  freebsd-to-rtems.py | 3 ++-
>>  waf_libbsd.py       | 7 +++++--
>>  3 files changed, 10 insertions(+), 3 deletions(-)
>>
>> diff --git a/builder.py b/builder.py
>> index 2faf98d0..ac199a9b 100755
>> --- a/builder.py
>> +++ b/builder.py
>> @@ -677,3 +677,6 @@ class ModuleManager(object):
>>      def generateBuild(self):
>>          for m in self.getEnabledModules():
>>              self.modules[m].generate()
>> +
>> +    def setGenerators(self):
>> +        pass
>> diff --git a/freebsd-to-rtems.py b/freebsd-to-rtems.py
>> index c2f00f86..ec0fcc9a 100755
>> --- a/freebsd-to-rtems.py
>> +++ b/freebsd-to-rtems.py
>> @@ -43,6 +43,7 @@ import getopt
>>  
>>  import builder
>>  import libbsd
>> +import waf_libbsd
> 
> I am not comfortable with this happening.
> 
> What functionality in waf_libbsd do you need here?
> 
> Can it be moved to the builder class?

The first patch replaced

    wafGen = waf_generator.ModuleManager()

by

    build = builder.ModuleManager()

in freebsd_to_rtems.py. The ModuleManager class calls

    self.setGenerators()

during init. But the setGenerators() isn't defined in ModuleManager but
only in the derived classes. Prior to the change from the first commit,
that has been the waf_generator.ModuleManager. But you moved it to the
builder. Therefore I used the waf_libbsd.Builder() instead.

If we want to avoid that change, we need the generators in the base
class. I can move them if you want.

> 
>>  
>>  isForward = True
>>  isEarlyExit = False
>> @@ -142,7 +143,7 @@ if isEarlyExit == True:
>>      sys.exit(0)
>>  
>>  try:
>> -    build = builder.ModuleManager()
>> +    build = waf_libbsd.Builder()
>>      libbsd.load(build)
>>      build.generateBuild()
>>      build.processSource(isForward)
>> diff --git a/waf_libbsd.py b/waf_libbsd.py
>> index eddfaf99..ae8a1ea0 100644
>> --- a/waf_libbsd.py
>> +++ b/waf_libbsd.py
>> @@ -40,8 +40,6 @@ import tempfile
>>  
>>  import builder
>>  
>> -import rtems_waf.rtems as rtems
> 
> I like this being here because it is loud and clear this is an RTEMS waf app.

Reason for that is the same as above: The derived Builder is now used in
the freebsd-to-rtems.py. The rtems_waf.rtems imports waflib which isn't
available in that context.

> 
>> -
>>  windows = os.name == 'nt'
>>  
>>  if windows:
>> @@ -316,6 +314,11 @@ class Builder(builder.ModuleManager):
>>          pass
>>  
>>      def build(self, bld):
>> +        # This is only necessary for build. But it depends on the waflib which
>> +        # is only available in a waf context. But we need the module manager for
>> +        # freebsd_to_rtems.py too.
> 
> If functionality is to be shared it should be moved to the base module.
> 
> Chris
> 
>> +        import rtems_waf.rtems as rtems
>> +
>>          #
>>          # Localize the config.
>>          #
>>

-- 
--------------------------------------------
embedded brains GmbH
Herr Christian Mauderer
Dornierstr. 4
D-82178 Puchheim
Germany
email: christian.mauderer at embedded-brains.de
Phone: +49-89-18 94 741 - 18
Fax:   +49-89-18 94 741 - 08
PGP: Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list