Changeset 106786 in webkit
- Timestamp:
- Feb 6, 2012 1:23:08 AM (12 years ago)
- Location:
- trunk/Tools
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r106784 r106786 1 2012-02-06 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Fix xrefs after installing API documentation 4 https://bugs.webkit.org/show_bug.cgi?id=77551 5 6 Reviewed by Martin Robinson. 7 8 * GNUmakefile.am: Call generate-gtkdoc --rebase after installing 9 api docs. 10 * gtk/common.py: 11 (prefix_of_pkg_config_file): Get the prefix variable of the given 12 pkg-config file. 13 (gtk_version_of_pkg_config_file): Get the gtk version required by 14 the given pkg-config file. 15 * gtk/generate-gtkdoc: Add --rebase command line option to rebase 16 installed documentation. 17 (get_gtkdoc_module_paths): Get paths where API doc is installed 18 for the dependencies of the given pkg-config file. 19 (get_common_xref_deps): Get API doc directories of dependencies 20 common to WebKit1 and WebKit2. 21 (get_webkit2_options): Add cross_reference_deps option. 22 (get_webkit1_options): Ditto 23 (rebase_installed_docs): Helper function to create a generator for 24 the given pkg-config file and options and call rebase_installed_docs. 25 * gtk/gtkdoc.py: 26 (GTKDoc.__init__): Initialize cross_reference_deps. 27 (GTKDoc._run_gtkdoc_fixxref): Add API doc directories of 28 dependencies. 29 (GTKDoc.rebase_installed_docs): Call gtkdoc-rebase to fix xref 30 links of installed documentation. 31 (PkgConfigGTKDoc.__init__): Get the prefix from the pkg-config 32 file. 33 1 34 2012-02-06 Sergio Villar Senin <svillar@igalia.com> 2 35 -
trunk/Tools/GNUmakefile.am
r106473 r106786 326 326 fi 327 327 endif 328 $(srcdir)/Tools/gtk/generate-gtkdoc --rebase 328 329 329 330 uninstall-local: -
trunk/Tools/gtk/common.py
r101820 r106786 77 77 stdout = process.communicate()[0] 78 78 return int(stdout) 79 80 81 def prefix_of_pkg_config_file(package): 82 process = subprocess.Popen(['pkg-config', '--variable=prefix', package], 83 stdout=subprocess.PIPE) 84 stdout = process.communicate()[0] 85 if process.returncode != 0: 86 return None 87 return stdout.strip() 88 89 90 def gtk_version_of_pkg_config_file(pkg_config_path): 91 process = subprocess.Popen(['pkg-config', pkg_config_path, '--print-requires'], 92 stdout=subprocess.PIPE) 93 stdout = process.communicate()[0] 94 95 if 'gtk+-3.0' in stdout: 96 return 3 97 return 2 -
trunk/Tools/gtk/generate-gtkdoc
r106474 r106786 35 35 handler.setFormatter(logging.Formatter('%(message)s')) 36 36 37 38 def get_gtkdoc_module_paths(xref_dep_packages): 39 deps = [] 40 html_dir = os.path.join('share', 'gtk-doc', 'html') 41 42 for package in xref_dep_packages: 43 prefix = common.prefix_of_pkg_config_file(package) 44 if prefix is None: 45 continue 46 for module in xref_dep_packages[package]: 47 deps.append(os.path.join(prefix, html_dir, module)) 48 49 return deps 50 51 37 52 def get_common_options(): 38 53 return { … … 42 57 } 43 58 59 def get_common_xref_deps(): 60 return { 61 'glib-2.0' : ['glib', 'gobject', 'gio'], 62 'libsoup-2.4' : ['libsoup-2.4'], 63 'gdk-pixbuf-2.0': ['gdk-pixbuf'] 64 } 65 44 66 def get_webkit2_options(): 45 67 def derived_sources_path(*args): … … 47 69 def src_path(*args): 48 70 return common.top_level_path(*(('Source', 'WebKit2', 'UIProcess', 'API', 'gtk') + args)) 71 72 xref_deps = get_common_xref_deps().copy() 73 xref_deps.update({ 74 'gtk+-3.0' : ['gtk3', 'gdk3'] 75 }) 49 76 50 77 options = get_common_options().copy() … … 59 86 ' -I' + common.top_level_path('Source') + \ 60 87 ' -I' + src_path(), 88 'cross_reference_deps' : get_gtkdoc_module_paths(xref_deps), 61 89 'ignored_files': glob.glob(src_path('*Private.h')) + \ 62 90 glob.glob(src_path('*Client*')) + \ … … 66 94 return options 67 95 68 def get_webkit1_options( ):96 def get_webkit1_options(gtk_version): 69 97 def src_path(*args): 70 98 return common.top_level_path(*(('Source', 'WebKit', 'gtk') + args)) 99 100 xref_deps = get_common_xref_deps().copy() 101 if gtk_version == 3: 102 xref_deps.update({ 103 'gtk+-3.0' : ['gtk3', 'gdk3'] 104 }) 105 else: 106 xref_deps.update({ 107 'gtk+-2.0' : ['gtk', 'gdk'] 108 }) 71 109 72 110 options = get_common_options().copy() … … 81 119 ' -I' + common.top_level_path('Source') + \ 82 120 ' -I' + common.top_level_path('Source', 'JavaScriptCore', 'ForwardingHeaders'), 121 'cross_reference_deps' : get_gtkdoc_module_paths(xref_deps), 83 122 'ignored_files': glob.glob(src_path('webkit', '*private.*')) 84 123 }) … … 89 128 generator.generate(html='--skip-html' not in sys.argv) 90 129 return generator.saw_warnings 130 131 def rebase_installed_docs(pkg_config_path, options): 132 generator = gtkdoc.PkgConfigGTKDoc(pkg_config_path, options) 133 generator.rebase_installed_docs() 91 134 92 135 configure_logging() … … 105 148 pkg_config_path = common.build_path('Source', 'WebKit', 'gtk', 'webkitgtk-1.0.pc') 106 149 if os.path.exists(pkg_config_path): 107 print "Generating WebKit1 documentation..." 108 saw_webkit1_warnings = generate_doc(pkg_config_path, get_webkit1_options()) 150 options = get_webkit1_options(common.gtk_version_of_pkg_config_file(pkg_config_path)) 151 if '--rebase' not in sys.argv: 152 print "Generating WebKit1 documentation..." 153 saw_webkit1_warnings = generate_doc(pkg_config_path, options) 154 else: 155 print "Rebasing WebKit1 documentation..." 156 rebase_installed_docs(pkg_config_path, options) 109 157 110 158 # WebKit2 might not be enabled, so check for the pkg-config file before building documentation. 111 159 pkg_config_path = common.build_path('Source', 'WebKit2', 'webkit2gtk-3.0.pc') 112 160 if os.path.exists(pkg_config_path): 113 print "\nGenerating WebKit2 documentation..." 114 saw_webkit2_warnings = generate_doc(pkg_config_path, get_webkit2_options()) 161 options = get_webkit2_options() 162 if '--rebase' not in sys.argv: 163 print "\nGenerating WebKit2 documentation..." 164 saw_webkit2_warnings = generate_doc(pkg_config_path, options) 165 else: 166 print "\nRebasing WebKit2 documentation..." 167 rebase_installed_docs(pkg_config_path, options) 115 168 116 169 sys.exit(saw_webkit1_warnings or saw_webkit2_warnings) -
trunk/Tools/gtk/gtkdoc.py
r106474 r106786 96 96 self.main_sgml_file = '' 97 97 98 # Parameters specific to gtkdoc-fixxref. 99 self.cross_reference_deps = [] 100 98 101 self.interactive = False 99 102 … … 341 344 342 345 def _run_gtkdoc_fixxref(self): 343 self._run_command(['gtkdoc-fixxref', 344 '--module-dir=html', 345 '--html-dir=html'], 346 cwd=self.output_dir, 347 ignore_warnings=True) 346 args = ['gtkdoc-fixxref', 347 '--module-dir=html', 348 '--html-dir=html'] 349 args.extend(['--extra-dir=%s' % extra_dir for extra_dir in self.cross_reference_deps]) 350 self._run_command(args, cwd=self.output_dir, ignore_warnings=True) 351 352 def rebase_installed_docs(self): 353 html_dir = os.path.join(self.prefix, 'share', 'gtk-doc', 'html', self.module_name) 354 args = ['gtkdoc-rebase', 355 '--relative', 356 '--html-dir=%s' % html_dir] 357 args.extend(['--other-dir=%s' % extra_dir for extra_dir in self.cross_reference_deps]) 358 self._run_command(args, cwd=self.output_dir) 348 359 349 360 … … 377 388 pkg_config_path, 378 389 '--modversion'], print_output=False) 390 self.prefix = self._run_command(['pkg-config', 391 pkg_config_path, 392 '--variable=prefix'], print_output=False)
Note: See TracChangeset
for help on using the changeset viewer.