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
b83cf1a6
Commit
b83cf1a6
authored
May 22, 2016
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use underscore to separate words (or acronyms) for clarity (vc_ver).
parent
81cbfafd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
60 deletions
+60
-60
setuptools/msvc9_support.py
setuptools/msvc9_support.py
+60
-60
No files found.
setuptools/msvc9_support.py
View file @
b83cf1a6
...
...
@@ -457,28 +457,28 @@ class SystemInfo:
----------
registry_info: RegistryInfo
"RegistryInfo" instance.
vcver: float
vc
_
ver: float
Required Microsoft Visual C++ version.
"""
WinDir = safe_env['
WinDir
']
ProgramFiles = safe_env['
ProgramFiles
']
ProgramFilesx86 = os.environ.get('
ProgramFiles
(
x86
)
', ProgramFiles)
def __init__(self, registry_info, vcver=None):
def __init__(self, registry_info, vc
_
ver=None):
self.ri = registry_info
self.pi = self.ri.pi
if vcver:
self.vc
ver = vc
ver
if vc
_
ver:
self.vc
_ver = vc_
ver
else:
try:
self.vc
ver = self.find_availables_vcver
()[-1]
self.vc
_ver = self.find_available_vc_vers
()[-1]
except IndexError:
err = '
No
Microsoft
Visual
C
++
version
found
'
raise distutils.errors.DistutilsPlatformError(err)
def find_available
s_vcver
(self):
def find_available
_vc_vers
(self):
"""
Find all available
s
Microsoft Visual C++ versions.
Find all available Microsoft Visual C++ versions.
"""
vckeys = (self.ri.vc, self.ri.vc_for_python)
vsvers = []
...
...
@@ -511,11 +511,11 @@ class SystemInfo:
Microsoft Visual Studio directory.
"""
# Default path
name = '
Microsoft
Visual
Studio
%
0.1
f' % self.vcver
name = '
Microsoft
Visual
Studio
%
0.1
f' % self.vc
_
ver
default = os.path.join(self.ProgramFilesx86, name)
# Try to get path from registry, if fail use default path
return self.ri.lookup(self.ri.vs, '
%
0.1
f' % self.vcver) or default
return self.ri.lookup(self.ri.vs, '
%
0.1
f' % self.vc
_
ver) or default
@property
def VCInstallDir(self):
...
...
@@ -523,16 +523,16 @@ class SystemInfo:
Microsoft Visual C++ directory.
"""
# Default path
default = r'
Microsoft
Visual
Studio
%
0.1
f
\
VC
' % self.vcver
default = r'
Microsoft
Visual
Studio
%
0.1
f
\
VC
' % self.vc
_
ver
guess_vc = os.path.join(self.ProgramFilesx86, default)
# Try to get "VC++ for Python" path from registry as default path
path = os.path.join(self.ri.vc_for_python, '
%
0.1
f' % self.vcver)
path = os.path.join(self.ri.vc_for_python, '
%
0.1
f' % self.vc
_
ver)
python_vc = self.ri.lookup(path, '
installdir
')
default_vc = os.path.join(python_vc, '
VC
') if python_vc else guess_vc
# Try to get path from registry, if fail use default path
result = self.ri.lookup(self.ri.vc, '
%
0.1
f' % self.vcver) or default_vc
result = self.ri.lookup(self.ri.vc, '
%
0.1
f' % self.vc
_
ver) or default_vc
if not os.path.isdir(result):
msg = '
Microsoft
Visual
C
++
directory
not
found
'
...
...
@@ -546,15 +546,15 @@ class SystemInfo:
Microsoft Windows SDK versions.
"""
# Set Windows SDK versions for specified MSVC++ version
if self.vcver <= 9.0:
if self.vc
_
ver <= 9.0:
return ('
7.0
', '
6.1
', '
6.0
a
')
elif self.vcver == 10.0:
elif self.vc
_
ver == 10.0:
return ('
7.1
', '
7.0
a
')
elif self.vcver == 11.0:
elif self.vc
_
ver == 11.0:
return ('
8.0
', '
8.0
a
')
elif self.vcver == 12.0:
elif self.vc
_
ver == 12.0:
return ('
8.1
', '
8.1
a
')
elif self.vcver >= 14.0:
elif self.vc
_
ver >= 14.0:
return ('
10.0
', '
8.1
')
@property
...
...
@@ -571,7 +571,7 @@ class SystemInfo:
break
if not sdkdir or not os.path.isdir(sdkdir):
# Try to get "VC++ for Python" version from registry
path = os.path.join(self.ri.vc_for_python, '
%
0.1
f' % self.vcver)
path = os.path.join(self.ri.vc_for_python, '
%
0.1
f' % self.vc
_
ver)
install_base = self.ri.lookup(path, '
installdir
')
if install_base:
sdkdir = os.path.join(install_base, '
WinSDK
')
...
...
@@ -601,18 +601,18 @@ class SystemInfo:
Microsoft Windows SDK executable directory.
"""
# Find WinSDK NetFx Tools registry dir name
if self.vcver <= 11.0:
if self.vc
_
ver <= 11.0:
netfxver = 35
arch = ''
else:
netfxver = 40
hidex86 = True if self.vcver <= 12.0 else False
hidex86 = True if self.vc
_
ver <= 12.0 else False
arch = self.pi.current_dir(x64=True, hidex86=hidex86)
fx = '
WinSDK
-
NetFx
%
dTools
%
s
' % (netfxver, arch.replace('
\\
', '
-
'))
# liste all possibles registry paths
regpaths = []
if self.vcver >= 14.0:
if self.vc
_
ver >= 14.0:
for ver in self.NetFxSdkVersion:
regpaths += [os.path.join(self.ri.netfx_sdk, ver, fx)]
...
...
@@ -631,7 +631,7 @@ class SystemInfo:
"""
Microsoft Visual F# directory.
"""
path = r'
%
0.1
f
\
Setup
\
F
#' % self.vcver
path = r'
%
0.1
f
\
Setup
\
F
#' % self.vc
_
ver
path
=
os
.
path
.
join
(
self
.
ri
.
visualstudio
,
path
)
return
self
.
ri
.
lookup
(
path
,
'productdir'
)
or
''
...
...
@@ -641,7 +641,7 @@ class SystemInfo:
Microsoft Universal CRT SDK directory.
"""
# Set Kit Roots versions for specified MSVC++ version
if
self
.
vcver
>=
14.0
:
if
self
.
vc
_
ver
>=
14.0
:
vers
=
(
'10'
,
'81'
)
else
:
vers
=
()
...
...
@@ -660,7 +660,7 @@ class SystemInfo:
Microsoft .NET Framework SDK versions.
"""
# Set FxSdk versions for specified MSVC++ version
if
self
.
vcver
>=
14.0
:
if
self
.
vc
_
ver
>=
14.0
:
return
(
'4.6.1'
,
'4.6'
)
else
:
return
()
...
...
@@ -726,14 +726,14 @@ class SystemInfo:
ver
=
self
.
ri
.
lookup
(
self
.
ri
.
vc
,
'frameworkver%d'
%
bits
)
or
''
# Set .NET versions for specified MSVC++ version
if
self
.
vcver
>=
12.0
:
if
self
.
vc
_
ver
>=
12.0
:
frameworkver
=
(
ver
,
'v4.0'
)
elif
self
.
vcver
>=
10.0
:
elif
self
.
vc
_
ver
>=
10.0
:
frameworkver
=
(
'v4.0.30319'
if
ver
.
lower
()[:
2
]
!=
'v4'
else
ver
,
'v3.5'
)
elif
self
.
vcver
==
9.0
:
elif
self
.
vc
_
ver
==
9.0
:
frameworkver
=
(
'v3.5'
,
'v2.0.50727'
)
if
self
.
vcver
==
8.0
:
if
self
.
vc
_
ver
==
8.0
:
frameworkver
=
(
'v3.0'
,
'v2.0.50727'
)
return
frameworkver
...
...
@@ -752,24 +752,24 @@ class EnvironmentInfo:
----------
arch: str
Target architecture.
vcver: float
vc
_
ver: float
Required Microsoft Visual C++ version. If not set, autodetect the last
version.
vc
vermin
: float
vc
_min_ver
: float
Minimum Microsoft Visual C++ version.
"""
def
__init__
(
self
,
arch
,
vc
ver
=
None
,
vcvermin
=
None
):
def
__init__
(
self
,
arch
,
vc
_ver
=
None
,
vc_min_ver
=
None
):
self
.
pi
=
PlatformInfo
(
arch
)
self
.
ri
=
RegistryInfo
(
self
.
pi
)
self
.
si
=
SystemInfo
(
self
.
ri
,
vcver
)
self
.
si
=
SystemInfo
(
self
.
ri
,
vc
_
ver
)
if
vc
vermin
:
if
self
.
vc
ver
<
vcvermin
:
if
vc
_min_ver
:
if
self
.
vc
_ver
<
vc_min_ver
:
err
=
'No suitable Microsoft Visual C++ version found'
raise
distutils
.
errors
.
DistutilsPlatformError
(
err
)
@
property
def
vcver
(
self
):
def
vc
_
ver
(
self
):
"""
Microsoft Visual C++ version.
"""
...
...
@@ -782,7 +782,7 @@ class EnvironmentInfo:
"""
paths
=
[
r'Common7\
IDE
', r'
Common7
\
Tools
']
if self.vcver >= 14.0:
if self.vc
_
ver >= 14.0:
arch_subdir = self.pi.current_dir(hidex86=True, x64=True)
paths += [r'
Common7
\
IDE
\
CommonExtensions
\
Microsoft
\
TestWindow
']
paths += [r'
Team
Tools
\
Performance
Tools
']
...
...
@@ -806,7 +806,7 @@ class EnvironmentInfo:
arch_subdir = self.pi.target_dir(hidex86=True)
paths = ['
Lib
%
s
' % arch_subdir, r'
ATLMFC
\
Lib
%
s
' % arch_subdir]
if self.vcver >= 14.0:
if self.vc
_
ver >= 14.0:
paths += [r'
Lib
\
store
%
s
' % arch_subdir]
return [os.path.join(self.si.VCInstallDir, path) for path in paths]
...
...
@@ -816,7 +816,7 @@ class EnvironmentInfo:
"""
Microsoft Visual C++ store references Libraries
"""
if self.vcver < 14.0:
if self.vc
_
ver < 14.0:
return []
return [os.path.join(self.si.VCInstallDir, r'
Lib
\
store
\
references
')]
...
...
@@ -828,12 +828,12 @@ class EnvironmentInfo:
si = self.si
tools = [os.path.join(si.VCInstallDir, '
VCPackages
')]
forcex86 = True if self.vcver <= 10.0 else False
forcex86 = True if self.vc
_
ver <= 10.0 else False
arch_subdir = self.pi.cross_dir(forcex86)
if arch_subdir:
tools += [os.path.join(si.VCInstallDir, '
Bin
%
s
' % arch_subdir)]
if self.vcver >= 14.0:
if self.vc
_
ver >= 14.0:
path = '
Bin
%
s
' % self.pi.current_dir(hidex86=True)
tools += [os.path.join(si.VCInstallDir, path)]
...
...
@@ -847,7 +847,7 @@ class EnvironmentInfo:
"""
Microsoft Windows SDK Libraries
"""
if self.vcver <= 10.0:
if self.vc
_
ver <= 10.0:
arch_subdir = self.pi.target_dir(hidex86=True, x64=True)
return [os.path.join(self.si.WindowsSdkDir, '
Lib
%
s
' % arch_subdir)]
...
...
@@ -864,11 +864,11 @@ class EnvironmentInfo:
"""
include = os.path.join(self.si.WindowsSdkDir, '
include
')
if self.vcver <= 10.0:
if self.vc
_
ver <= 10.0:
return [include, os.path.join(include, '
gl
')]
else:
if self.vcver >= 14.0:
if self.vc
_
ver >= 14.0:
sdkver = self._get_content_dirname(include)
else:
sdkver = ''
...
...
@@ -884,13 +884,13 @@ class EnvironmentInfo:
ref = os.path.join(self.si.WindowsSdkDir, '
References
')
libpath = []
if self.vcver <= 9.0:
if self.vc
_
ver <= 9.0:
libpath += self.OSLibraries
if self.vcver >= 11.0:
if self.vc
_
ver >= 11.0:
libpath += [os.path.join(ref, r'
CommonConfiguration
\
Neutral
')]
if self.vcver >= 14.0:
if self.vc
_
ver >= 14.0:
libpath += [ref,
os.path.join(self.si.WindowsSdkDir, '
UnionMetadata
'),
os.path.join(ref, r'
Windows
.
Foundation
.
'
...
...
@@ -902,7 +902,7 @@ class EnvironmentInfo:
os.path.join(self.si.WindowsSdkDir, r'
ExtensionSDKs
'
r'
\
Microsoft
.
VCLibs
\
%
0.1
f
\
References
'
r'
\
CommonConfiguration
\
neutral
' %
self.vcver)]
self.vc
_
ver)]
return libpath
@property
...
...
@@ -911,14 +911,14 @@ class EnvironmentInfo:
Microsoft Windows SDK Tools
"""
tools = [os.path.join(self.si.WindowsSdkDir,
'
Bin
' if self.vcver <= 11.0 else r'
Bin
\
x86
')]
'
Bin
' if self.vc
_
ver <= 11.0 else r'
Bin
\
x86
')]
if not self.pi.current_is_x86():
arch_subdir = self.pi.current_dir(x64=True)
path = '
Bin
%
s
' % arch_subdir
tools += [os.path.join(self.si.WindowsSdkDir, path)]
if self.vc
ver == 10.0 or self.vc
ver == 11.0:
if self.vc
_ver == 10.0 or self.vc_
ver == 11.0:
if self.pi.target_is_x86():
arch_subdir = ''
else:
...
...
@@ -936,7 +936,7 @@ class EnvironmentInfo:
"""
Microsoft Windows SDK Setup
"""
if self.vcver > 9.0:
if self.vc
_
ver > 9.0:
return []
return [os.path.join(self.si.WindowsSdkDir, '
Setup
')]
...
...
@@ -949,7 +949,7 @@ class EnvironmentInfo:
pi = self.pi
si = self.si
if self.vcver <= 10.0:
if self.vc
_
ver <= 10.0:
include32 = True
include64 = not pi.target_is_x86() and not pi.current_is_x86()
else:
...
...
@@ -970,7 +970,7 @@ class EnvironmentInfo:
"""
Microsoft .Net Framework SDK Libraries
"""
if self.vcver < 14.0 or not self.si.NetFxSdkDir:
if self.vc
_
ver < 14.0 or not self.si.NetFxSdkDir:
return []
arch_subdir = self.pi.target_dir(x64=True)
...
...
@@ -981,7 +981,7 @@ class EnvironmentInfo:
"""
Microsoft .Net Framework SDK Includes
"""
if self.vcver < 14.0 or not self.si.NetFxSdkDir:
if self.vc
_
ver < 14.0 or not self.si.NetFxSdkDir:
return []
return [os.path.join(self.si.NetFxSdkDir, r'
include
\
um
')]
...
...
@@ -998,11 +998,11 @@ class EnvironmentInfo:
"""
Microsoft Build Engine
"""
if self.vcver < 12.0:
if self.vc
_
ver < 12.0:
return []
arch_subdir = self.pi.current_dir(hidex86=True)
path = r'
MSBuild
\
%
0.1
f
\
bin
%
s
' % (self.vcver, arch_subdir)
path = r'
MSBuild
\
%
0.1
f
\
bin
%
s
' % (self.vc
_
ver, arch_subdir)
return [os.path.join(self.si.ProgramFilesx86, path)]
@property
...
...
@@ -1010,7 +1010,7 @@ class EnvironmentInfo:
"""
Microsoft HTML Help Workshop
"""
if self.vcver < 11.0:
if self.vc
_
ver < 11.0:
return []
return [os.path.join(self.si.ProgramFilesx86, '
HTML
Help
Workshop
')]
...
...
@@ -1020,7 +1020,7 @@ class EnvironmentInfo:
"""
Microsoft Universal CRT Libraries
"""
if self.vcver < 14.0:
if self.vc
_
ver < 14.0:
return []
arch_subdir = self.pi.target_dir(x64=True)
...
...
@@ -1033,7 +1033,7 @@ class EnvironmentInfo:
"""
Microsoft Universal CRT Include
"""
if self.vcver < 14.0:
if self.vc
_
ver < 14.0:
return []
include = os.path.join(self.si.UniversalCRTSdkDir, '
include
')
...
...
@@ -1045,7 +1045,7 @@ class EnvironmentInfo:
"""
Microsoft Visual F#
"""
if self.vc
ver < 11.0 and self.vc
ver > 12.0:
if self.vc
_ver < 11.0 and self.vc_
ver > 12.0:
return []
return self.si.FSharpInstallDir
...
...
@@ -1057,7 +1057,7 @@ class EnvironmentInfo:
"""
arch_subdir = self.pi.target_dir(x64=True)
vcruntime = '
redist
%
s
\\
Microsoft
.
VC
%
d0
.
CRT
\\
vcruntime
%
d0
.
dll
'
vcruntime = vcruntime % (arch_subdir, self.vc
ver, self.vc
ver)
vcruntime = vcruntime % (arch_subdir, self.vc
_ver, self.vc_
ver)
return os.path.join(self.si.VCInstallDir, vcruntime)
def return_env(self, exists=True):
...
...
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