More work on dos line endings, FFS
This commit is contained in:
1
EnginePatches/PatchedDosFiles
Normal file
1
EnginePatches/PatchedDosFiles
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Setup.bat
|
||||||
30
build.py
30
build.py
@@ -96,26 +96,19 @@ def expand_json_file(sourcefile, outputfile, config):
|
|||||||
# patch, and then convert the appropriate files back.
|
# patch, and then convert the appropriate files back.
|
||||||
#
|
#
|
||||||
|
|
||||||
def patched_files(patchfn):
|
|
||||||
patch_lines = Path(patchfn).read_text().splitlines()
|
|
||||||
file_names = [line[4:].split()[0] for line in patch_lines if line.startswith('--- ')]
|
|
||||||
return [ '/'.join(file.split('/')[1:]) for file in file_names ]
|
|
||||||
|
|
||||||
def dos2unix(fn):
|
def dos2unix(fn):
|
||||||
before = Path(fn).read_text()
|
before = Path(fn).read_bytes()
|
||||||
after = before.replace("\r\n", "\n")
|
after = before.replace(b"\r\n", b"\n")
|
||||||
if before != after:
|
if before != after:
|
||||||
Path(fn).write_text(after)
|
print("dos2unix ", fn)
|
||||||
return True
|
Path(fn).write_bytes(after)
|
||||||
return False
|
|
||||||
|
|
||||||
def unix2dos(fn):
|
def unix2dos(fn):
|
||||||
before = Path(fn).read_text()
|
before = Path(fn).read_bytes()
|
||||||
after = before.replace("\n", "\r\n")
|
after = before.replace(b"\n", b"\r\n")
|
||||||
if before != after:
|
if before != after:
|
||||||
Path(fn).write_text(after)
|
print("unix2dos ", fn)
|
||||||
return True
|
Path(fn).write_bytes(after)
|
||||||
return False
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Given a patch file, generate a list of the files being modified.
|
# Given a patch file, generate a list of the files being modified.
|
||||||
@@ -203,12 +196,11 @@ def unzip_unreal_engine_and_apply_patch():
|
|||||||
shutil.rmtree(unrealversion, ignore_errors=True)
|
shutil.rmtree(unrealversion, ignore_errors=True)
|
||||||
shell(INTEGRATION, "unzip UnrealEngine.zip")
|
shell(INTEGRATION, "unzip UnrealEngine.zip")
|
||||||
patchfile = f"{INTEGRATION}/EnginePatches/EnginePatch"
|
patchfile = f"{INTEGRATION}/EnginePatches/EnginePatch"
|
||||||
|
dosfiles = Path(f"{INTEGRATION}/EnginePatches/PatchedDosFiles").read_text().splitlines()
|
||||||
dos2unix(patchfile)
|
dos2unix(patchfile)
|
||||||
rel_files = patched_files(patchfile)
|
for file in dosfiles: dos2unix(f"{unrealversion}/{file}")
|
||||||
abs_files = [ os.path.join(unrealversion, file) for file in rel_files ]
|
|
||||||
dos_files = [ file for file in abs_files if dos2unix(file)]
|
|
||||||
shell(unrealversion, f"patch -p1 < {patchfile}")
|
shell(unrealversion, f"patch -p1 < {patchfile}")
|
||||||
for file in dos_files: unix2dos(file)
|
for file in dosfiles: unix2dos(f"{unrealversion}/{file}")
|
||||||
Path(unrealversion).rename(UNREALENGINE)
|
Path(unrealversion).rename(UNREALENGINE)
|
||||||
|
|
||||||
def generate_buildconfiguration_xml():
|
def generate_buildconfiguration_xml():
|
||||||
|
|||||||
Reference in New Issue
Block a user