Skip to content

Commit 15a3174

Browse files
committed
#Fixed 489 - configure is now working path with spaces
* Normalize quotation marks * Add quotation at proper location to have it works on path contains spaces Signed-off-by: Chin Yeung Li <[email protected]>
1 parent ac509e1 commit 15a3174

File tree

2 files changed

+17
-19
lines changed

2 files changed

+17
-19
lines changed

Diff for: about.bat

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ cd %ABOUT_ROOT_DIR%
1111
set VIRTUALENV_DIR=venv
1212

1313
set CMD_LINE_ARGS=
14-
set CONFIGURED_PYTHON=%ABOUT_ROOT_DIR%\%VIRTUALENV_DIR%\Scripts\python.exe
14+
set CONFIGURED_PYTHON="%ABOUT_ROOT_DIR%\%VIRTUALENV_DIR%\Scripts\python.exe"
1515

1616
@rem Collect all command line arguments in a variable
1717
:collectarg
@@ -28,11 +28,11 @@ goto about
2828

2929
:configure
3030
echo * Configuring AboutCode ...
31-
call %ABOUT_ROOT_DIR%\configure
31+
call "%ABOUT_ROOT_DIR%\configure"
3232

3333
:about
34-
call %ABOUT_ROOT_DIR%\%VIRTUALENV_DIR%\Scripts\activate
35-
echo %ABOUT_ROOT_DIR%\%VIRTUALENV_DIR%\bin\about %CMD_LINE_ARGS%
36-
%ABOUT_ROOT_DIR%\%VIRTUALENV_DIR%\bin\about %CMD_LINE_ARGS%
34+
call "%ABOUT_ROOT_DIR%\%VIRTUALENV_DIR%\Scripts\activate"
35+
echo "%ABOUT_ROOT_DIR%\%VIRTUALENV_DIR%\bin\about" %CMD_LINE_ARGS%
36+
"%ABOUT_ROOT_DIR%\%VIRTUALENV_DIR%\bin\about" %CMD_LINE_ARGS%
3737

3838
:EOS

Diff for: configure.bat

+12-14
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,11 @@ set VIRTUALENV_PYZ_URL=https://bootstrap.pypa.io/virtualenv.pyz
4646
set CFG_ROOT_DIR=%~dp0
4747
set "CFG_BIN_DIR=%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\Scripts"
4848

49-
5049
@rem ################################
5150
@rem # Thirdparty package locations and index handling
52-
set "PIP_EXTRA_ARGS=--find-links %CFG_ROOT_DIR%\thirdparty --find-links https://thirdparty.aboutcode.org/pypi" & %INDEX_ARG%
51+
set "PIP_EXTRA_ARGS=--find-links "%CFG_ROOT_DIR%\thirdparty" --find-links https://thirdparty.aboutcode.org/pypi" & %INDEX_ARG%
5352
@rem ################################
5453

55-
5654
@rem ################################
5755
@rem # Set the quiet flag to empty if not defined
5856
if not defined CFG_QUIET (
@@ -83,15 +81,14 @@ if not "%1" == "" (
8381

8482
set "PIP_EXTRA_ARGS=%PIP_EXTRA_ARGS% %NO_INDEX%"
8583

86-
8784
@rem ################################
8885
@rem # find a proper Python to run
8986
@rem # Use environment variables or a file if available.
9087
@rem # Otherwise the latest Python by default.
9188
if not defined PYTHON_EXECUTABLE (
9289
@rem # check for a file named PYTHON_EXECUTABLE
93-
if exist ""%CFG_ROOT_DIR%\PYTHON_EXECUTABLE"" (
94-
set /p PYTHON_EXECUTABLE=<""%CFG_ROOT_DIR%\PYTHON_EXECUTABLE""
90+
if exist "%CFG_ROOT_DIR%\PYTHON_EXECUTABLE" (
91+
set /p PYTHON_EXECUTABLE=<"%CFG_ROOT_DIR%\PYTHON_EXECUTABLE"
9592
) else (
9693
set "PYTHON_EXECUTABLE=py"
9794
)
@@ -103,22 +100,22 @@ if not defined PYTHON_EXECUTABLE (
103100
@rem # presence is not consistent across Linux distro and sometimes pip is not
104101
@rem # included either by default. The virtualenv.pyz app cures all these issues.
105102

106-
if not exist ""%CFG_BIN_DIR%\python.exe"" (
103+
if not exist "%CFG_BIN_DIR%\python.exe" (
107104
if not exist "%CFG_BIN_DIR%" (
108-
mkdir %CFG_BIN_DIR%
105+
mkdir "%CFG_BIN_DIR%"
109106
)
110107

111-
if exist ""%CFG_ROOT_DIR%\etc\thirdparty\virtualenv.pyz"" (
108+
if exist "%CFG_ROOT_DIR%\etc\thirdparty\virtualenv.pyz" (
112109
%PYTHON_EXECUTABLE% "%CFG_ROOT_DIR%\etc\thirdparty\virtualenv.pyz" ^
113110
--wheel embed --pip embed --setuptools embed ^
114111
--seeder pip ^
115112
--never-download ^
116113
--no-periodic-update ^
117114
--no-vcs-ignore ^
118115
%CFG_QUIET% ^
119-
%CFG_ROOT_DIR%\%VIRTUALENV_DIR%
116+
"%CFG_ROOT_DIR%\%VIRTUALENV_DIR%"
120117
) else (
121-
if not exist ""%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\virtualenv.pyz"" (
118+
if not exist "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\virtualenv.pyz" (
122119
curl -o "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\virtualenv.pyz" %VIRTUALENV_PYZ_URL%
123120

124121
if %ERRORLEVEL% neq 0 (
@@ -132,10 +129,11 @@ if not exist ""%CFG_BIN_DIR%\python.exe"" (
132129
--no-periodic-update ^
133130
--no-vcs-ignore ^
134131
%CFG_QUIET% ^
135-
%CFG_ROOT_DIR%\%VIRTUALENV_DIR%
132+
"%CFG_ROOT_DIR%\%VIRTUALENV_DIR%"
136133
)
137134
)
138135

136+
139137
if %ERRORLEVEL% neq 0 (
140138
exit /b %ERRORLEVEL%
141139
)
@@ -148,7 +146,7 @@ if %ERRORLEVEL% neq 0 (
148146
@rem # speeds up the installation.
149147
@rem # We always have the PEP517 build dependencies installed already.
150148

151-
%CFG_BIN_DIR%\pip install ^
149+
"%CFG_BIN_DIR%\pip" install ^
152150
--upgrade ^
153151
--no-build-isolation ^
154152
%CFG_QUIET% ^
@@ -159,7 +157,7 @@ if %ERRORLEVEL% neq 0 (
159157
if exist "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\bin" (
160158
rmdir /s /q "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\bin"
161159
)
162-
mklink /J %CFG_ROOT_DIR%\%VIRTUALENV_DIR%\bin %CFG_ROOT_DIR%\%VIRTUALENV_DIR%\Scripts
160+
mklink /J "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\bin" "%CFG_ROOT_DIR%\%VIRTUALENV_DIR%\Scripts"
163161

164162
if %ERRORLEVEL% neq 0 (
165163
exit /b %ERRORLEVEL%

0 commit comments

Comments
 (0)