[PATCH] Coverage: add the style and js files to the symbol-set report directory
Vijay Kumar Banerjee
vijaykumar9597 at gmail.com
Sun Oct 28 11:01:12 UTC 2018
On Sun, 28 Oct 2018 at 15:46, Chris Johns <chrisj at rtems.org> wrote:
> On 28/10/18 8:33 pm, Vijay Kumar Banerjee wrote:
> > On Sun, 28 Oct 2018 at 09:00, Chris Johns <chrisj at rtems.org
> > <mailto:chrisj at rtems.org>> wrote:
> >
> > On 27/10/18 5:13 am, Vijay Kumar Banerjee wrote:
> > > ---
> > > tester/rt/coverage.py | 17 ++++-------------
> > > 1 file changed, 4 insertions(+), 13 deletions(-)
> > >
> > > diff --git a/tester/rt/coverage.py b/tester/rt/coverage.py
> > > index 978a8c4..4200dad 100644
> > > --- a/tester/rt/coverage.py
> > > +++ b/tester/rt/coverage.py
> > > @@ -201,23 +201,14 @@ class report_gen_html:
> > > index_content =
> > self._prepare_index_content(partial_reports)
> > > self._create_index_file(head_section,index_content)
> > >
> > > - def add_covoar_src_path(self):
> > > + def add_covoar_css(self):
> > > table_js_path = path.join(self.covoar_src_path,
> 'table.js')
> > > covoar_css_path = path.join(self.covoar_src_path,
> > 'covoar.css')
> > > for symbol_set in self.symbol_sets:
> > > symbol_set_dir = path.join(self.build_dir,
> > > self.bsp + '-coverage',
> > symbol_set)
> > > - html_files = os.listdir(symbol_set_dir)
> > > - for html_file in html_files:
> > > - html_file = path.join(symbol_set_dir, html_file)
> > > - if path.exists(html_file) and 'html' in
> html_file:
> > > - with open(html_file, 'r') as f:
> > > - file_data = f.read()
> > > - file_data = file_data.replace('table.js',
> > table_js_path)
> > > - file_data = file_data.replace('covoar.css',
> > > -
> covoar_css_path)
> > > - with open(html_file, 'w') as f:
> > > - f.write(file_data)
> > > + shutil.copy(covoar_css_path, symbol_set_dir)
> > > + shutil.copy(table_js_path, symbol_set_dir)
> >
> > How portable are these calls?
> >
> > Please have a look at 'path.copy_tree' in the rtemstoolkit's
> path.py. I
> > think you can use that call instead.
> >
> > shutil is portable as it comes with python.
>
> It does not handle some issues on Windows.
>
> > i looked into the path.copy_tree
> > it uses shutil as well,
>
> It does but it handles some issues expose in the RSB over many years.
>
Understood.
>
> > but it requires the source-name to be a directory
> > wherefrom it will copy all the files to destination directory.
>
> It can be extended.
>
I'm getting a 'Not a directory' error as it uses listdir on the srcpath and
then iterates over the
files. Shall I write a path.copy for it ? with the WindowsError handling
similar to
copy_tree ?
>
> > Is there a reason that path.copy_tree has been used instead of
> > shutil.copytree ?
> > https://docs.python.org/2/library/shutil.html#shutil.copytree
>
> It can break on Windows.
>
> Please use the path module for all file operations to we can be
> portable. I think one call was pushed in the other patch which Joel
> merged that needs to be fixed.
Sorry about that. I didn't know that it breaks on Windows.
Can you please comment on the patch so that I can fix it?
I'll ping you there. :)
>
>
Chris
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20181028/b25e4b21/attachment-0002.html>
More information about the devel
mailing list