Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
f45153a2
Commit
f45153a2
authored
Oct 27, 2018
by
Steve Dower
Committed by
GitHub
Oct 27, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-35067: Remove _distutils_findvs and use vswhere.exe instead. (GH-10095)
parent
a23e74ec
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
32 deletions
+32
-32
_msvccompiler.py
_msvccompiler.py
+32
-32
No files found.
_msvccompiler.py
View file @
f45153a2
...
@@ -56,43 +56,43 @@ def _find_vc2015():
...
@@ -56,43 +56,43 @@ def _find_vc2015():
return
best_version
,
best_dir
return
best_version
,
best_dir
def
_find_vc2017
():
def
_find_vc2017
():
import
_distutils_findvs
"""Returns "15, path" based on the result of invoking vswhere.exe
import
threading
If no install is found, returns "None, None"
best_version
=
0
,
# tuple for full version comparisons
The version is returned to avoid unnecessarily changing the function
best_dir
=
None
result. It may be ignored when the path is not None.
If vswhere.exe is not available, by definition, VS 2017 is not
installed.
"""
import
json
root
=
os
.
environ
.
get
(
"ProgramFiles(x86)"
)
or
os
.
environ
.
get
(
"ProgramFiles"
)
if
not
root
:
return
None
,
None
# We need to call findall() on its own thread because it will
# initialize COM.
all_packages
=
[]
def
_getall
():
all_packages
.
extend
(
_distutils_findvs
.
findall
())
t
=
threading
.
Thread
(
target
=
_getall
)
t
.
start
()
t
.
join
()
for
name
,
version_str
,
path
,
packages
in
all_packages
:
if
'Microsoft.VisualStudio.Component.VC.Tools.x86.x64'
in
packages
:
vc_dir
=
os
.
path
.
join
(
path
,
'VC'
,
'Auxiliary'
,
'Build'
)
if
not
os
.
path
.
isdir
(
vc_dir
):
continue
try
:
version
=
tuple
(
int
(
i
)
for
i
in
version_str
.
split
(
'.'
))
except
(
ValueError
,
TypeError
):
continue
if
version
>
best_version
:
best_version
,
best_dir
=
version
,
vc_dir
try
:
try
:
best_version
=
best_version
[
0
]
path
=
subprocess
.
check_output
([
except
IndexError
:
os
.
path
.
join
(
root
,
"Microsoft Visual Studio"
,
"Installer"
,
"vswhere.exe"
),
best_version
=
None
"-latest"
,
return
best_version
,
best_dir
"-prerelease"
,
"-requires"
,
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64"
,
"-property"
,
"installationPath"
,
],
encoding
=
"mbcs"
,
errors
=
"strict"
).
strip
()
except
(
subprocess
.
CalledProcessError
,
OSError
,
UnicodeDecodeError
):
return
None
,
None
path
=
os
.
path
.
join
(
path
,
"VC"
,
"Auxiliary"
,
"Build"
)
if
os
.
path
.
isdir
(
path
):
return
15
,
path
return
None
,
None
def
_find_vcvarsall
(
plat_spec
):
def
_find_vcvarsall
(
plat_spec
):
best_version
,
best_dir
=
_find_vc2017
()
_
,
best_dir
=
_find_vc2017
()
vcruntime
=
None
vcruntime
=
None
vcruntime_plat
=
'x64'
if
'amd64'
in
plat_spec
else
'x86'
vcruntime_plat
=
'x64'
if
'amd64'
in
plat_spec
else
'x86'
if
best_
version
:
if
best_
dir
:
vcredist
=
os
.
path
.
join
(
best_dir
,
".."
,
".."
,
"redist"
,
"MSVC"
,
"**"
,
vcredist
=
os
.
path
.
join
(
best_dir
,
".."
,
".."
,
"redist"
,
"MSVC"
,
"**"
,
"Microsoft.VC141.CRT"
,
"vcruntime140.dll"
)
"Microsoft.VC141.CRT"
,
"vcruntime140.dll"
)
try
:
try
:
...
@@ -101,13 +101,13 @@ def _find_vcvarsall(plat_spec):
...
@@ -101,13 +101,13 @@ def _find_vcvarsall(plat_spec):
except
(
ImportError
,
OSError
,
LookupError
):
except
(
ImportError
,
OSError
,
LookupError
):
vcruntime
=
None
vcruntime
=
None
if
not
best_
version
:
if
not
best_
dir
:
best_version
,
best_dir
=
_find_vc2015
()
best_version
,
best_dir
=
_find_vc2015
()
if
best_version
:
if
best_version
:
vcruntime
=
os
.
path
.
join
(
best_dir
,
'redist'
,
vcruntime_plat
,
vcruntime
=
os
.
path
.
join
(
best_dir
,
'redist'
,
vcruntime_plat
,
"Microsoft.VC140.CRT"
,
"vcruntime140.dll"
)
"Microsoft.VC140.CRT"
,
"vcruntime140.dll"
)
if
not
best_
version
:
if
not
best_
dir
:
log
.
debug
(
"No suitable Visual C++ version found"
)
log
.
debug
(
"No suitable Visual C++ version found"
)
return
None
,
None
return
None
,
None
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment