Added CRLF checks for main.py to build scripts
* Some of the source files changed from crlf to lf and I'm not sure when/how * This is likely overkill but it didn't take long
This commit is contained in:
parent
8b56ca30a2
commit
c1e391132b
3 changed files with 61 additions and 4 deletions
45
.bin/Scripts/borrowed/set-eol.ps1
Normal file
45
.bin/Scripts/borrowed/set-eol.ps1
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
## Borrowed from https://ss64.com/ps/syntax-set-eol.html
|
||||||
|
#
|
||||||
|
# set-eol.ps1
|
||||||
|
# Change the line endings of a text file to: Windows (CR/LF), Unix (LF) or Mac (CR)
|
||||||
|
# Requires PowerShell 3.0 or greater
|
||||||
|
|
||||||
|
# Syntax
|
||||||
|
# ./set-eol.ps1 -lineEnding {mac|unix|win} -file FullFilename
|
||||||
|
|
||||||
|
# mac, unix or win : The file endings desired.
|
||||||
|
# FullFilename : The full pathname of the file to be modified.
|
||||||
|
|
||||||
|
# ./set-eol win "c:\demo\data.txt"
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
Param(
|
||||||
|
[Parameter(Mandatory=$True,Position=1)]
|
||||||
|
[ValidateSet("mac","unix","win")]
|
||||||
|
[string]$lineEnding,
|
||||||
|
[Parameter(Mandatory=$True)]
|
||||||
|
[string]$file
|
||||||
|
)
|
||||||
|
|
||||||
|
# Convert the friendly name into a PowerShell EOL character
|
||||||
|
Switch ($lineEnding) {
|
||||||
|
"mac" { $eol="`r" }
|
||||||
|
"unix" { $eol="`n" }
|
||||||
|
"win" { $eol="`r`n" }
|
||||||
|
}
|
||||||
|
|
||||||
|
# Replace CR+LF with LF
|
||||||
|
$text = [IO.File]::ReadAllText($file) -replace "`r`n", "`n"
|
||||||
|
[IO.File]::WriteAllText($file, $text)
|
||||||
|
|
||||||
|
# Replace CR with LF
|
||||||
|
$text = [IO.File]::ReadAllText($file) -replace "`r", "`n"
|
||||||
|
[IO.File]::WriteAllText($file, $text)
|
||||||
|
|
||||||
|
# At this point all line-endings should be LF.
|
||||||
|
|
||||||
|
# Replace LF with intended EOL char
|
||||||
|
if ($eol -ne "`n") {
|
||||||
|
$text = [IO.File]::ReadAllText($file) -replace "`n", $eol
|
||||||
|
[IO.File]::WriteAllText($file, $text)
|
||||||
|
}
|
||||||
|
|
@ -22,10 +22,15 @@ mkdir OUT_KIT\.cbin >nul 2>&1
|
||||||
attrib +h OUT_KIT\.bin >nul 2>&1
|
attrib +h OUT_KIT\.bin >nul 2>&1
|
||||||
attrib +h OUT_KIT\.cbin >nul 2>&1
|
attrib +h OUT_KIT\.cbin >nul 2>&1
|
||||||
|
|
||||||
|
:EnsureCRLF
|
||||||
|
rem Rewrite main.py using PowerShell to have CRLF/`r`n lineendings
|
||||||
|
set "script=OUT_KIT\.bin\Scripts\borrowed\set-eol.ps1"
|
||||||
|
set "main=OUT_KIT\.bin\Scripts\settings\main.py"
|
||||||
|
powershell -executionpolicy bypass -noprofile -file %script% -lineEndings win -file %main% || goto ErrorUnknown
|
||||||
|
|
||||||
:Launch
|
:Launch
|
||||||
rem Calls the Launch.cmd script using the variables defined above
|
set "script=OUT_KIT\.bin\Scripts\build_kit.ps1"
|
||||||
set "file=OUT_KIT\.bin\Scripts\build_kit.ps1"
|
powershell -executionpolicy bypass -noprofile -file %script% || goto ErrorUnknown
|
||||||
powershell -executionpolicy bypass -noprofile -file %file% || goto ErrorUnknown
|
|
||||||
goto Exit
|
goto Exit
|
||||||
|
|
||||||
:: Functions ::
|
:: Functions ::
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,15 @@ if not exist "%dandi_set_env%" (goto ErrorKitNotFound)
|
||||||
if not exist "%ps_script%" (goto ErrorPSScriptMissing)
|
if not exist "%ps_script%" (goto ErrorPSScriptMissing)
|
||||||
call "%dandi_set_env%" || goto ErrorUnknown
|
call "%dandi_set_env%" || goto ErrorUnknown
|
||||||
|
|
||||||
|
:EnsureCRLF
|
||||||
|
rem Rewrite main.py using PowerShell to have CRLF/`r`n lineendings
|
||||||
|
set "script=%~dp0\.bin\Scripts\borrowed\set-eol.ps1"
|
||||||
|
set "main=%~dp0\.bin\Scripts\settings\main.py"
|
||||||
|
powershell -executionpolicy bypass -noprofile -file %script% -lineEndings win -file %main% || goto ErrorUnknown
|
||||||
|
|
||||||
:Launch
|
:Launch
|
||||||
PowerShell -ExecutionPolicy bypass -File %ps_script%"
|
set "script=%~dp0\.bin\Scripts\build_pe.ps1"
|
||||||
|
powershell -executionpolicy bypass -noprofile -file %script% || goto ErrorUnknown
|
||||||
goto Exit
|
goto Exit
|
||||||
|
|
||||||
:: Functions ::
|
:: Functions ::
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue