<div dir="ltr"><div dir="ltr"><br><br><br><div class="gmail_quote"><div dir="ltr">On Sun, 28 Oct 2018 at 15:46, Chris Johns <<a href="mailto:chrisj@rtems.org">chrisj@rtems.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 28/10/18 8:33 pm, Vijay Kumar Banerjee wrote:<br>
> On Sun, 28 Oct 2018 at 09:00, Chris Johns <<a href="mailto:chrisj@rtems.org" target="_blank">chrisj@rtems.org</a> <br>
> <mailto:<a href="mailto:chrisj@rtems.org" target="_blank">chrisj@rtems.org</a>>> wrote:<br>
> <br>
>     On 27/10/18 5:13 am, Vijay Kumar Banerjee wrote:<br>
>      > ---<br>
>      >   tester/rt/coverage.py | 17 ++++-------------<br>
>      >   1 file changed, 4 insertions(+), 13 deletions(-)<br>
>      ><br>
>      > diff --git a/tester/rt/coverage.py b/tester/rt/coverage.py<br>
>      > index 978a8c4..4200dad 100644<br>
>      > --- a/tester/rt/coverage.py<br>
>      > +++ b/tester/rt/coverage.py<br>
>      > @@ -201,23 +201,14 @@ class report_gen_html:<br>
>      >           index_content =<br>
>     self._prepare_index_content(partial_reports)<br>
>      >           self._create_index_file(head_section,index_content)<br>
>      ><br>
>      > -    def add_covoar_src_path(self):<br>
>      > +    def add_covoar_css(self):<br>
>      >           table_js_path = path.join(self.covoar_src_path, 'table.js')<br>
>      >           covoar_css_path = path.join(self.covoar_src_path,<br>
>     'covoar.css')<br>
>      >           for symbol_set in self.symbol_sets:<br>
>      >               symbol_set_dir = path.join(self.build_dir,<br>
>      >                                          self.bsp + '-coverage',<br>
>     symbol_set)<br>
>      > -            html_files = os.listdir(symbol_set_dir)<br>
>      > -            for html_file in html_files:<br>
>      > -                html_file = path.join(symbol_set_dir, html_file)<br>
>      > -                if path.exists(html_file) and 'html' in html_file:<br>
>      > -                    with open(html_file, 'r') as f:<br>
>      > -                        file_data = f.read()<br>
>      > -                    file_data = file_data.replace('table.js',<br>
>     table_js_path)<br>
>      > -                    file_data = file_data.replace('covoar.css',<br>
>      > -                                                  covoar_css_path)<br>
>      > -                    with open(html_file, 'w') as f:<br>
>      > -                        f.write(file_data)<br>
>      > +            shutil.copy(covoar_css_path, symbol_set_dir)<br>
>      > +            shutil.copy(table_js_path, symbol_set_dir)<br>
> <br>
>     How portable are these calls?<br>
> <br>
>     Please have a look at 'path.copy_tree' in the rtemstoolkit's path.py. I<br>
>     think you can use that call instead.<br>
> <br>
> shutil is portable as it comes with python. <br>
<br>
It does not handle some issues on Windows.<br>
<br>
> i looked into the path.copy_tree<br>
> it uses shutil as well, <br>
<br>
It does but it handles some issues expose in the RSB over many years.<br></blockquote><div>Understood. </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> but it requires the source-name to be a directory<br>
> wherefrom it will copy all the files to destination directory.<br>
<br>
It can be extended.<br></blockquote><div>I'm getting a 'Not a directory' error as it uses listdir on the srcpath and then iterates over the</div><div>files. Shall I write a path.copy for it ? with the WindowsError handling similar to</div><div>copy_tree ?  </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> Is there a reason that path.copy_tree has been used instead of <br>
> shutil.copytree ?<br>
> <a href="https://docs.python.org/2/library/shutil.html#shutil.copytree" rel="noreferrer" target="_blank">https://docs.python.org/2/library/shutil.html#shutil.copytree</a><br>
<br>
It can break on Windows.<br>
<br>
Please use the path module for all file operations to we can be <br>
portable. I think one call was pushed in the other patch which Joel <br>
merged that needs to be fixed.</blockquote><div>Sorry about that. I didn't know that it breaks on Windows.</div><div>Can you please comment on the patch so that I can fix it? </div><div>I'll ping you there. :) </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Chris<br>
</blockquote></div></div></div>