[gtk-doc] fixxref/rebase: Don't depend on glib being installed



commit 669d07a1699ea42aedf0fd4ebe4f7afc2415b54a
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Tue Oct 3 13:22:56 2017 +0200

    fixxref/rebase: Don't depend on glib being installed
    
    As is the case when you build docs for glib itself.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=787768

 gtkdoc/fixxref.py |   26 +++++++++++++++-----------
 gtkdoc/rebase.py  |   11 ++++++++---
 2 files changed, 23 insertions(+), 14 deletions(-)
---
diff --git a/gtkdoc/fixxref.py b/gtkdoc/fixxref.py
index 052e1ed..739e84b 100755
--- a/gtkdoc/fixxref.py
+++ b/gtkdoc/fixxref.py
@@ -71,18 +71,22 @@ def Run(options):
 
     # We scan the directory containing GLib and any directories in GNOME2_PATH
     # first, but these will be overriden by any later scans.
-    dir = common.GetModuleDocDir('glib-2.0')
-    if os.path.exists(dir):
-        # Some predefined link targets to get links into type hierarchies as these
-        # have no targets. These are always absolute for now.
-        Links['GBoxed'] = dir + '/gobject/gobject-Boxed-Types.html'
-        Links['GEnum'] = dir + '/gobject/gobject-Enumeration-and-Flag-Types.html'
-        Links['GFlags'] = dir + '/gobject/gobject-Enumeration-and-Flag-Types.html'
-        Links['GInterface'] = dir + '/gobject/GTypeModule.html'
-
-        if dir != options.html_dir:
-            logging.info('Scanning GLib directory: %s', dir)
-            ScanIndices(dir, (re.search(prefix_match, dir) is None))
+    try:
+        dir = common.GetModuleDocDir('glib-2.0')
+    except subprocess.CalledProcessError:
+        pass
+    else:
+        if os.path.exists(dir):
+            # Some predefined link targets to get links into type hierarchies as these
+            # have no targets. These are always absolute for now.
+            Links['GBoxed'] = dir + '/gobject/gobject-Boxed-Types.html'
+            Links['GEnum'] = dir + '/gobject/gobject-Enumeration-and-Flag-Types.html'
+            Links['GFlags'] = dir + '/gobject/gobject-Enumeration-and-Flag-Types.html'
+            Links['GInterface'] = dir + '/gobject/GTypeModule.html'
+
+            if dir != options.html_dir:
+                logging.info('Scanning GLib directory: %s', dir)
+                ScanIndices(dir, (re.search(prefix_match, dir) is None))
 
     path = os.environ.get('GNOME2_PATH')
     if path:
diff --git a/gtkdoc/rebase.py b/gtkdoc/rebase.py
index c083ee0..23e3d6e 100755
--- a/gtkdoc/rebase.py
+++ b/gtkdoc/rebase.py
@@ -30,6 +30,7 @@ from six import iteritems, iterkeys
 import logging
 import os
 import re
+import subprocess
 
 from . import common
 
@@ -63,9 +64,13 @@ def run(options):
                 log(options, "Prepending GNOME2_PATH directory:", dir)
                 other_dirs = [dir] + other_dirs
 
-    dir = common.GetModuleDocDir('glib-2.0')
-    log(options, "Prepending GLib directory", dir)
-    other_dirs = [dir] + other_dirs
+    try:
+        dir = common.GetModuleDocDir('glib-2.0')
+    except subprocess.CalledProcessError:
+        pass
+    else:
+        log(options, "Prepending GLib directory", dir)
+        other_dirs = [dir] + other_dirs
 
     # Check all other dirs, but skip already scanned dirs ord subdirs of those
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]