[Libreoffice-commits] core.git: bin/gbuild-to-ide
Federico Bassini
kurogan21 at gmail.com
Wed Jan 18 16:37:34 UTC 2017
bin/gbuild-to-ide | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
New commits:
commit 239e877d51399daedd315b6d1b31543e491169b6
Author: Federico Bassini <kurogan21 at gmail.com>
Date: Wed Jan 18 10:15:28 2017 +0100
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/33255
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: jan iversen <jani at documentfoundation.org>
diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide
index c8cd067..dae2f97 100755
--- a/bin/gbuild-to-ide
+++ b/bin/gbuild-to-ide
@@ -154,7 +154,7 @@ class GbuildParser:
moduleDict['include']={ 'targets': set(), 'headers':self.headers_of('include')}
- # sort ['sources'] and ['headers'] for each module
+
for module in sorted(moduleDict):
self.modules[module] = moduleDict[module]
return self
@@ -164,15 +164,21 @@ class GbuildParser:
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)
- #decode from byte to string
- allfiles=[]
+ allfiles={}
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
def headers_of(self,modulename):
- modulename_lenght=len(modulename)
- headersof = [element[modulename_lenght+1:] for element in self._allheaders if element.split('/')[0] == modulename]
+ if modulename in self._allheaders: #for the modules that not have headers
+ headersof = self._allheaders[modulename]
+ else:
+ headersof=[]
return headersof
class IdeIntegrationGenerator:
More information about the Libreoffice-commits
mailing list