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
3a122756
Commit
3a122756
authored
Feb 23, 2016
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract PlatformInfo class for capturing some of the platform info calculations.
parent
ad0bd62b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
35 deletions
+52
-35
setuptools/msvc9_support.py
setuptools/msvc9_support.py
+52
-35
No files found.
setuptools/msvc9_support.py
View file @
3a122756
...
...
@@ -86,16 +86,53 @@ def query_vcvarsall(version, arch='x86', *args, **kwargs):
raise
distutils
.
errors
.
DistutilsPlatformError
(
message
)
class
PlatformInfo
:
current_cpu
=
os
.
environ
[
'processor_architecture'
].
lower
()
def
__init__
(
self
,
arch
):
self
.
arch
=
arch
@
property
def
target_cpu
(
self
):
return
self
.
arch
[
self
.
arch
.
find
(
'_'
)
+
1
:]
def
target_is_x86
(
self
):
return
self
.
target_cpu
==
'x86'
def
current_is_x86
(
self
):
return
self
.
current_cpu
!=
'x86'
@
property
def
lib_extra
(
self
):
return
(
r'\amd64'
if
self
.
target_cpu
==
'amd64'
else
r'\
i
a64'
if
self
.
target_cpu
==
'ia64'
else
''
)
@
property
def
sdk_extra
(
self
):
return
(
r'\x64'
if
self
.
target_cpu
==
'amd64'
else
r'\
i
a64'
if
self
.
target_cpu
==
'ia64'
else
''
)
@
property
def
tools_extra
(
self
):
path
=
self
.
lib_extra
if
self
.
target_cpu
!=
self
.
current_cpu
:
path
=
path
.
replace
(
'
\
\
'
,
'
\
\
x86_'
)
return
path
def
_query_vcvarsall
(
version
,
arch
):
"""
Return environment variables for specified Microsoft Visual C++ version
and platform.
"""
# Find current and target architecture
CurrentCpu
=
os
.
environ
[
'processor_architecture'
].
lower
()
TargetCpu
=
arch
[
arch
.
find
(
'_'
)
+
1
:]
Tar_not_x86
=
TargetCpu
!=
'x86'
Cur_not_x86
=
CurrentCpu
!=
'x86'
pi
=
PlatformInfo
(
arch
)
# Find "Windows" and "Program Files" system directories
WinDir
=
os
.
environ
[
'WinDir'
]
...
...
@@ -104,33 +141,13 @@ def _query_vcvarsall(version, arch):
# Set registry base paths
reg_value
=
distutils
.
msvc9compiler
.
Reg
.
get_value
node
=
r'\
Wow
6432Node'
if
Cur_not_x86
else
''
node
=
r'\
Wow
6432Node'
if
not
pi
.
current_is_x86
()
else
''
VsReg
=
r'Software%s\
Mic
rosoft\
Visu
alStudio\
SxS
\VS7'
%
node
VcReg
=
r'Software%s\
Mic
rosoft\
Visu
alStudio\
SxS
\VC7'
%
node
VcForPythonReg
=
r'Software%s\
Mic
rosoft\
De
vDiv\
VCFo
rPython\
%
0.1f'
%
\
(
node
,
version
)
WindowsSdkReg
=
r'Software%s\
Mic
rosoft\
Mic
rosoft SDKs\
Wi
ndows'
%
node
# Set Platform subdirectories
if
TargetCpu
==
'amd64'
:
plt_subd_lib
=
r'\amd64'
plt_subd_sdk
=
r'\x64'
if
CurrentCpu
==
'amd64'
:
plt_subd_tools
=
r'\amd64'
else
:
plt_subd_tools
=
r'\x86_amd64'
elif
TargetCpu
==
'ia64'
:
plt_subd_lib
=
r'\
i
a64'
plt_subd_sdk
=
r'\
i
a64'
if
CurrentCpu
==
'ia64'
:
plt_subd_tools
=
r'\
i
a64'
else
:
plt_subd_tools
=
r'\x86_ia64'
else
:
plt_subd_lib
=
''
plt_subd_sdk
=
''
plt_subd_tools
=
''
# Find Microsoft Visual Studio directory
try
:
# Try to get it from registry
...
...
@@ -232,20 +249,20 @@ def _query_vcvarsall(version, arch):
# Set Microsoft Visual C++ & Microsoft Foundation Class Libraries
VCLibraries = [
os.path.join(VcInstallDir, '
Lib
' + p
lt_subd_lib
),
os.path.join(VcInstallDir, r'
ATLMFC
\
LIB
' + p
lt_subd_lib
),
os.path.join(VcInstallDir, '
Lib
' + p
i.lib_extra
),
os.path.join(VcInstallDir, r'
ATLMFC
\
LIB
' + p
i.lib_extra
),
]
# Set Microsoft Visual C++ Tools
VCTools = [
os.path.join(VcInstallDir, '
VCPackages
'),
os.path.join(VcInstallDir, '
Bin
' + p
lt_subd_tools
),
os.path.join(VcInstallDir, '
Bin
' + p
i.tools_extra
),
]
if p
lt_subd_tools
:
if p
i.tools_extra
:
VCTools.append(os.path.join(VcInstallDir, '
Bin
'))
# Set Microsoft Windows SDK Include
OSLibraries = [os.path.join(WindowsSdkDir, '
Lib
' + p
lt_subd_sdk
)]
OSLibraries = [os.path.join(WindowsSdkDir, '
Lib
' + p
i.sdk_extra
)]
# Set Microsoft Windows SDK Libraries
OSIncludes = [
...
...
@@ -255,10 +272,10 @@ def _query_vcvarsall(version, arch):
# Set Microsoft Windows SDK Tools
SdkTools = [os.path.join(WindowsSdkDir, '
Bin
')]
if
Tar_not_x86
:
SdkTools.append(os.path.join(WindowsSdkDir, '
Bin
' + p
lt_subd_sdk
))
if
not pi.target_is_x86()
:
SdkTools.append(os.path.join(WindowsSdkDir, '
Bin
' + p
i.sdk_extra
))
if version == 10.0:
path = r'
Bin
\
NETFX
4.0
Tools
' + p
lt_subd_sdk
path = r'
Bin
\
NETFX
4.0
Tools
' + p
i.sdk_extra
SdkTools.append(os.path.join(WindowsSdkDir, path))
# Set Microsoft Windows SDK Setup
...
...
@@ -266,7 +283,7 @@ def _query_vcvarsall(version, arch):
# Set Microsoft .NET Framework Tools
FxTools = [os.path.join(FrameworkDir32, ver) for ver in FrameworkVer]
if
Tar_not_x86 and Cur_not_x86
:
if
not pi.target_is_x86() and not pi.current_is_x86()
:
for ver in FrameworkVer:
FxTools.append(os.path.join(FrameworkDir64, ver))
...
...
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