Skip to content

Commit

Permalink
check for required keys
Browse files Browse the repository at this point in the history
  • Loading branch information
schriftgestalt committed Nov 4, 2022
1 parent 4ecc390 commit b25151a
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,21 @@
#

import sys
from pbPlist import pbPlist

try:
# purposely throwing away the return of PBPlist since we're just checking that it parses
from Foundation import NSDictionary
z = NSDictionary.dictionaryWithContentsOfFile_("packages.plist")
except:
from pbPlist import pbPlist
z = pbPlist.PBPlist("packages.plist")
except Exception as e:
print(e)
sys.exit(1)

#print(type(z["packages"]))
packageDict = z["packages"]
for packageType in packageDict.keys():
packages = packageDict[packageType]
for package in packages:
if not (package.get("title", None) or package.get("titles", None)):
print(f"missing title in {package}")
if not package.get("url", None):
print(f"missing url in {package}")
if not package.get("path", None) and packageType == "plugins":
print(f"missing path in {package}")

0 comments on commit b25151a

Please sign in to comment.