[Libreoffice-commits] core.git: 2 commits - bin/update_pch

Luboš Luňák (via logerrit) logerrit at kemper.freedesktop.org
Sun May 19 07:49:09 UTC 2019


 bin/update_pch |   35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)

New commits:
commit 5e23a1f7c83ff369e884bbe9963655938363c27d
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Sat May 18 16:32:06 2019 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Sun May 19 09:48:40 2019 +0200

    support also StaticLibrary in update_pch
    
    Change-Id: I02127cd8a023e87482eff4071eb81b30f39870fd
    Reviewed-on: https://gerrit.libreoffice.org/72526
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/bin/update_pch b/bin/update_pch
index bf1cbeb20f41..adac49592fa1 100755
--- a/bin/update_pch
+++ b/bin/update_pch
@@ -603,14 +603,18 @@ def parse_makefile(groups, lines, lineno, lastif, ifstack):
 
     return groups
 
-def process_makefile(root, module, makefile):
+def process_makefile(root, module, libname):
     """ Parse a gmake makefile and extract
         source filenames from it.
     """
 
+    makefile = 'Library_{}.mk'.format(libname)
     filename = os.path.join(os.path.join(root, module), makefile)
     if not os.path.isfile(filename):
-        sys.stderr.write('Error: Module {} has no makefile at {}.'.format(module, filename))
+        makefile = 'StaticLibrary_{}.mk'.format(libname)
+        filename = os.path.join(os.path.join(root, module), makefile)
+        if not os.path.isfile(filename):
+            sys.stderr.write('Error: Module {} has no makefile at {}.'.format(module, filename))
 
     groups = {'':[], 'ANDROID':[], 'iOS':[], 'WNT':[], 'LINUX':[], 'MACOSX':[]}
 
@@ -917,8 +921,7 @@ def main():
                                 not EXCLUDE_LOCAL)
 
     # Read input.
-    makefile = 'Library_{}.mk'.format(libname)
-    groups = process_makefile(root, module, makefile)
+    groups = process_makefile(root, module, libname)
 
     generic = []
     for osname, group in groups.items():
commit d3b6408ab83be93f541ad72507b2f96a462c9697
Author:     Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Sat May 18 16:31:49 2019 +0200
Commit:     Luboš Luňák <l.lunak at collabora.com>
CommitDate: Sun May 19 09:48:32 2019 +0200

    port update_pch to python3
    
    Change-Id: Ib0676472e5fe2b2f789dba62e9e1d985adb3ed23
    Reviewed-on: https://gerrit.libreoffice.org/72525
    Tested-by: Jenkins
    Reviewed-by: Luboš Luňák <l.lunak at collabora.com>

diff --git a/bin/update_pch b/bin/update_pch
index ab9ca868381e..bf1cbeb20f41 100755
--- a/bin/update_pch
+++ b/bin/update_pch
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 # -*- Mode: python; tab-width: 4; indent-tabs-mode: t -*-
 #
 # This file is part of the LibreOffice project.
@@ -702,7 +702,7 @@ def make_command_line():
     args = sys.argv[:]
     # Remove command line flags and
     # use internal flags.
-    for i in xrange(len(args)-1, 0, -1):
+    for i in range(len(args)-1, 0, -1):
         if args[i].startswith('--'):
             args.pop(i)
 
@@ -726,7 +726,7 @@ def generate_includes(includes):
     """Generates the include lines of the pch.
     """
     lines = []
-    for osname, group in includes.iteritems():
+    for osname, group in includes.items():
         if not len(group):
             continue
 
@@ -815,7 +815,7 @@ def remove_from_tree(filename, tree):
         tree = remove_from_tree(i, tree)
 
     # Also remove if included from another.
-    for (k, v) in tree.iteritems():
+    for (k, v) in tree.items():
         if filename in v:
             v.remove(filename)
 
@@ -884,7 +884,7 @@ def main():
         EXCLUDE_LOCAL = DEFAULTS[key][3]
 
     force_update = False
-    for x in xrange(3, len(sys.argv)):
+    for x in range(3, len(sys.argv)):
         i = sys.argv[x]
         if i.startswith('--cutoff='):
             CUTOFF = int(i.split('=')[1])
@@ -921,7 +921,7 @@ def main():
     groups = process_makefile(root, module, makefile)
 
     generic = []
-    for osname, group in groups.iteritems():
+    for osname, group in groups.items():
         if not len(group):
             continue
 
@@ -952,7 +952,7 @@ def main():
             tree = remove_from_tree(filename, tree)
 
         extra = []
-        for (k, v) in tree.iteritems():
+        for (k, v) in tree.items():
             extra += tree_to_list([], k, tree)
 
         promoted += promote(extra)
@@ -960,7 +960,7 @@ def main():
         promoted = process_list(promoted, filter_local.proc)
         promoted = set(promoted)
         # If a promoted header includes others, remove the rest.
-        for (k, v) in tree.iteritems():
+        for (k, v) in tree.items():
             if k in promoted:
                 for i in v:
                     promoted.discard(i)
@@ -977,7 +977,7 @@ def main():
 
         includes = map(lambda x: '#include <' + x + '>', includes)
         sorted = sort_by_category(includes, root, module, filter_local)
-        includes = fixes + sorted
+        includes = list(fixes) + sorted
 
         if len(osname):
             for i in generic:
@@ -996,7 +996,7 @@ def main():
         new_lines = generate_includes(groups)
         # Find the first include in the old pch.
         start = -1
-        for i in xrange(len(old_pch_lines)):
+        for i in range(len(old_pch_lines)):
             if old_pch_lines[i].startswith('#include') or old_pch_lines[i].startswith('#if PCH_LEVEL'):
                 start = i
                 break
@@ -1005,13 +1005,13 @@ def main():
             generate(new_lines, libname, header, module)
             return 0
         else:
-            for i in xrange(len(new_lines)):
+            for i in range(len(new_lines)):
                 if new_lines[i] != old_pch_lines[start + i]:
                     generate(new_lines, libname, header, module)
                     return 0
             else:
                 # Identical, but see if new pch removed anything.
-                for i in xrange(start + len(new_lines), len(old_pch_lines)):
+                for i in range(start + len(new_lines), len(old_pch_lines)):
                     if '#include' in old_pch_lines[i]:
                         generate(new_lines, libname, header, module)
                         return 0


More information about the Libreoffice-commits mailing list