File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
graalpython/lib-graalpython/modules Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -165,7 +165,7 @@ def consume_whitespace_forward(idx):
165
165
166
166
def auto_patch (path , dryrun ):
167
167
"reads the given file, applies all replacements, and writes back the result if there were changes"
168
-
168
+
169
169
with open (path , mode = 'r' ) as f :
170
170
try :
171
171
contents = f .read ()
@@ -201,11 +201,16 @@ def auto_patch(path, dryrun):
201
201
202
202
203
203
def auto_patch_tree (location , dryrun = False ):
204
- for root , dirs , files in os .walk (location ):
205
- for name in files :
206
- if '.c' in name or '.h' in name or '.inc' in name :
207
- path = os .path .join (root , name )
208
- auto_patch (path , dryrun )
204
+ if os .path .isfile (location ):
205
+ files = [location ]
206
+ else :
207
+ files = [os .path .join (root , name )
208
+ for root , dirs , files in os .walk (location )
209
+ for name in files ]
210
+
211
+ for path in files :
212
+ if '.c' in path or '.h' in path or '.inc' in path :
213
+ auto_patch (path , dryrun )
209
214
210
215
211
216
if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments