summaryrefslogtreecommitdiff
path: root/giscanner/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'giscanner/utils.py')
-rw-r--r--giscanner/utils.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/giscanner/utils.py b/giscanner/utils.py
index 642da362..77d05b9e 100644
--- a/giscanner/utils.py
+++ b/giscanner/utils.py
@@ -22,7 +22,10 @@ import re
import os
import subprocess
+
_debugflags = None
+
+
def have_debug_flag(flag):
"""Check for whether a specific debugging feature is enabled.
Well-known flags:
@@ -38,6 +41,7 @@ Well-known flags:
_debugflags.remove('')
return flag in _debugflags
+
def break_on_debug_flag(flag):
if have_debug_flag(flag):
import pdb
@@ -69,8 +73,10 @@ def to_underscores_noprefix(name):
name = _upperstr_pat2.sub(r'\1_\2', name)
return name
+
_libtool_pat = re.compile("dlname='([A-z0-9\.\-\+]+)'\n")
+
def _extract_dlname_field(la_file):
f = open(la_file)
data = f.read()
@@ -81,6 +87,7 @@ def _extract_dlname_field(la_file):
else:
return None
+
# Returns the name that we would pass to dlopen() the library
# corresponding to this .la file
def extract_libtool_shlib(la_file):
@@ -92,6 +99,7 @@ def extract_libtool_shlib(la_file):
# a path rather than the raw dlname
return os.path.basename(dlname)
+
def extract_libtool(la_file):
dlname = _extract_dlname_field(la_file)
if dlname is None:
@@ -104,6 +112,7 @@ def extract_libtool(la_file):
libname = libname.replace('.libs/.libs', '.libs')
return libname
+
# Returns arguments for invoking libtool, if applicable, otherwise None
def get_libtool_command(options):
libtool_infection = not options.nolibtool
@@ -121,7 +130,7 @@ def get_libtool_command(options):
try:
subprocess.check_call(['libtool', '--version'],
stdout=open(os.devnull))
- except (subprocess.CalledProcessError, OSError), e:
+ except (subprocess.CalledProcessError, OSError):
# If libtool's not installed, assume we don't need it
return None