in scripts/icon-builder.py [0:0]
def verify_environment():
"""Test all dependencies to verify that builder can run correctly"""
global config
# Check execution from scripts working directory
cur_dir = Path(".")
if str(cur_dir.absolute()).split("/")[-2:] != ["aws-icons-for-plantuml", "scripts"]:
print(
f"Working directory for icon-builder.py must be aws-icons-for-plantuml/scripts, not {cur_dir}"
)
sys.exit(1)
# Read config file
try:
with open("config.yml") as f:
config = yaml.safe_load(f)
except Exception as e:
print(f"Error: {e}\ncheck config.yml file")
sys.exit(1)
# Verify other files and folders exist
dir = Path("../source")
required_files = [
"AWSC4Integration.puml",
"AWSCommon.puml",
"AWSRaw.puml",
"AWSSimplified.puml",
]
for file in required_files:
q = dir / file
if not q.exists():
print(f"File {file} not found is source/ directory")
sys.exit(1)
q = dir / "official"
if not q.exists() or len([x for x in q.iterdir() if q.is_dir()]) == 0:
print(
"source/official must contain folders of AWS icons to process. Please see README file for details."
)
sys.exit(1)
# Start plantuml.jar and verify java
try:
subprocess.run(
["java", "-jar", "./plantuml.jar", "-version"],
shell=True,
stdout=PIPE,
stderr=PIPE,
)
except Exception as e:
print(f"Error executing plantuml jar file, {e}")
sys.exit(1)
# Checks complete, return if not doing a pre-flight
if args["check_env"]:
# dry run only
print("Prerequisites met, exiting")
exit(0)
return