[PATCH rtems-net-legacy] netlegacy: Use os.path to get the file extension

Gedare Bloom gedare at rtems.org
Sat Apr 3 14:36:05 UTC 2021


looks good

On Fri, Apr 2, 2021 at 7:32 PM Vijay Kumar Banerjee <vijay at rtems.org> wrote:
>
> ---
>  bsp_drivers.py | 5 +++--
>  netlegacy.py   | 5 +++--
>  2 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/bsp_drivers.py b/bsp_drivers.py
> index cb6caa5..3ca10c6 100644
> --- a/bsp_drivers.py
> +++ b/bsp_drivers.py
> @@ -62,9 +62,10 @@ def bsp_files(bld):
>              source_dir = os.walk(special_case_dirs[bsp])
>          for root, dirs, files in source_dir:
>              for name in files:
> -                if name[-2:] == '.c':
> +                ext = os.path.splitext(name)[1]
> +                if ext == '.c':
>                      source_files[bsp].append(os.path.join(root, name))
> -                if name[-2:] == '.h':
> +                if ext == '.h':
>                      if root not in include_dirs[bsp]:
>                          include_dirs[bsp].append(root)
>              if bsp in special_case_sources:
> diff --git a/netlegacy.py b/netlegacy.py
> index 85c523e..f470da2 100644
> --- a/netlegacy.py
> +++ b/netlegacy.py
> @@ -40,9 +40,10 @@ for root, dirs, files in os.walk("."):
>      dirs.append('./bsps/shared/net')
>      include_files[root[2:]] = []
>      for name in files:
> -        if name[-2:] == '.c':
> +        ext = os.path.splitext(name)[1]
> +        if ext == '.c':
>              source_files.append(os.path.join(root, name))
> -        if name[-2:] == '.h' and name not in exclude_headers:
> +        if ext == '.h' and name not in exclude_headers:
>              include_files[root[2:]].append(os.path.join(root, name))
>
>
> --
> 2.26.2
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list