11#!/usr/bin/python
2- # -*- coding: utf-8 -*-
32"""This hook checks AutoPkg recipe lists (in txt, plist, yaml, or json format)
43for common issues.
54
@@ -37,7 +36,7 @@ def main(argv=None):
3736 for filename in args .filenames :
3837 recipe_list = None
3938 if filename .endswith (".txt" ):
40- with open (filename , "r" , encoding = "utf-8" ) as openfile :
39+ with open (filename , encoding = "utf-8" ) as openfile :
4140 recipe_list = [
4241 line
4342 for line in openfile .read ().splitlines ()
@@ -54,7 +53,7 @@ def main(argv=None):
5453 # AutoPkg does not support YAML recipe lists, but AutoPkg users
5554 # may have developed custom tooling for this.
5655 try :
57- with open (filename , "r" , encoding = "utf-8" ) as openfile :
56+ with open (filename , encoding = "utf-8" ) as openfile :
5857 recipe_list = yaml .load (openfile )
5958 except Exception as err :
6059 print (f"{ filename } : yaml parsing error: { err } " )
@@ -63,7 +62,7 @@ def main(argv=None):
6362 # AutoPkg does not support JSON recipe lists, but AutoPkg users
6463 # may have developed custom tooling for this.
6564 try :
66- with open (filename , "r" , encoding = "utf-8" ) as openfile :
65+ with open (filename , encoding = "utf-8" ) as openfile :
6766 recipe_list = json .load (openfile )
6867 except Exception as err :
6968 print (f"{ filename } : json parsing error: { err } " )
@@ -73,7 +72,7 @@ def main(argv=None):
7372 print (f"{ filename } : invalid recipe list" )
7473 retval = 1
7574 else :
76- if any (( ".munki" in recipe for recipe in recipe_list ) ):
75+ if any (".munki" in recipe for recipe in recipe_list ):
7776 if "MakeCatalogs" not in recipe_list [- 1 ]:
7877 print ("{}: MakeCatalogs should be the last item in the list" )
7978 retval = 1
0 commit comments