Explorar el Código

xxd.py: always write \n line endings

Previously, `open()` was used with the default option of `newline=None`,
which means that “any '\n' characters written are translated to the
system default line separator”. Now, `xxd.py` always writes `\n` line
endings. This eliminates the need for the .gitattributes file.
Vlad-Stefan Harbuz hace 1 año
padre
commit
796713b9d5
Se han modificado 2 ficheros con 1 adiciones y 13 borrados
  1. 0 12
      .gitattributes
  2. 1 1
      cmake/xxd.py

+ 0 - 12
.gitattributes

@@ -1,12 +0,0 @@
-*.c                 text
-*.cpp               text
-*.h                 text
-*.cmake             text
-*.py                text
-*.txt               text
-*.sh                text
-*.vcxproj           text eol=crlf
-*.sln               text eol=crlf
-*.filters           text eol=crlf
-*.appxmanifest      text eol=crlf
-*.pbxproj           text

+ 1 - 1
cmake/xxd.py

@@ -17,7 +17,7 @@ def main():
 
     binary_data = args.input.open("rb").read()
 
-    with args.output.open("w") as fout:
+    with args.output.open("w", newline="\n") as fout:
         fout.write("unsigned char {}[] = {{\n".format(varname))
         bytes_written = 0
         while bytes_written < len(binary_data):