diff options
| author | Bryan Galdrikian <[email protected]> | 2019-05-03 00:25:46 -0700 |
|---|---|---|
| committer | Bryan Galdrikian <[email protected]> | 2019-05-03 00:25:46 -0700 |
| commit | 74b64a27f8e07b1b0b47b809b1a060518fa11a97 (patch) | |
| tree | 34cca01711be56892c149706f02ba7358d87ec54 /buildtools/packman5/win-bootstrap | |
| parent | Fixing chunk reorder bug in BlastTool, when importing a prefractured mesh (diff) | |
| download | blast-1.1.5_pre1.tar.xz blast-1.1.5_pre1.zip | |
Blast SDK 1.1.5 prerelease #1v1.1.5_pre1
Diffstat (limited to 'buildtools/packman5/win-bootstrap')
4 files changed, 58 insertions, 17 deletions
diff --git a/buildtools/packman5/win-bootstrap/configure.bat b/buildtools/packman5/win-bootstrap/configure.bat index a38f697..223a839 100755 --- a/buildtools/packman5/win-bootstrap/configure.bat +++ b/buildtools/packman5/win-bootstrap/configure.bat @@ -1,4 +1,4 @@ -@set PM_PACKMAN_VERSION=5.2.1
+@set PM_PACKMAN_VERSION=5.7.2
:: Specify where packman command is rooted
@set PM_INSTALL_PATH=%~dp0..
@@ -45,31 +45,54 @@ @goto PACKMAN
)
-@set PM_PYTHON_DIR=%PM_PACKAGES_ROOT%\python\2.7.6-windows-x86
+@set PM_PYTHON_VERSION=2.7.14-windows-x86_32
+@set PM_PYTHON_BASE_DIR=%PM_PACKAGES_ROOT%\python
+@set PM_PYTHON_DIR=%PM_PYTHON_BASE_DIR%\%PM_PYTHON_VERSION%
@set PM_PYTHON=%PM_PYTHON_DIR%\python.exe
@if exist "%PM_PYTHON%" goto PACKMAN
+@if not exist "%PM_PYTHON_BASE_DIR%" call :CREATE_PYTHON_BASE_DIR
-@set [email protected]
+@set PM_PYTHON_PACKAGE=python@%PM_PYTHON_VERSION%.cab
@for /f "delims=" %%a in ('powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0\generate_temp_file_name.ps1"') do @set TEMP_FILE_NAME=%%a
-@set TARGET=%TEMP_FILE_NAME%.exe
+@set TARGET=%TEMP_FILE_NAME%.zip
@call "%~dp0fetch_file_from_s3.cmd" %PM_PYTHON_PACKAGE% "%TARGET%"
@if errorlevel 1 goto ERROR
-@echo Unpacking ...
-@"%TARGET%" -o"%PM_PYTHON_DIR%" -y 1> nul
-@if errorlevel 1 goto ERROR
-
+@for /f "delims=" %%a in ('powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0\generate_temp_folder.ps1" -parentPath "%PM_PYTHON_BASE_DIR%"') do @set TEMP_FOLDER_NAME=%%a
+@echo Unpacking Python interpreter ...
+@expand -F:* "%TARGET%" "%TEMP_FOLDER_NAME%" 1> nul
@del "%TARGET%"
+:: Failure during extraction to temp folder name, need to clean up and abort
+@if errorlevel 1 (
+ @call :CLEAN_UP_TEMP_FOLDER
+ @goto ERROR
+)
+
+:: If python has now been installed by a concurrent process we need to clean up and then continue
+@if exist "%PM_PYTHON%" (
+ @call :CLEAN_UP_TEMP_FOLDER
+ @goto PACKMAN
+) else (
+ @if exist "%PM_PYTHON_DIR%" ( @rd /s /q "%PM_PYTHON_DIR%" > nul )
+)
+
+:: Perform atomic rename
+@rename "%TEMP_FOLDER_NAME%" "%PM_PYTHON_VERSION%" 1> nul
+:: Failure during move, need to clean up and abort
+@if errorlevel 1 (
+ @call :CLEAN_UP_TEMP_FOLDER
+ @goto ERROR
+)
:PACKMAN
:: The packman module may already be externally configured
-@if defined PM_MODULE_EXT (
- @set PM_MODULE=%PM_MODULE_EXT%
- @goto ENSURE_7za
+@if defined PM_MODULE_DIR_EXT (
+ @set PM_MODULE_DIR=%PM_MODULE_DIR_EXT%
+) else (
+ @set PM_MODULE_DIR=%PM_PACKAGES_ROOT%\packman-common\%PM_PACKMAN_VERSION%
)
-@set PM_MODULE_DIR=%PM_PACKAGES_ROOT%\packman-common\%PM_PACKMAN_VERSION%
@set PM_MODULE=%PM_MODULE_DIR%\packman.py
@if exist "%PM_MODULE%" goto ENSURE_7ZA
@@ -81,17 +104,19 @@ @if errorlevel 1 goto ERROR
@echo Unpacking ...
-@"%PM_PYTHON%" "%~dp0\install_package.py" "%TARGET%" "%PM_MODULE_DIR%"
+@"%PM_PYTHON%" -s -u -E "%~dp0\install_package.py" "%TARGET%" "%PM_MODULE_DIR%"
@if errorlevel 1 goto ERROR
@del "%TARGET%"
:ENSURE_7ZA
-@set PM_7Za_VERSION=16.02.2
+@set PM_7Za_VERSION=16.02.4
+@set PM_7Za_PATH=%PM_PACKAGES_ROOT%\7za\%PM_7ZA_VERSION%
+@if exist "%PM_7Za_PATH%" goto END
@set PM_7Za_PATH=%PM_PACKAGES_ROOT%\chk\7za\%PM_7ZA_VERSION%
@if exist "%PM_7Za_PATH%" goto END
-@"%PM_PYTHON%" "%PM_MODULE%" install 7za %PM_7za_VERSION% -r packman:cloudfront
+@"%PM_PYTHON%" -s -u -E "%PM_MODULE%" pull "%PM_MODULE_DIR%\deps.packman.xml"
@if errorlevel 1 goto ERROR
@goto END
@@ -109,4 +134,13 @@ @echo !!! Failure while configuring local machine :( !!!
@exit /B 1
+:CLEAN_UP_TEMP_FOLDER
+@rd /S /Q "%TEMP_FOLDER_NAME%"
+@exit /B
+
+:CREATE_PYTHON_BASE_DIR
+:: We ignore errors and clean error state - if two processes create the directory one will fail which is fine
+@md "%PM_PYTHON_BASE_DIR%" > nul 2>&1
+@exit /B 0
+
:END
diff --git a/buildtools/packman5/win-bootstrap/fetch_file_from_s3.cmd b/buildtools/packman5/win-bootstrap/fetch_file_from_s3.cmd index 90f717a..4e31293 100755 --- a/buildtools/packman5/win-bootstrap/fetch_file_from_s3.cmd +++ b/buildtools/packman5/win-bootstrap/fetch_file_from_s3.cmd @@ -3,7 +3,7 @@ @set PACKAGE_NAME=%1
@set TARGET_PATH=%2
-@echo Fetching %PACKAGE_NAME% from S3 ...
+@echo Fetching %PACKAGE_NAME% from packman-bootstrap over HTTP ...
@powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0fetch_file_from_s3.ps1" -sourceName %PACKAGE_NAME% ^
-output %TARGET_PATH%
diff --git a/buildtools/packman5/win-bootstrap/fetch_file_from_s3.ps1 b/buildtools/packman5/win-bootstrap/fetch_file_from_s3.ps1 index 132fe0d..96db7f2 100755 --- a/buildtools/packman5/win-bootstrap/fetch_file_from_s3.ps1 +++ b/buildtools/packman5/win-bootstrap/fetch_file_from_s3.ps1 @@ -2,7 +2,7 @@ param( [Parameter(Mandatory=$true)][string]$sourceName=$null,
[string]$output="out.exe"
)
-$source = "http://packman.s3.amazonaws.com/" + $sourceName
+$source = "http://packman-bootstrap.s3.amazonaws.com/" + $sourceName
$filename = $output
$triesLeft = 3
diff --git a/buildtools/packman5/win-bootstrap/generate_temp_folder.ps1 b/buildtools/packman5/win-bootstrap/generate_temp_folder.ps1 new file mode 100644 index 0000000..b24a654 --- /dev/null +++ b/buildtools/packman5/win-bootstrap/generate_temp_folder.ps1 @@ -0,0 +1,7 @@ +param( +[Parameter(Mandatory=$true)][string]$parentPath=$null +) +[string] $name = [System.Guid]::NewGuid() +$out = Join-Path $parentPath $name +New-Item -ItemType Directory -Path ($out) | Out-Null +Write-Host $out |