python-coverage (3.4-1) 02.use-system-js-libraries.patch

Summary

 coverage/html.py               |   21 ++++++++++++++++-----
 coverage/htmlfiles/index.html  |    2 +-
 coverage/htmlfiles/pyfile.html |    2 +-
 3 files changed, 18 insertions(+), 7 deletions(-)

    
download this patch

Patch contents

Description: Use Debian system ECMAScript libraries.
Origin: Created to address Debian Bug#596212.
Author: Ben Finney <ben+debian@benfinney.id.au>
Last-Update: 2011-07-27

diff -r 609f75d136a3 coverage/html.py
--- a/coverage/html.py	Wed Jul 27 13:28:51 2011 +1000
+++ b/coverage/html.py	Wed Jul 27 14:39:37 2011 +1000
@@ -55,13 +55,24 @@
     def make_local_static_report_files(self):
         """ Make local instances of static files for HTML report. """
         for static in [
-            "style.css", "coverage_html.js",
-            "jquery-1.3.2.min.js", "jquery-tablesorter.min.js",
-            ]:
+                "style.css", "coverage_html.js",
+                ]:
             shutil.copyfile(
                 data_filename("htmlfiles/" + static),
-                os.path.join(self.directory, static)
-                )
+                os.path.join(self.directory, static))
+
+        system_javascript_path = os.path.join(
+                os.sep, "usr", "share", "javascript")
+        system_javascript_libraries = {
+                "jquery.min.js":
+                    os.path.join(system_javascript_path, "jquery"),
+                "jquery.tablesorter.min.js":
+                    os.path.join(system_javascript_path, "jquery-tablesorter"),
+                }
+        for static, source_dir in system_javascript_libraries.items():
+            os.symlink(
+                    os.path.join(source_dir, static),
+                    os.path.join(self.directory, static))
 
     def html_file(self, cu, analysis):
         """Generate an HTML file for one source file."""
diff -r 609f75d136a3 coverage/htmlfiles/index.html
--- a/coverage/htmlfiles/index.html	Wed Jul 27 13:28:51 2011 +1000
+++ b/coverage/htmlfiles/index.html	Wed Jul 27 14:39:37 2011 +1000
@@ -4,7 +4,7 @@
     <meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
     <title>Coverage report</title>
     <link rel='stylesheet' href='style.css' type='text/css'>
-    <script type='text/javascript' src='jquery-1.3.2.min.js'></script>
+    <script type='text/javascript' src='jquery.min.js'></script>
     <script type='text/javascript' src='jquery.tablesorter.min.js'></script>
     <script type='text/javascript' src='coverage_html.js'></script>
     <script type='text/javascript' charset='utf-8'>
diff -r 609f75d136a3 coverage/htmlfiles/pyfile.html
--- a/coverage/htmlfiles/pyfile.html	Wed Jul 27 13:28:51 2011 +1000
+++ b/coverage/htmlfiles/pyfile.html	Wed Jul 27 14:39:37 2011 +1000
@@ -7,7 +7,7 @@
     <meta http-equiv='X-UA-Compatible' content='IE=emulateIE7' />
     <title>Coverage for {{cu.name|escape}}: {{nums.pc_covered_str}}%</title>
     <link rel='stylesheet' href='style.css' type='text/css'>
-    <script type='text/javascript' src='jquery-1.3.2.min.js'></script>
+    <script type='text/javascript' src='jquery.min.js'></script>
     <script type='text/javascript' src='coverage_html.js'></script>
     <script type='text/javascript' charset='utf-8'>
         jQuery(document).ready(pyfile_ready);