[PATCH rtems-net-legacy] bsp_drivers: Use os.path for compatibility with non Unix host
Gedare Bloom
gedare at rtems.org
Thu Apr 15 20:51:28 UTC 2021
On Thu, Apr 15, 2021 at 2:49 PM Vijay Kumar Banerjee <vijay at rtems.org> wrote:
>
> On Thu, Apr 15, 2021 at 2:46 PM Gedare Bloom <gedare at rtems.org> wrote:
> >
> > On Thu, Apr 15, 2021 at 12:01 PM Vijay Kumar Banerjee <vijay at rtems.org> wrote:
> > >
> > > It has been less than 3 days, still pinging it. :)
> > >
> > > On Tue, Apr 13, 2021 at 11:49 PM Vijay Kumar Banerjee <vijay at rtems.org> wrote:
> > > >
> > > > ---
> > > > bsp_drivers.py | 26 +++++++++++++-------------
> > > > 1 file changed, 13 insertions(+), 13 deletions(-)
> > > >
> > > > diff --git a/bsp_drivers.py b/bsp_drivers.py
> > > > index 3ca10c6..4a07847 100644
> > > > --- a/bsp_drivers.py
> > > > +++ b/bsp_drivers.py
> > > > @@ -36,18 +36,18 @@ def bsp_files(bld):
> > > > include_dirs = {}
> > > > include_files = []
> > > >
> > > > - special_case_dirs = {'atsamv': './bsps/arm/atsam',
> > > > - 'lm32_evr': './bsps/lm32',
> > > > - 'lpc24xx_ea': './bsps/arm/shared/'}
> > > > + special_case_dirs = {'atsamv': 'bsps/arm/atsam',
> > should these be using also os.path.join(...)?
>
> I have used os.path.expanduser to handle this below ...
>
> >
> > > > + 'lm32_evr': 'bsps/lm32',
> > > > + 'lpc24xx_ea': 'bsps/arm/shared/'}
> > > > special_case_sources = {'leon2':
> > > > - ['./bsps/shared/grlib/net/network_interface_add.c',
> > > > - './bsps/shared/grlib/net/greth.c'],
> > > > + ['bsps/shared/grlib/net/network_interface_add.c',
> > > > + 'bsps/shared/grlib/net/greth.c'],
> > > > 'leon3':
> > > > - ['./bsps/shared/grlib/net/network_interface_add.c',
> > > > - './bsps/shared/grlib/net/greth.c'],
> > > > + ['bsps/shared/grlib/net/network_interface_add.c',
> > > > + 'bsps/shared/grlib/net/greth.c'],
> > > > 'griscv':
> > > > - ['./bsps/shared/grlib/net/network_interface_add.c',
> > > > - './bsps/shared/grlib/net/greth.c']}
> > > > + ['bsps/shared/grlib/net/network_interface_add.c',
> > > > + 'bsps/shared/grlib/net/greth.c']}
> > > >
> > > > bsp_list = bld.env.RTEMS_ARCH_BSP_LIST
> > > >
> > > > @@ -57,9 +57,9 @@ def bsp_files(bld):
> > > > include_dirs[bsp] = []
> > > > source_files[bsp] = []
> > > > if bsp not in special_case_dirs:
> > > > - source_dir = os.walk(os.path.join('./bsps', arch, bsp))
> > > > + source_dir = os.walk(os.path.join('bsps', arch, bsp))
> > > > else:
> > > > - source_dir = os.walk(special_case_dirs[bsp])
> > > > + source_dir = os.walk(os.path.expanduser(special_case_dirs[bsp]))
> Here ^
>
> Is this approach alright? expanduser will handle the path according to
> the host and give the right kind of output.
>
Can you use the expanduser call at the definition site? It is easier
then to audit/review code that way.
> > > > for root, dirs, files in source_dir:
> > > > for name in files:
> > > > ext = os.path.splitext(name)[1]
> > > > @@ -69,6 +69,6 @@ def bsp_files(bld):
> > > > if root not in include_dirs[bsp]:
> > > > include_dirs[bsp].append(root)
> > > > if bsp in special_case_sources:
> > > > - source_files[bsp].extend(special_case_sources[bsp])
> > > > - include_dirs[bsp].append(os.path.join('./bsps', arch, bsp, 'net'))
> > > > + source_files[bsp].extend([os.path.expanduser(f) for f in special_case_sources[bsp]])
> > > > + include_dirs[bsp].append(os.path.join('bsps', arch, bsp, 'net'))
> > > > return (include_dirs, source_files)
> > > > --
> > > > 2.26.2
> > > >
More information about the devel
mailing list