From 10bec3eee0f62d435599127326a6748a5538e613 Mon Sep 17 00:00:00 2001 From: aothms Date: Thu, 18 Feb 2016 14:57:57 +0100 Subject: [PATCH] Replace PYTHONPATH with PYTHONHOME --- win/build-deps.cmd | 8 ++++---- win/readme.md | 6 +++--- win/run-cmake.bat | 12 ++++++------ win/set-python-to-path.bat | 8 ++++---- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/win/build-deps.cmd b/win/build-deps.cmd index b145347bf9..d7d8b44b35 100644 --- a/win/build-deps.cmd +++ b/win/build-deps.cmd @@ -253,7 +253,7 @@ set PYTHON_VERSION=3.4.3 IF "%IFCOS_USE_PYTHON2%"=="TRUE" set PYTHON_VERSION=2.7.10 set PY_VER_MAJOR_MINOR=%PYTHON_VERSION:~0,3% set PY_VER_MAJOR_MINOR=%PY_VER_MAJOR_MINOR:.=% -set PYTHONPATH=%INSTALL_DIR%\Python%PY_VER_MAJOR_MINOR% +set PYTHONHOME=%INSTALL_DIR%\Python%PY_VER_MAJOR_MINOR% set DEPENDENCY_NAME=Python %PYTHON_VERSION% set DEPENDENCY_DIR=N/A @@ -265,7 +265,7 @@ set PYTHON_INSTALLER=python-%PYTHON_VERSION%%PYTHON_AMD64_POSTFIX%.msi IF "%IFCOS_INSTALL_PYTHON%"=="TRUE" ( REM Store Python versions to BuildDepsCache.txt for run-cmake.bat echo PY_VER_MAJOR_MINOR=%PY_VER_MAJOR_MINOR%>"%~dp0\BuildDepsCache-%TARGET_ARCH%.txt" - echo PYTHONPATH=%PYTHONPATH%>>"%~dp0\BuildDepsCache-%TARGET_ARCH%.txt" + echo PYTHONHOME=%PYTHONHOME%>>"%~dp0\BuildDepsCache-%TARGET_ARCH%.txt" cd "%DEPS_DIR%" call :DownloadFile https://www.python.org/ftp/python/%PYTHON_VERSION%/%PYTHON_INSTALLER% "%DEPS_DIR%" %PYTHON_INSTALLER% @@ -276,9 +276,9 @@ IF "%IFCOS_INSTALL_PYTHON%"=="TRUE" ( msiexec /x %PYTHON_INSTALLER% /qn ) - IF NOT EXIST "%PYTHONPATH%". ( + IF NOT EXIST "%PYTHONHOME%". ( call cecho.cmd 0 13 "Installing %DEPENDENCY_NAME%. Please be patient, this will take a while." - msiexec /qn /i %PYTHON_INSTALLER% TARGETDIR="%PYTHONPATH%" + msiexec /qn /i %PYTHON_INSTALLER% TARGETDIR="%PYTHONHOME%" ) ELSE ( call cecho.cmd 0 13 "%DEPENDENCY_NAME% already installed. Skipping." ) diff --git a/win/readme.md b/win/readme.md index f91e3a7bae..dd85e652e0 100644 --- a/win/readme.md +++ b/win/readme.md @@ -40,7 +40,7 @@ After this, one can build the project using the `IfcOpenShell.sln` file in the b if wanted. Convenience batch files `build-ifcopenshell.cmd` and `install-ifcopenshell.cmd` can also be used. The batch files expect `%1` and `%2` in same fashion as above and possible extra parameters are passed for the `MSBuild` call. The project will be installed to `installed-vs-\` folder in the project's root folder and the required IfcOpenShell-Python -parts are deployed to the `\Lib\site-packages\` folder. +parts are deployed to the `\Lib\site-packages\` folder. **Note:** All of the dependencies are build as static libraries against the static run-time allowing the developer to effortlessly deploy standalone IFCOS binaries. @@ -58,7 +58,7 @@ Before building the dependencies, disable the script from installing Python: After bulding the dependencies, create BuildDepsCache file to `IfcOpenShell\win` which tells the used Python version and intallation directory: ``` > echo PY_VER_MAJOR_MINOR=35> BuildDepsCache-x64.txt -> echo PYTHONPATH=C:\Python3>> BuildDepsCache-x64.txt +> echo PYTHONHOME=C:\Python3>> BuildDepsCache-x64.txt ``` After this you should be able to run `run-cmake.bat` normally. If using 32-bit Python, the name of the file must be `BuildDepsCache-x86.txt`. @@ -80,7 +80,7 @@ Directory Structure | install-ifcopenshell.cmd - Builds IFCOS's INSTALL project | readme.md - This file | run-cmake.bat - Sets environment variables for the dependencies and runs CMake for IFCOS -| set-python-to-path.bat - Utility for setting PYTHONPATH (read from BuildDepsCache-.txt) to PATH +| set-python-to-path.bat - Utility for setting PYTHONHOME (read from BuildDepsCache-.txt) to PATH | vs-cfg.cmd - Utility file used by the build scripts +---sln - Contains the old Visual Studio solution and project files \---utils - Contains various utilities for the build scripts diff --git a/win/run-cmake.bat b/win/run-cmake.bat index c714b72484..1c2865d723 100644 --- a/win/run-cmake.bat +++ b/win/run-cmake.bat @@ -53,12 +53,12 @@ set OCC_LIBRARY_DIR=%INSTALL_DIR%\oce\Win%ARCH_BITS%\lib set OPENCOLLADA_INCLUDE_DIR=%INSTALL_DIR%\OpenCOLLADA\include\opencollada set OPENCOLLADA_LIBRARY_DIR=%INSTALL_DIR%\OpenCOLLADA\lib\opencollada if not defined PY_VER_MAJOR_MINOR set PY_VER_MAJOR_MINOR=34 -if not defined PYTHONPATH set PYTHONPATH=%INSTALL_DIR%\Python%PY_VER_MAJOR_MINOR% -set PYTHON_INCLUDE_DIR=%PYTHONPATH%\include -set PYTHON_LIBRARY=%PYTHONPATH%\libs\python%PY_VER_MAJOR_MINOR%.lib -set PYTHON_EXECUTABLE=%PYTHONPATH%\python.exe +if not defined PYTHONHOME set PYTHONHOME=%INSTALL_DIR%\Python%PY_VER_MAJOR_MINOR% +set PYTHON_INCLUDE_DIR=%PYTHONHOME%\include +set PYTHON_LIBRARY=%PYTHONHOME%\libs\python%PY_VER_MAJOR_MINOR%.lib +set PYTHON_EXECUTABLE=%PYTHONHOME%\python.exe set SWIG_DIR=%INSTALL_DIR%\swigwin -set PATH=%PATH%;%SWIG_DIR%;%PYTHONPATH% +set PATH=%PATH%;%SWIG_DIR%;%PYTHONHOME% :: TODO 3ds Max SDK? echo. @@ -75,7 +75,7 @@ echo OCC_INCLUDE_DIR = %OCC_INCLUDE_DIR% echo OCC_LIBRARY_DIR = %OCC_LIBRARY_DIR% echo OPENCOLLADA_INCLUDE_DIR = %OPENCOLLADA_INCLUDE_DIR% echo OPENCOLLADA_LIBRARY_DIR = %OPENCOLLADA_LIBRARY_DIR% -echo PYTHONPATH = %PYTHONPATH% +echo PYTHONHOME = %PYTHONHOME% echo PYTHON_INCLUDE_DIR = %PYTHON_INCLUDE_DIR% echo PYTHON_LIBRARY = %PYTHON_LIBRARY% echo PYTHON_EXECUTABLE = %PYTHON_EXECUTABLE% diff --git a/win/set-python-to-path.bat b/win/set-python-to-path.bat index 613a69c149..b9f225be7a 100644 --- a/win/set-python-to-path.bat +++ b/win/set-python-to-path.bat @@ -27,10 +27,10 @@ if not exist BuildDepsCache-%TARGET_ARCH%.txt. ( goto :EOF ) for /f "delims== tokens=1,2" %%G in (BuildDepsCache-%TARGET_ARCH%.txt) do set %%G=%%H -if not defined PYTHONPATH ( - echo PYTHONPATH PYTHONPATH not defined +if not defined PYTHONHOME ( + echo PYTHONHOME PYTHONHOME not defined goto :EOF ) -echo %PYTHONPATH% set to PATH -set PATH=%PYTHONPATH%;%PATH% +echo %PYTHONHOME% set to PATH +set PATH=%PYTHONHOME%;%PATH%