Kaydet (Commit) 239e877d authored tarafından Federico Bassini's avatar Federico Bassini Kaydeden (comit) jan iversen

gbuil-to-ide.py functions improvment

this patch improve the functions:
-find_all_headers -> make _allheaders a dict: _allheaders['<modulename>'] contains the list of all headers for that module
-headers_of(modulename) -> it return the list of headers for that module, or a empty list for module that not have headers

Change-Id: I7e4e2bf063ccf6fd2e3e5155b58d2be2412480ba
Reviewed-on: https://gerrit.libreoffice.org/33255Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarjan iversen <jani@documentfoundation.org>
üst 3d002fdb
...@@ -154,7 +154,7 @@ class GbuildParser: ...@@ -154,7 +154,7 @@ class GbuildParser:
moduleDict['include']={ 'targets': set(), 'headers':self.headers_of('include')} moduleDict['include']={ 'targets': set(), 'headers':self.headers_of('include')}
# sort ['sources'] and ['headers'] for each module
for module in sorted(moduleDict): for module in sorted(moduleDict):
self.modules[module] = moduleDict[module] self.modules[module] = moduleDict[module]
return self return self
...@@ -164,15 +164,21 @@ class GbuildParser: ...@@ -164,15 +164,21 @@ class GbuildParser:
cmdResult1=subprocess.Popen(('git', 'ls-files'), cwd=self.srcdir,stdout=subprocess.PIPE,stderr=subprocess.PIPE) cmdResult1=subprocess.Popen(('git', 'ls-files'), cwd=self.srcdir,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
cmdResult2=subprocess.check_output(('grep', '-i', '-E', '".*\.hxx$|.*\.h$|.*\.hpp$"'),cwd=self.srcdir,stdin=cmdResult1.stdout,stderr=subprocess.PIPE) cmdResult2=subprocess.check_output(('grep', '-i', '-E', '".*\.hxx$|.*\.h$|.*\.hpp$"'),cwd=self.srcdir,stdin=cmdResult1.stdout,stderr=subprocess.PIPE)
#decode from byte to string allfiles={}
allfiles=[]
for file in cmdResult2.splitlines(): for file in cmdResult2.splitlines():
allfiles.append(file.decode()) strfile=file.decode()
modulename=strfile.split('/')[0]
if not modulename in allfiles:
allfiles[modulename]=[]
modulename_len=len(modulename)
allfiles[modulename].append(strfile[modulename_len + 1:])
self._allheaders = allfiles self._allheaders = allfiles
def headers_of(self,modulename): def headers_of(self,modulename):
modulename_lenght=len(modulename) if modulename in self._allheaders: #for the modules that not have headers
headersof = [element[modulename_lenght+1:] for element in self._allheaders if element.split('/')[0] == modulename] headersof = self._allheaders[modulename]
else:
headersof=[]
return headersof return headersof
class IdeIntegrationGenerator: class IdeIntegrationGenerator:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment