Skip to content

Commit

Permalink
Merge pull request #55 from nexB/configure_for_path_with_spaces_on_wi…
Browse files Browse the repository at this point in the history
…ndows

Configure for path with spaces on windows
  • Loading branch information
pombredanne committed Feb 23, 2022
2 parents 4004ebe + 35af643 commit 70a2d2f
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions configure.bat
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,10 @@ set "CFG_BIN_DIR=%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\Scripts"

@rem ################################
@rem # Thirdparty package locations and index handling
if exist ""%CFG_ROOT_DIR%\thirdparty"" (
set "PIP_EXTRA_ARGS=--find-links %CFG_ROOT_DIR%\thirdparty "
if exist "%CFG_ROOT_DIR%\thirdparty" (
set PIP_EXTRA_ARGS=--find-links "%CFG_ROOT_DIR%\thirdparty"
)

set "PIP_EXTRA_ARGS=%PIP_EXTRA_ARGS% --find-links https://thirdparty.aboutcode.org/pypi" & %INDEX_ARG%
@rem ################################


@rem ################################
Expand Down Expand Up @@ -94,8 +92,8 @@ set "PIP_EXTRA_ARGS=%PIP_EXTRA_ARGS% %NO_INDEX%"
@rem # Otherwise the latest Python by default.
if not defined PYTHON_EXECUTABLE (
@rem # check for a file named PYTHON_EXECUTABLE
if exist ""%CFG_ROOT_DIR%\PYTHON_EXECUTABLE"" (
set /p PYTHON_EXECUTABLE=<""%CFG_ROOT_DIR%\PYTHON_EXECUTABLE""
if exist "%CFG_ROOT_DIR%\PYTHON_EXECUTABLE" (
set /p PYTHON_EXECUTABLE=<"%CFG_ROOT_DIR%\PYTHON_EXECUTABLE"
) else (
set "PYTHON_EXECUTABLE=py"
)
Expand All @@ -107,22 +105,22 @@ if not defined PYTHON_EXECUTABLE (
@rem # presence is not consistent across Linux distro and sometimes pip is not
@rem # included either by default. The virtualenv.pyz app cures all these issues.

if not exist ""%CFG_BIN_DIR%\python.exe"" (
if not exist "%CFG_BIN_DIR%\python.exe" (
if not exist "%CFG_BIN_DIR%" (
mkdir %CFG_BIN_DIR%
mkdir "%CFG_BIN_DIR%"
)

if exist ""%CFG_ROOT_DIR%\etc\thirdparty\virtualenv.pyz"" (
if exist "%CFG_ROOT_DIR%\etc\thirdparty\virtualenv.pyz" (
%PYTHON_EXECUTABLE% "%CFG_ROOT_DIR%\etc\thirdparty\virtualenv.pyz" ^
--wheel embed --pip embed --setuptools embed ^
--seeder pip ^
--never-download ^
--no-periodic-update ^
--no-vcs-ignore ^
%CFG_QUIET% ^
%CFG_ROOT_DIR%\%VIRTUALENV_DIR%
"%CFG_ROOT_DIR%\%VIRTUALENV_DIR%"
) else (
if not exist ""%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\virtualenv.pyz"" (
if not exist "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\virtualenv.pyz" (
curl -o "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\virtualenv.pyz" %VIRTUALENV_PYZ_URL%

if %ERRORLEVEL% neq 0 (
Expand All @@ -136,7 +134,7 @@ if not exist ""%CFG_BIN_DIR%\python.exe"" (
--no-periodic-update ^
--no-vcs-ignore ^
%CFG_QUIET% ^
%CFG_ROOT_DIR%\%VIRTUALENV_DIR%
"%CFG_ROOT_DIR%\%VIRTUALENV_DIR%"
)
)

Expand All @@ -152,7 +150,7 @@ if %ERRORLEVEL% neq 0 (
@rem # speeds up the installation.
@rem # We always have the PEP517 build dependencies installed already.

%CFG_BIN_DIR%\pip install ^
"%CFG_BIN_DIR%\pip" install ^
--upgrade ^
--no-build-isolation ^
%CFG_QUIET% ^
Expand All @@ -163,7 +161,7 @@ if %ERRORLEVEL% neq 0 (
if exist "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\bin" (
rmdir /s /q "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\bin"
)
mklink /J %CFG_ROOT_DIR%\%VIRTUALENV_DIR%\bin %CFG_ROOT_DIR%\%VIRTUALENV_DIR%\Scripts
mklink /J "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\bin" "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\Scripts"

if %ERRORLEVEL% neq 0 (
exit /b %ERRORLEVEL%
Expand Down Expand Up @@ -204,4 +202,4 @@ for %%F in (%CLEANABLE%) do (
rmdir /s /q "%CFG_ROOT_DIR%\%%F" >nul 2>&1
del /f /q "%CFG_ROOT_DIR%\%%F" >nul 2>&1
)
exit /b 0
exit /b 0

0 comments on commit 70a2d2f

Please sign in to comment.