INNER CODE UNIT · Python

run

usnistgov/OSCAL · src/specifications/profile-resolution/spec-tester.py:124

    def run(self, src_path, indent=0) -> ET.ElementTree:
        """
        Run the command specified by `self.command`, substituting `DRIVER_SOURCE_TOKEN` and
        `DRIVER_DESTINATION_TOKEN` with `src_path` and a generated output path respectively.

        Note: Places output files in a temporary directory, consumer must call .cleanup() to remove
        """
        src_name = os.path.basename(src_path)
        # some-profile.xml => some-profile_RESOLVED_$TIMESTAMP.xml
        dest_name = os.path.splitext(
            src_name)[0] + f"_RESOLVED_{time.strftime('%Y%m%d-%H%M%S')}.xml"
        dest_path = os.path.join(self.out_directory, dest_name)

        command = self.command\
            .replace(DRIVER_SOURCE_TOKEN, f"'{src_path}'")\
            .replace(DRIVER_DESTINATION_TOKEN, f"'{dest_path}'")

        self.logger.debug(f"{INDENT_TEXT*indent}Running command `{command}`")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…