Changeset 106786 in webkit


Ignore:
Timestamp:
Feb 6, 2012 1:23:08 AM (12 years ago)
Author:
Carlos Garcia Campos
Message:

[GTK] Fix xrefs after installing API documentation
https://bugs.webkit.org/show_bug.cgi?id=77551

Reviewed by Martin Robinson.

  • GNUmakefile.am: Call generate-gtkdoc --rebase after installing

api docs.

  • gtk/common.py:

(prefix_of_pkg_config_file): Get the prefix variable of the given
pkg-config file.
(gtk_version_of_pkg_config_file): Get the gtk version required by
the given pkg-config file.

  • gtk/generate-gtkdoc: Add --rebase command line option to rebase

installed documentation.
(get_gtkdoc_module_paths): Get paths where API doc is installed
for the dependencies of the given pkg-config file.
(get_common_xref_deps): Get API doc directories of dependencies
common to WebKit1 and WebKit2.
(get_webkit2_options): Add cross_reference_deps option.
(get_webkit1_options): Ditto
(rebase_installed_docs): Helper function to create a generator for
the given pkg-config file and options and call rebase_installed_docs.

  • gtk/gtkdoc.py:

(GTKDoc.init): Initialize cross_reference_deps.
(GTKDoc._run_gtkdoc_fixxref): Add API doc directories of
dependencies.
(GTKDoc.rebase_installed_docs): Call gtkdoc-rebase to fix xref
links of installed documentation.
(PkgConfigGTKDoc.init): Get the prefix from the pkg-config
file.

Location:
trunk/Tools
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r106784 r106786  
     12012-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
    1342012-02-06  Sergio Villar Senin  <svillar@igalia.com>
    235
  • trunk/Tools/GNUmakefile.am

    r106473 r106786  
    326326        fi
    327327endif
     328        $(srcdir)/Tools/gtk/generate-gtkdoc --rebase
    328329
    329330uninstall-local:
  • trunk/Tools/gtk/common.py

    r101820 r106786  
    7777    stdout = process.communicate()[0]
    7878    return int(stdout)
     79
     80
     81def 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
     90def 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  
    3535        handler.setFormatter(logging.Formatter('%(message)s'))
    3636
     37
     38def 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
    3752def get_common_options():
    3853    return {
     
    4257    }
    4358
     59def 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
    4466def get_webkit2_options():
    4567    def derived_sources_path(*args):
     
    4769    def src_path(*args):
    4870        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    })
    4976
    5077    options = get_common_options().copy()
     
    5986                   ' -I' + common.top_level_path('Source') + \
    6087                   ' -I' + src_path(),
     88        'cross_reference_deps' : get_gtkdoc_module_paths(xref_deps),
    6189        'ignored_files': glob.glob(src_path('*Private.h')) + \
    6290                         glob.glob(src_path('*Client*')) + \
     
    6694    return options
    6795
    68 def get_webkit1_options():
     96def get_webkit1_options(gtk_version):
    6997    def src_path(*args):
    7098        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        })
    71109
    72110    options = get_common_options().copy()
     
    81119                   ' -I' + common.top_level_path('Source') + \
    82120                   ' -I' + common.top_level_path('Source', 'JavaScriptCore', 'ForwardingHeaders'),
     121        'cross_reference_deps' : get_gtkdoc_module_paths(xref_deps),
    83122        'ignored_files': glob.glob(src_path('webkit', '*private.*'))
    84123    })
     
    89128    generator.generate(html='--skip-html' not in sys.argv)
    90129    return generator.saw_warnings
     130
     131def rebase_installed_docs(pkg_config_path, options):
     132    generator = gtkdoc.PkgConfigGTKDoc(pkg_config_path, options)
     133    generator.rebase_installed_docs()
    91134
    92135configure_logging()
     
    105148    pkg_config_path = common.build_path('Source', 'WebKit', 'gtk', 'webkitgtk-1.0.pc')
    106149if 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)
    109157
    110158# WebKit2 might not be enabled, so check for the pkg-config file before building documentation.
    111159pkg_config_path = common.build_path('Source', 'WebKit2', 'webkit2gtk-3.0.pc')
    112160if 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)
    115168
    116169sys.exit(saw_webkit1_warnings or saw_webkit2_warnings)
  • trunk/Tools/gtk/gtkdoc.py

    r106474 r106786  
    9696        self.main_sgml_file = ''
    9797
     98        # Parameters specific to gtkdoc-fixxref.
     99        self.cross_reference_deps = []
     100
    98101        self.interactive = False
    99102
     
    341344
    342345    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)
    348359
    349360
     
    377388                                          pkg_config_path,
    378389                                          '--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.