aboutsummaryrefslogtreecommitdiff
path: root/NvCloth/scripts/packman/win-bootstrap/configure.bat
diff options
context:
space:
mode:
authorMarijn Tamis <[email protected]>2018-07-06 17:26:27 +0200
committerMarijn Tamis <[email protected]>2018-07-06 17:26:27 +0200
commitc3ac1004e49545ad0e92c6a1bc6a0a2b8c2ad3d9 (patch)
tree08b85c3d9bcbfec3ee2340e9625b10a5bc1e3dbc /NvCloth/scripts/packman/win-bootstrap/configure.bat
parentFix cmake.packman.xml using an advice from Halldor, so it should work for non... (diff)
downloadnvcloth-c3ac1004e49545ad0e92c6a1bc6a0a2b8c2ad3d9.tar.xz
nvcloth-c3ac1004e49545ad0e92c6a1bc6a0a2b8c2ad3d9.zip
Fixed packman issues. 2447985
Diffstat (limited to 'NvCloth/scripts/packman/win-bootstrap/configure.bat')
-rw-r--r--NvCloth/scripts/packman/win-bootstrap/configure.bat54
1 files changed, 44 insertions, 10 deletions
diff --git a/NvCloth/scripts/packman/win-bootstrap/configure.bat b/NvCloth/scripts/packman/win-bootstrap/configure.bat
index e2781c4..dc94ca6 100644
--- a/NvCloth/scripts/packman/win-bootstrap/configure.bat
+++ b/NvCloth/scripts/packman/win-bootstrap/configure.bat
@@ -1,4 +1,4 @@
-@set PM_PACKMAN_VERSION=5.1
+@set PM_PACKMAN_VERSION=5.4.2
:: Specify where packman command is rooted
@set PM_INSTALL_PATH=%~dp0..
@@ -45,22 +45,45 @@
@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 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
@@ -87,11 +110,13 @@
@del "%TARGET%"
:ENSURE_7ZA
-@set PM_7Za_VERSION=16.02
+@set PM_7Za_VERSION=16.02.2
+@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%" "%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