@@ -40,6 +40,8 @@ def generate_settings(source_yaml, settings_path, builtin_p_paths=None, sourcepa
40
40
if os .path .isfile (asfyaml ):
41
41
print (".asf.yaml detected, reading..." )
42
42
adata = yaml .safe_load (open (asfyaml ))
43
+ else :
44
+ adata = None # ensure the variable is defined
43
45
44
46
print (f"Reading { source_yaml } in { sourcepath } " )
45
47
ydata = yaml .safe_load (open (source_yaml ))
@@ -172,7 +174,7 @@ def generate_settings(source_yaml, settings_path, builtin_p_paths=None, sourcepa
172
174
t = ezt .Template (os .path .join (THIS_DIR , AUTO_SETTINGS_TEMPLATE ))
173
175
t .generate (open (settings_path , "w+" ), tdata )
174
176
175
- if __name__ == "__main__" :
177
+ def main ():
176
178
parser = argparse .ArgumentParser (description = "Convert pelicanconf.yaml to pelicanconf.py" )
177
179
parser .add_argument ('-y' , '--yaml' , required = True , help = "Pelicanconf YAML file" )
178
180
args = parser .parse_args ()
@@ -186,3 +188,6 @@ def generate_settings(source_yaml, settings_path, builtin_p_paths=None, sourcepa
186
188
settings_path = os .path .join (sourcepath , AUTO_SETTINGS )
187
189
builtin_plugins = os .path .join (tool_dir , os .pardir , "plugins" )
188
190
generate_settings (pelconf_yaml , settings_path , [builtin_plugins ], sourcepath )
191
+
192
+ if __name__ == "__main__" :
193
+ main ()
0 commit comments