From 4d2c3d08e64909cd6c78c65d53ba5ec7b9bbd05f Mon Sep 17 00:00:00 2001 From: Fischer Moseley <42497969+fischermoseley@users.noreply.github.com> Date: Thu, 13 Apr 2023 19:48:47 -0400 Subject: [PATCH] fix line ending bug on windows --- src/manta/__init__.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/manta/__init__.py b/src/manta/__init__.py index 673d1ba..08e9d6b 100644 --- a/src/manta/__init__.py +++ b/src/manta/__init__.py @@ -16,6 +16,13 @@ class VerilogManipulator: self.hdl = self.hdl.replace("`timescale 1ns/1ps", "") self.hdl = self.hdl.strip() + # python tries to be cute and automatically convert + # line endings on Windows, but Manta's source comes + # with (and injects) UNIX line endings, so Python + # ends up adding way too many line breaks, so we just + # undo anything it's done when we load the file + self.hdl = self.hdl.replace("\r\n", "\n") + else: self.hdl = None