Merge pull request #237 from gilles-peskine-arm/config_checks_generator-fix-windows-path

Fix generate_config_checks.py --list on Windows
This commit is contained in:
Valerio Setti
2025-11-18 12:04:33 +01:00
committed by GitHub
@@ -10,6 +10,7 @@ See framework/docs/architecture/config-check-framework.md for information.
import argparse
import enum
import os
import posixpath
import re
import sys
import textwrap
@@ -256,7 +257,9 @@ def generate_header_files(branch_data: BranchData,
"""Generate the header files to include before and after *config.h."""
for position in Position:
generator = HeaderGenerator(branch_data, position)
yield os.path.join(directory, generator.output_file_name())
# Make sure to output a path with / even on Windows, so that
# it can be consumed by tools such as CMake.
yield posixpath.join(directory, generator.output_file_name())
if not list_only:
generator.write(directory)
@@ -280,7 +283,7 @@ def main(branch_data: BranchData) -> None:
parser.add_argument('--list-for-cmake', action='store_true',
help='List generated files in CMake-friendly format and exit')
parser.add_argument('output_directory', metavar='DIR', nargs='?',
default=os.path.join(root, branch_data.header_directory),
default=posixpath.join(root, branch_data.header_directory),
help='output file location (default: %(default)s)')
options = parser.parse_args()
list_only = options.list or options.list_for_cmake