manifest.py 1.0 KB

123456789101112131415161718192021222324252627
  1. from manifest.metrics import checkTransformMetrics
  2. from manifest.encoding import checkTransformEncoding
  3. from manifest.metadata import checkTransformMetadata
  4. checkDocMsg = "Check the documentation to make sure you're doing the manifest right'."
  5. def checkTransformManifest(outputFormats, m):
  6. """
  7. Validates manifest data, both at a structural and value level.
  8. Will compile some manifest data into a structure for use in font table assembly.
  9. Will raise a ValueError if anything critically incorrect has been entered by the user.
  10. """
  11. if 'metrics' not in m:
  12. raise ValueError(f"No metrics data found in the manifest. {checkDocMsg}")
  13. if 'encoding' not in m:
  14. raise ValueError(f"No encoding data found in the manifest. {checkDocMsg}")
  15. if 'metadata' not in m:
  16. raise ValueError(f"No metadata data found in the manifest. {checkDocMsg}")
  17. checkTransformMetrics(m['metrics'])
  18. checkTransformEncoding(m['encoding'])
  19. checkTransformMetadata(m['metadata'], outputFormats)