@@ -86,7 +86,13 @@ def proc_pipeline(name):
8686 Keyword arguments:
8787 name -- file name string
8888 """
89- config_file = Config (os .path .dirname (name ), ".wpiformat" )
89+ try :
90+ config_file = Config (os .path .dirname (name ), ".wpiformat" )
91+ except OSError :
92+ # TODO: Remove handling for deprecated .styleguide file
93+ config_file = Config (os .path .dirname (name ), ".styleguide" )
94+ print ("Warning: found deprecated '.styleguide' file. Rename to '.wpiformat'." )
95+
9096 if verbose1 or verbose2 :
9197 with print_lock :
9298 print ("Processing" , name )
@@ -128,7 +134,13 @@ def proc_standalone(name):
128134 Keyword arguments:
129135 name -- file name string
130136 """
131- config_file = Config (os .path .dirname (name ), ".wpiformat" )
137+ try :
138+ config_file = Config (os .path .dirname (name ), ".wpiformat" )
139+ except OSError :
140+ # TODO: Remove handling for deprecated .styleguide file
141+ config_file = Config (os .path .dirname (name ), ".styleguide" )
142+ print ("Warning: found deprecated '.styleguide' file. Rename to '.wpiformat'." )
143+
132144 if verbose2 :
133145 with print_lock :
134146 print ("Processing" , name )
@@ -178,7 +190,15 @@ def proc_batch(files):
178190 for subtask in task_pipeline :
179191 work = []
180192 for name in files :
181- config_file = Config (os .path .dirname (name ), ".wpiformat" )
193+ try :
194+ config_file = Config (os .path .dirname (name ), ".wpiformat" )
195+ except OSError :
196+ # TODO: Remove handling for deprecated .styleguide file
197+ config_file = Config (os .path .dirname (name ), ".styleguide" )
198+ print (
199+ "Warning: found deprecated '.styleguide' file. Rename to '.wpiformat'."
200+ )
201+
182202 if subtask .should_process_file (config_file , name ):
183203 work .append (name )
184204
@@ -443,7 +463,14 @@ def main():
443463 # Don't run tasks on modifiable or generated files
444464 work = []
445465 for name in files :
446- config_file = Config (os .path .dirname (name ), ".wpiformat" )
466+ try :
467+ config_file = Config (os .path .dirname (name ), ".wpiformat" )
468+ except OSError :
469+ # TODO: Remove handling for deprecated .styleguide file
470+ config_file = Config (os .path .dirname (name ), ".styleguide" )
471+ print (
472+ "Warning: found deprecated '.styleguide' file. Rename to '.wpiformat'."
473+ )
447474
448475 if config_file .is_modifiable_file (name ):
449476 continue
0 commit comments