bin/gbuild-to-ide | 53 +++++++++++++++++------------------------------------ 1 file changed, 17 insertions(+), 36 deletions(-)
New commits: commit 17b61cbd8179783cbb0108422fb2e2d60d3e9548 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Thu Feb 25 13:55:32 2021 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Feb 26 08:55:51 2021 +0100 qtcreator: Simplify adding of file extension Create a new method 'get_file_path' which basically does what 'get_header_extension' and 'get_source_extension' did, but already concatenates the extension to the input; call that one and rename other methods accordingly. While at it, let 'get_source_extension' search for files in srcdir instead of builddir, as another step in making generation of qtcreator-ide-integration work properly for the case where srcdir != builddir. Change-Id: I1e34bfdb726192b4af21e9003205fa551545ae31 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111551 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide index cc779a37158a..3ee79977e78f 100755 --- a/bin/gbuild-to-ide +++ b/bin/gbuild-to-ide @@ -1635,19 +1635,19 @@ class QtCreatorIntegrationGenerator(IdeIntegrationGenerator): </qtcreator> """ - def get_source_extension(self, src_file): - path = os.path.join(self.base_folder, src_file) - for ext in (".cxx", ".cpp", ".c", ".mm"): - if os.path.isfile(path + ext): - return ext + def get_file_path(self, src_file, ext_choices): + path = os.path.join(self.gbuildparser.srcdir, src_file) + for ext in ext_choices: + full_path = path + ext + if os.path.isfile(full_path): + return full_path return "" - def get_header_extension(self, src_file): - path = os.path.join(self.base_folder, src_file) - for ext in (".hxx", ".hpp", ".h"): - if os.path.isfile(path + ext): - return ext - return "" + def get_source_path(self, src_file): + return self.get_file_path(src_file, (".cxx", ".cpp", ".c", ".mm")) + + def get_header_path(self, src_file): + return self.get_file_path(src_file, (".hxx", ".hpp", ".h")) def build_data_libs(self): @@ -1682,14 +1682,14 @@ class QtCreatorIntegrationGenerator(IdeIntegrationGenerator): for file_ in lib.cxxobjects: # the file has no extension : search it # self._log("\n file : %s" % file_) - ext = self.get_source_extension(file_) - if ext: - sources_list.append(lopath(file_ + ext)) + path = self.get_source_path(file_) + if path: + sources_list.append(lopath(path)) # few cxxobject files have a header beside - ext = self.get_header_extension(file_) - if ext: - headers_list.append(lopath(file_ + ext)) + path = self.get_header_path(file_) + if path: + headers_list.append(lopath(path)) cxxflags_list = [] for cxxflag in lib.cxxflags: commit 21a8653f6a94ca4c6de8160249e721690a679193 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Thu Feb 25 13:35:29 2021 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Fri Feb 26 08:55:32 2021 +0100 qtcreator: Don't explicitly delete old *.pro{,.shared} files They are overwritten when written with the new content anyway, since opened with file mode 'w+', i.e. they're truncated first. This also simplifies handling the case where srcdir != builddir, for which support will be added in a subsequent step. Change-Id: I1dd3386cdf0b97a6299357d6c12ed2d7b6365eae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111550 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide index 7af0b26239ff..cc779a37158a 100755 --- a/bin/gbuild-to-ide +++ b/bin/gbuild-to-ide @@ -1635,22 +1635,6 @@ class QtCreatorIntegrationGenerator(IdeIntegrationGenerator): </qtcreator> """ - def remove_qt_files(self): - - def do_remove_file(loc, afile): - try: - os.remove(os.path.join(loc, afile)) - self._log("removed %s\n" % afile) - except OSError: - self._log("unable to remove %s\n" % afile) - - do_remove_file(self.base_folder, "lo.pro") - do_remove_file(self.base_folder, "lo.pro.shared") - for location in self.target_by_location: - for f in os.listdir(location): - if f.endswith('.pro') or f.endswith('.pro.shared'): - do_remove_file(location, f) - def get_source_extension(self, src_file): path = os.path.join(self.base_folder, src_file) for ext in (".cxx", ".cpp", ".c", ".mm"): @@ -1757,9 +1741,6 @@ class QtCreatorIntegrationGenerator(IdeIntegrationGenerator): mode = 'w+' self.base_folder = self.gbuildparser.builddir - # we remove existing '.pro' and '.pro.shared' files - self.remove_qt_files() - # for .pro files, we must explicitly list all files (.c, .h) # so we can't reuse directly the same method than for kde integration. self.build_data_libs() _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits