diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-08-07 20:02:05 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-08-11 12:39:56 +0000 |
commit | f70f4e998517e9792034613b85ad89afa187e271 (patch) | |
tree | 4fb9e26dd87d5c17e42cc6d038d767c63a993811 /bin | |
parent | 62101bcacb2096dc60c4123196105dce39cfd056 (diff) |
split isystem includes from normal includes
All includes coming from isystem where wrong as the regex was not able
to recognize that the isystem and following path belong together.
Additionally stripping the first two characters resulted in broken paths
in this case.
Change-Id: Iaa8e484d1ddcd4c8744d1e37a006ebf915cdfc84
Reviewed-on: https://gerrit.libreoffice.org/10815
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/gbuild-to-ide | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide index 55bfa373647c..f7302c2a0f45 100755 --- a/bin/gbuild-to-ide +++ b/bin/gbuild-to-ide @@ -26,12 +26,13 @@ class GbuildParserState: self.defs = {} self.cxxobjects = [] self.linked_libs = [] + self.include_sys = [] class GbuildLinkTarget: - def __init__(self, name, location, include, defs, cxxobjects, linked_libs): - (self.name, self.location, self.include, self.defs, self.cxxobjects, self.linked_libs) = ( - name, location, include, defs, cxxobjects, linked_libs) + def __init__(self, name, location, include, include_sys, defs, cxxobjects, linked_libs): + (self.name, self.location, self.include, self.include_sys, self.defs, self.cxxobjects, self.linked_libs) = ( + name, location, include, include_sys, defs, cxxobjects, linked_libs) def short_name(self): return self.name @@ -40,13 +41,13 @@ class GbuildLinkTarget: return not self.include and not self.defs and not self.cxxobjects and not self.linked_libs def __str__(self): - return '%s at %s with include path: %s, defines %s, objects: %s and linked libs: %s' % ( - self.short_name(), self.location, self.include, self.defs, self.cxxobjects, self.linked_libs) + return '%s at %s with include path: %s, isystem includes: %s, defines %s, objects: %s and linked libs: %s' % ( + self.short_name(), self.location, self.include, self.include_sys, self.defs, self.cxxobjects, self.linked_libs) class GbuildLib(GbuildLinkTarget): - def __init__(self, name, library, location, include, defs, cxxobjects, linked_libs): - GbuildLinkTarget.__init__(self, name, location, include, defs, cxxobjects, linked_libs) + def __init__(self, name, library, location, include, include_sys, defs, cxxobjects, linked_libs): + GbuildLinkTarget.__init__(self, name, location, include, include_sys, defs, cxxobjects, linked_libs) self.library = library def short_name(self): @@ -61,8 +62,8 @@ class GbuildLib(GbuildLinkTarget): class GbuildExe(GbuildLinkTarget): - def __init__(self, name, executable, location, include, defs, cxxobjects, linked_libs): - GbuildLinkTarget.__init__(self, name, location, include, defs, cxxobjects, linked_libs) + def __init__(self, name, executable, location, include, include_sys, defs, cxxobjects, linked_libs): + GbuildLinkTarget.__init__(self, name, location, include, include_sys, defs, cxxobjects, linked_libs) self.executable = executable def short_name(self): @@ -84,7 +85,8 @@ class GbuildParser: rulepattern = re.compile('^(.+?):( .*)?$') libpattern = re.compile('# [a-z]+ to execute \(from [\'`](.*)/Library_(.*)\.mk\', line [0-9]*\):') exepattern = re.compile('# [a-z]+ to execute \(from [\'`](.*)/Executable_(.*)\.mk\', line [0-9]*\):') - includepattern = re.compile('# INCLUDE := (.*)') + includepattern = re.compile('-I(\S+)') + isystempattern = re.compile('-isystem\s*(\S+)') defspattern = re.compile('# DEFS := (.*)') cxxpattern = re.compile('# CXXOBJECTS := (.*)') linkedlibspattern = re.compile('# LINKED_LIBS := (.*)') @@ -147,7 +149,7 @@ class GbuildParser: libname = self.libnames.get(state.ilib, None) self.libs.append( GbuildLib(libmatch.group(2), libname, libmatch.group(1), - state.include, state.defs, state.cxxobjects, + state.include, state.include_sys, state.defs, state.cxxobjects, state.linked_libs)) state = GbuildParserState() continue @@ -156,13 +158,16 @@ class GbuildParser: exename = self.exenames.get(state.target, None) self.exes.append( GbuildExe(exematch.group(2), exename, exematch.group(1), - state.include, state.defs, state.cxxobjects, + state.include, state.include_sys, state.defs, state.cxxobjects, state.linked_libs)) state = GbuildParserState() continue includematch = GbuildParser.includepattern.match(line) - if includematch: - state.include = [includeswitch.strip()[2:] for includeswitch in includematch.group(1).split(' ') if + if line.find('# INCLUDE :=') == 0: + isystemmatch = GbuildParser.isystempattern.findall(line) + if isystemmatch: + state.include_sys = isystemmatch + state.include = [includeswitch.strip() for includeswitch in GbuildParser.includepattern.findall(line) if len(includeswitch) > 2] continue defsmatch = GbuildParser.defspattern.match(line) |