Skip to content

Commit 7b537de

Browse files
authored
[Windows] Support spaces in $python_path (#829)
Wraps `$python_path` usages in quotes to support python installations in directories with spaces. Fixes: flutter/flutter#143740 Reported and identified by @CodeVisio. ## Pre-launch Checklist - [X] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [X] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [X] I read the [Flutter Style Guide] _recently_, and have followed its advice. - [X] I signed the [CLA]. - [X] I listed at least one issue that this PR fixes in the description above. - [X] Caution: Laser radiation. Do not stare into beam or view directly with optical instruments. - [X] I updated/added relevant documentation (doc comments with `///`). - [X] I added new tests to check the change I am making, or this PR is [test-exempt]. - [X] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat
1 parent 2f684ab commit 7b537de

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

build/toolchain/nacl/BUILD.gn

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ toolchain("x86_newlib") {
4141

4242
if (is_win) {
4343
tool("stamp") {
44-
command = "$python_path gyp-win-tool stamp \$out"
44+
command = "\"$python_path\" gyp-win-tool stamp \$out"
4545
description = "STAMP \$out"
4646
}
4747
} else {

build/toolchain/win/BUILD.gn

+8-8
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ template("msvc_toolchain") {
148148
}
149149

150150
tool("rc") {
151-
command = "$python_path $tool_wrapper_path rc-wrapper $env rc.exe /nologo {{defines}} {{include_dirs}} /fo{{output}} {{source}}"
151+
command = "\"$python_path\" $tool_wrapper_path rc-wrapper $env rc.exe /nologo {{defines}} {{include_dirs}} /fo{{output}} {{source}}"
152152
depsformat = "msvc"
153153
outputs = [
154154
"{{source_out_dir}}/{{target_output_name}}.{{source_name_part}}.res",
@@ -170,7 +170,7 @@ template("msvc_toolchain") {
170170
ml = "ml.exe"
171171
x64 = ""
172172
}
173-
command = "$python_path $tool_wrapper_path asm-wrapper $env $ml $x64 {{defines}} {{include_dirs}} {{asmflags}} "
173+
command = "\"$python_path\" $tool_wrapper_path asm-wrapper $env $ml $x64 {{defines}} {{include_dirs}} {{asmflags}} "
174174
if (is_msvc_assembler) {
175175
command += "-c -o{{output}} {{source}}"
176176
} else {
@@ -183,7 +183,7 @@ template("msvc_toolchain") {
183183

184184
tool("alink") {
185185
rspfile = "{{output}}.rsp"
186-
command = "$python_path $tool_wrapper_path link-wrapper $env False lib.exe /nologo /ignore:4221 /OUT:{{output}} @$rspfile"
186+
command = "\"$python_path\" $tool_wrapper_path link-wrapper $env False lib.exe /nologo /ignore:4221 /OUT:{{output}} @$rspfile"
187187
description = "LIB {{output}}"
188188
outputs = [
189189
# Ignore {{output_extension}} and always use .lib, there's no reason to
@@ -205,10 +205,10 @@ template("msvc_toolchain") {
205205
pdbname = "${dllname}.pdb"
206206
rspfile = "${dllname}.rsp"
207207

208-
link_command = "$python_path $tool_wrapper_path link-wrapper $env False link.exe /nologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:${dllname}.pdb @$rspfile"
208+
link_command = "\"$python_path\" $tool_wrapper_path link-wrapper $env False link.exe /nologo /IMPLIB:$libname /DLL /OUT:$dllname /PDB:${dllname}.pdb @$rspfile"
209209

210210
# TODO(brettw) support manifests
211-
#manifest_command = "$python_path $tool_wrapper_path manifest-wrapper $env mt.exe -nologo -manifest $manifests -out:${dllname}.manifest"
211+
#manifest_command = "\"$python_path\" $tool_wrapper_path manifest-wrapper $env mt.exe -nologo -manifest $manifests -out:${dllname}.manifest"
212212
#command = "cmd /c $link_command && $manifest_command"
213213
command = link_command
214214

@@ -236,10 +236,10 @@ template("msvc_toolchain") {
236236
rspfile = "$binary_output.rsp"
237237
pdbfile = "$binary_output.pdb"
238238

239-
link_command = "$python_path $tool_wrapper_path link-wrapper $env False link.exe /nologo /OUT:$binary_output /PDB:$pdbfile @$rspfile"
239+
link_command = "\"$python_path\" $tool_wrapper_path link-wrapper $env False link.exe /nologo /OUT:$binary_output /PDB:$pdbfile @$rspfile"
240240

241241
# TODO(brettw) support manifests
242-
#manifest_command = "$python_path $tool_wrapper_path manifest-wrapper $env mt.exe -nologo -manifest $manifests -out:{{output}}.manifest"
242+
#manifest_command = "\"$python_path\" $tool_wrapper_path manifest-wrapper $env mt.exe -nologo -manifest $manifests -out:{{output}}.manifest"
243243
#command = "cmd /c $link_command && $manifest_command"
244244
command = link_command
245245

@@ -263,7 +263,7 @@ template("msvc_toolchain") {
263263
}
264264

265265
tool("copy") {
266-
command = "$python_path $tool_wrapper_path recursive-mirror {{source}} {{output}}"
266+
command = "\"$python_path\" $tool_wrapper_path recursive-mirror {{source}} {{output}}"
267267
description = "COPY {{source}} {{output}}"
268268
}
269269
}

0 commit comments

Comments
 (0)