<div dir="ltr"><div dir="ltr"><br><br><br><div class="gmail_quote"><div dir="ltr">On Sun, 28 Oct 2018 at 09:00, 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 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 = 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, 'covoar.css')<br>
> for symbol_set in self.symbol_sets:<br>
> symbol_set_dir = path.join(self.build_dir,<br>
> self.bsp + '-coverage', 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', 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></blockquote><div>shutil is portable as it comes with python. i looked into the path.copy_tree</div><div>it uses shutil as well, but it requires the source-name to be a directory</div><div>wherefrom it will copy all the files to destination directory.</div><div><br></div><div>Is there a reason that path.copy_tree has been used instead of shutil.copytree ?</div><div><a href="https://docs.python.org/2/library/shutil.html#shutil.copytree">https://docs.python.org/2/library/shutil.html#shutil.copytree</a> </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Chris<br>
<br>
> <br>
> class build_path_generator(object):<br>
> '''<br>
> @@ -402,7 +393,7 @@ class coverage_run(object):<br>
> self.rtdir,<br>
> self.macros['bsp'])<br>
> report.generate()<br>
> - report.add_covoar_src_path()<br>
> + report.add_covoar_css()<br>
> <br>
> def _cleanup(self):<br>
> if not self.no_clean:<br>
> <br>
</blockquote></div></div></div>