aboutsummaryrefslogtreecommitdiff
path: root/tests/unix2dos.py
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2022-07-08 10:23:07 +0200
committerQuentin Dufour <quentin@deuxfleurs.fr>2022-07-08 10:23:07 +0200
commit9675cdb545a139984a2d765397f3a5e26472a49e (patch)
tree5fc4cd78c92e1458e12688a0ee93b3a52c45d289 /tests/unix2dos.py
parentaa6580e0c3fe577283ea1e9d17c092ab8f8a64b0 (diff)
downloadaerogramme-9675cdb545a139984a2d765397f3a5e26472a49e.tar.gz
aerogramme-9675cdb545a139984a2d765397f3a5e26472a49e.zip
Use CRLF as line ending in test files
Diffstat (limited to 'tests/unix2dos.py')
-rwxr-xr-xtests/unix2dos.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/unix2dos.py b/tests/unix2dos.py
new file mode 100755
index 0000000..4e6c9cf
--- /dev/null
+++ b/tests/unix2dos.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python3
+import sys
+
+buf = ""
+with open(sys.argv[1], 'r+b') as f:
+ buf = f.read()
+
+if buf.find(b'\r\n'):
+ print(f"{sys.argv[1]} is already a CRLF file")
+ sys.exit(1)
+
+buf = buf.replace(b'\n', b'\r\n')
+
+with open(sys.argv[1], 'w+b') as f:
+ f.write(buf)