embedClara.py 924 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env python3
  2. # Execute this script any time you import a new copy of Clara into the third_party area
  3. import os
  4. import sys
  5. import embed
  6. rootPath = os.path.dirname(os.path.realpath( os.path.dirname(sys.argv[0])))
  7. filename = os.path.join( rootPath, "third_party", "clara.hpp" )
  8. outfilename = os.path.join( rootPath, "include", "external", "clara.hpp" )
  9. # Mapping of pre-processor identifiers
  10. idMap = {
  11. "CLARA_HPP_INCLUDED": "CATCH_CLARA_HPP_INCLUDED",
  12. "CLARA_CONFIG_CONSOLE_WIDTH": "CATCH_CLARA_CONFIG_CONSOLE_WIDTH",
  13. "CLARA_TEXTFLOW_HPP_INCLUDED": "CATCH_CLARA_TEXTFLOW_HPP_INCLUDED",
  14. "CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH": "CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH",
  15. "CLARA_PLATFORM_WINDOWS": "CATCH_PLATFORM_WINDOWS"
  16. }
  17. # outer namespace to add
  18. outerNamespace = { "clara": ("Catch", "clara") }
  19. mapper = embed.LineMapper( idMap, outerNamespace )
  20. mapper.mapFile( filename, outfilename )