[llvm] cacb1a9 - [gn build] sync script: try to make sync script even clearer

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 1 11:40:35 PST 2020


Author: Nico Weber
Date: 2020-12-01T14:35:27-05:00
New Revision: cacb1a9f930e35371c885cb572823626fc90a0ee

URL: https://github.com/llvm/llvm-project/commit/cacb1a9f930e35371c885cb572823626fc90a0ee
DIFF: https://github.com/llvm/llvm-project/commit/cacb1a9f930e35371c885cb572823626fc90a0ee.diff

LOG: [gn build] sync script: try to make sync script even clearer

Turns out startswith() takes an optional start parameter :)

No behavior change.

Added: 
    

Modified: 
    llvm/utils/gn/build/sync_source_lists_from_cmake.py

Removed: 
    


################################################################################
diff  --git a/llvm/utils/gn/build/sync_source_lists_from_cmake.py b/llvm/utils/gn/build/sync_source_lists_from_cmake.py
index 912cf37c7e54..1906c2a9234f 100755
--- a/llvm/utils/gn/build/sync_source_lists_from_cmake.py
+++ b/llvm/utils/gn/build/sync_source_lists_from_cmake.py
@@ -29,7 +29,7 @@ def patch_gn_file(gn_file, add, remove):
     if add:
         srcs_tok = 'sources = ['
         tokloc = gn_contents.find(srcs_tok)
-        while gn_contents[tokloc:].startswith('sources = []'):
+        while gn_contents.startswith('sources = []', tokloc):
             tokloc = gn_contents.find(srcs_tok, tokloc + 1)
         if tokloc == -1: raise ValueError(gn_file + ': No source list')
         if gn_contents.find(srcs_tok, tokloc + 1) != -1:


        


More information about the llvm-commits mailing list