summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--LICENSE21
-rwxr-xr-xspatch (renamed from patch.py)8
2 files changed, 24 insertions, 5 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..361f116
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2023 Louis Burda
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/patch.py b/spatch
index 83d9f27..43940f2 100755
--- a/patch.py
+++ b/spatch
@@ -1,7 +1,6 @@
#!/usr/bin/env python3
-import sys, os, re
-from os import path
+import sys, re
file_header = """\
--- ([^\\n\\t]*)(\\t[^\n]*)?
@@ -64,7 +63,7 @@ def patch_file(src_filename, dst_filename, content):
src_nl = dst_nl = True
for i,l in enumerate(chunk_content):
- if i != 0 and l == '\ No newline at end of file':
+ if i != 0 and l == '\\ No newline at end of file':
if chunk_content[i-1][0] == '+':
src_nl = False
elif chunk_content[i-1][0] == '-':
@@ -91,7 +90,6 @@ def main():
else:
targetdir = None
- noprompt = (os.getenv("NOPROMPT") != None)
diff_file = sys.argv[1]
content = open(diff_file).read()
@@ -101,7 +99,7 @@ def main():
return 1
header_matches = list()
next_header_match = True # for do_while loop
- while (next_header_match):
+ while next_header_match:
next_header_match = file_header_pattern.search(content, prev_header_match.span()[1])
header_matches.append(prev_header_match)
prev_header_match = next_header_match