[PATCH] Add post-init hook.

Chris Johns chrisj at rtems.org
Fri Apr 6 04:31:43 UTC 2018


On 05/04/2018 23:29, Christian Mauderer wrote:
> ---
>  rtems.py | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/rtems.py b/rtems.py
> index b2e3285..0882c74 100644
> --- a/rtems.py
> +++ b/rtems.py
> @@ -67,7 +67,7 @@ def options(opt):
>                     dest = 'show_commands',
>                     help = 'Print the commands as strings.')
>  
> -def init(ctx, filters = None, version = None, long_commands = False):
> +def init(ctx, filters = None, version = None, long_commands = False, post_init = None):

Can the handler please be named 'bsp_init`? This makes it consistent with the
configure handler which is called 'bsp_configure'.

>      global rtems_filters
>      global rtems_default_version
>      global rtems_long_commands
> @@ -114,12 +114,14 @@ def init(ctx, filters = None, version = None, long_commands = False):
>          #
>          from waflib.Build import BuildContext, CleanContext, \
>              InstallContext, UninstallContext
> +        context_classes = []

Can the variable please be `contexts`? I am not a fan of types being added to
variable names.

Also could you please fix my spelling of 'contextes' in the comment?

>          for x in arch_bsps:
>              for y in (BuildContext, CleanContext, InstallContext, UninstallContext):
>                  name = y.__name__.replace('Context','').lower()
>                  class context(y):
>                      cmd = name + '-' + x
>                      variant = x
> +                context_classes += [context]
>  
>          #
>          # Transform the command to per BSP commands.
> @@ -135,6 +137,9 @@ def init(ctx, filters = None, version = None, long_commands = False):
>      except:
>          pass
>  
> +    if post_init:
> +        post_init(ctx, env, context_classes)
> +

Name change per above.

Chris

>  def configure(conf, bsp_configure = None):
>      #
>      # Check the environment for any flags.
> 


More information about the devel mailing list