diff options
author | Federico Bassini <kurogan21@gmail.com> | 2017-01-18 10:15:28 +0100 |
---|---|---|
committer | jan iversen <jani@documentfoundation.org> | 2017-01-18 16:36:55 +0000 |
commit | 239e877d51399daedd315b6d1b31543e491169b6 (patch) | |
tree | 350bb1d11edb6bea90b108362e105d75c6f7ecaa /bin | |
parent | 3d002fdb8738d9bbc9b04c0270510e349bd58149 (diff) |
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@libreoffice.org>
Reviewed-by: jan iversen <jani@documentfoundation.org>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/gbuild-to-ide | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide index c8cd067110e5..dae2f973146d 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: |