From 970d3bb8b0677c1ddc0251624e815e1fb5b261e8 Mon Sep 17 00:00:00 2001 From: Ryan Blue Date: Mon, 28 Oct 2024 17:58:07 -0400 Subject: [PATCH] Use lf in generated files --- hal/generate_usage_reporting.py | 4 ++-- ntcore/generate_topics.py | 2 +- wpilibNewCommands/generate_hids.py | 2 +- wpilibc/generate_hids.py | 2 +- wpilibc/generate_pwm_motor_controllers.py | 2 +- wpilibj/generate_hids.py | 2 +- wpilibj/generate_pwm_motor_controllers.py | 2 +- wpimath/generate_numbers.py | 2 +- wpimath/generate_quickbuf.py | 1 + 9 files changed, 10 insertions(+), 9 deletions(-) diff --git a/hal/generate_usage_reporting.py b/hal/generate_usage_reporting.py index 95a2357d4f0..955be4f1101 100755 --- a/hal/generate_usage_reporting.py +++ b/hal/generate_usage_reporting.py @@ -49,7 +49,7 @@ def generate_usage_reporting(output_directory: Path, template_directory: Path): ) frc_net_comm = output_directory / f"main/java/{java_package}/FRCNetComm.java" - frc_net_comm.write_text(contents, encoding="utf-8") + frc_net_comm.write_text(contents, encoding="utf-8", newline="\n") with (template_directory / "FRCUsageReporting.h.in").open( encoding="utf-8" @@ -65,7 +65,7 @@ def generate_usage_reporting(output_directory: Path, template_directory: Path): usage_reporting_hdr = ( output_directory / "main/native/include/hal/FRCUsageReporting.h" ) - usage_reporting_hdr.write_text(contents, encoding="utf-8") + usage_reporting_hdr.write_text(contents, encoding="utf-8", newline="\n") def main(argv): diff --git a/ntcore/generate_topics.py b/ntcore/generate_topics.py index ae3d779ab13..50b9c446964 100755 --- a/ntcore/generate_topics.py +++ b/ntcore/generate_topics.py @@ -10,7 +10,7 @@ def Output(output_dir: Path, controller_name: str, contents: str): output_dir.mkdir(parents=True, exist_ok=True) output_file = output_dir / controller_name - output_file.write_text(contents, encoding="utf-8") + output_file.write_text(contents, encoding="utf-8", newline="\n") def generate_topics( diff --git a/wpilibNewCommands/generate_hids.py b/wpilibNewCommands/generate_hids.py index 8f6a5932d34..6e349d94b42 100755 --- a/wpilibNewCommands/generate_hids.py +++ b/wpilibNewCommands/generate_hids.py @@ -14,7 +14,7 @@ def write_controller_file(output_dir: Path, controller_name: str, contents: str): output_dir.mkdir(parents=True, exist_ok=True) output_file = output_dir / controller_name - output_file.write_text(contents, encoding="utf-8") + output_file.write_text(contents, encoding="utf-8", newline="\n") def generate_hids(output_directory: Path, template_directory: Path, schema_file: Path): diff --git a/wpilibc/generate_hids.py b/wpilibc/generate_hids.py index 7c0689fc348..76a879c1238 100755 --- a/wpilibc/generate_hids.py +++ b/wpilibc/generate_hids.py @@ -14,7 +14,7 @@ def write_controller_file(output_dir: Path, controller_name: str, contents: str): output_dir.mkdir(parents=True, exist_ok=True) output_file = output_dir / controller_name - output_file.write_text(contents, encoding="utf-8") + output_file.write_text(contents, encoding="utf-8", newline="\n") def generate_hids(output_directory: Path, template_directory: Path, schema_file: Path): diff --git a/wpilibc/generate_pwm_motor_controllers.py b/wpilibc/generate_pwm_motor_controllers.py index 84d32a7498b..a04b918cc4f 100755 --- a/wpilibc/generate_pwm_motor_controllers.py +++ b/wpilibc/generate_pwm_motor_controllers.py @@ -20,7 +20,7 @@ def render_template( output_dir.mkdir(parents=True, exist_ok=True) output_file = output_dir / filename - output_file.write_text(template.render(controller), encoding="utf-8") + output_file.write_text(template.render(controller), encoding="utf-8", newline="\n") def generate_cpp_headers( diff --git a/wpilibj/generate_hids.py b/wpilibj/generate_hids.py index 3f1ab48f31f..aaa13bf7cf1 100755 --- a/wpilibj/generate_hids.py +++ b/wpilibj/generate_hids.py @@ -14,7 +14,7 @@ def write_controller_file(output_dir: Path, controller_name: str, contents: str): output_dir.mkdir(parents=True, exist_ok=True) output_file = output_dir / controller_name - output_file.write_text(contents, encoding="utf-8") + output_file.write_text(contents, encoding="utf-8", newline="\n") def generate_hids(output_directory: Path, template_directory: Path): diff --git a/wpilibj/generate_pwm_motor_controllers.py b/wpilibj/generate_pwm_motor_controllers.py index 650f0aba29a..a8dd780207a 100755 --- a/wpilibj/generate_pwm_motor_controllers.py +++ b/wpilibj/generate_pwm_motor_controllers.py @@ -19,7 +19,7 @@ def render_template( output_dir.mkdir(parents=True, exist_ok=True) output_file = output_dir / filename - output_file.write_text(template.render(controller), encoding="utf-8") + output_file.write_text(template.render(controller), encoding="utf-8", newline="\n") def generate_pwm_motor_controllers(output_root, template_root): diff --git a/wpimath/generate_numbers.py b/wpimath/generate_numbers.py index ec55ff63cc5..b95800e4d4d 100755 --- a/wpimath/generate_numbers.py +++ b/wpimath/generate_numbers.py @@ -13,7 +13,7 @@ def output(output_dir: Path, outfn: str, contents: str): output_dir.mkdir(parents=True, exist_ok=True) output_file = output_dir / outfn - output_file.write_text(contents, encoding="utf-8") + output_file.write_text(contents, encoding="utf-8", newline="\n") def generate_numbers(output_directory: Path, template_root: Path): diff --git a/wpimath/generate_quickbuf.py b/wpimath/generate_quickbuf.py index 9faef53d08f..cb5eb59d33c 100755 --- a/wpimath/generate_quickbuf.py +++ b/wpimath/generate_quickbuf.py @@ -34,6 +34,7 @@ def generate_quickbuf( "// Copyright (c) FIRST and other WPILib contributors.\n// Open Source Software; you can modify and/or share it under the terms of\n// the WPILib BSD license file in the root directory of this project.\n" + content, encoding="utf-8", + newline="\n" )