aboutsummaryrefslogtreecommitdiffstats
path: root/linebreakremover
diff options
context:
space:
mode:
authorjwansek <eddie.atten.ea29@gmail.com>2024-03-08 15:34:34 +0000
committerjwansek <eddie.atten.ea29@gmail.com>2024-03-08 15:34:34 +0000
commit7da02b8777578beef0967c29577a2e90446e1417 (patch)
tree1606e8299c7bb2f9e32c3062b88a3cbbd497ea3e /linebreakremover
parent2fdb49f90bfb5e47bb2bb3db4aa1fe6981980999 (diff)
downloadGPlatesHelpers-7da02b8777578beef0967c29577a2e90446e1417.tar.gz
GPlatesHelpers-7da02b8777578beef0967c29577a2e90446e1417.zip
Added the scripts
Diffstat (limited to 'linebreakremover')
-rw-r--r--linebreakremover/Makefile7
-rw-r--r--linebreakremover/linebreakremover.py17
2 files changed, 24 insertions, 0 deletions
diff --git a/linebreakremover/Makefile b/linebreakremover/Makefile
new file mode 100644
index 0000000..2d5e244
--- /dev/null
+++ b/linebreakremover/Makefile
@@ -0,0 +1,7 @@
+make:
+ pyinstaller linebreakremover.py --onefile
+
+clean:
+ rm -r build/
+ rm -r dist/
+ rm linebreakremover.spec \ No newline at end of file
diff --git a/linebreakremover/linebreakremover.py b/linebreakremover/linebreakremover.py
new file mode 100644
index 0000000..051aac3
--- /dev/null
+++ b/linebreakremover/linebreakremover.py
@@ -0,0 +1,17 @@
+import sys
+import re
+
+try:
+ input_path = sys.argv[1]
+ output_path = sys.argv[2]
+except IndexError:
+ print("You need to specify the path to the .rot file as the first parameter and the output file path as the second parameter e.g. python linebreaker.py Rotation.rot output.rot")
+ exit(-1)
+
+with open(input_path, "r") as f:
+ input_ = f.read()
+
+output = re.sub(r"\n{2,}", "\n", input_)
+
+with open(output_path, "w") as f:
+ f.write(output)