[PATCH] rtems_waf: moved "import os.path" to the beginning of "bsp_configure" func def to avoid UnboundLocalError.

Chris Johns chrisj at rtems.org
Sun Sep 11 07:05:50 UTC 2016


Hi,

Thank you for the report and the fix. I have pushed a variation of your 
patch.

I could not use the email as a patch because git did not like it. It 
looks like it contained HTML. It would be good if you could please use 
'git send-email' to posts patches in the future then I can use your patch.

Thanks
Chris

On 09/09/2016 03:27, Saeed Ehteshamifar wrote:
> In function 'bsp_configure' of rtems_bsd.py, when
> conf.options.rtems_libbsd is None, os.path is not imported, which leads
> to "UnboundLocalError: local variable 'os' referenced before assignment"
> error.
>
> This patch tries to avoid that error.
>
> -------------------------
> diff --git a/rtems_bsd.py b/rtems_bsd.py
> index eaff438..6074f4d 100644
> --- a/rtems_bsd.py
> +++ b/rtems_bsd.py
> @@ -48,6 +48,7 @@ def options(opt):
>                      help = 'Path to install RTEMS LibBSD (defauls to
> prefix).')
>
>   def bsp_configure(conf, arch_bsp):
> +    import os.path
>       conf.check(header_name = 'dlfcn.h', features = 'c')
>       if not rtems.check_posix(conf):
>           conf.fatal("RTEMS kernel POSIX support is disabled; configure
> RTEMS with --enable-posix")
> @@ -56,7 +57,6 @@ def bsp_configure(conf, arch_bsp):
>       if conf.options.rtems_libbsd is None:
>           rtems_libbsd_path = conf.env.PREFIX
>       else:
> -        import os.path
>           if not os.path.exists(conf.options.rtems_libbsd):
>               conf.fatal('RTEMS LibBSD not found')
>           rtems_libbsd_path = conf.options.rtems_libbsd
>
>
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>



More information about the devel mailing list