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
0dc21cb9
Commit
0dc21cb9
authored
Feb 23, 2016
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract find_visual_c method into RegistryInfo
parent
6d11de6d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
23 deletions
+27
-23
setuptools/msvc9_support.py
setuptools/msvc9_support.py
+27
-23
No files found.
setuptools/msvc9_support.py
View file @
0dc21cb9
...
@@ -172,6 +172,26 @@ class RegistryInfo:
...
@@ -172,6 +172,26 @@ class RegistryInfo:
default = os.path.join(self.platform_info.program_files_x86, name)
default = os.path.join(self.platform_info.program_files_x86, name)
return self.lookup(self.vs, '
%
0.1
f' % self.version) or default
return self.lookup(self.vs, '
%
0.1
f' % self.version) or default
def find_visual_c(self):
"""
Find Microsoft Visual C++ directory
"""
# If fail, use default path
default = r'
Microsoft
Visual
Studio
%
0.1
f
\
VC
' % self.version
guess_vc = os.path.join(self.platform_info.program_files_x86, default)
# Try to get "VC++ for Python" version from registry
install_base = self.lookup(self.vc_for_python, '
installdir
')
default_vc = os.path.join(install_base, '
VC
') if install_base else guess_vc
result = self.lookup(self.vc, '
%
0.1
f' % self.version) or default_vc
if not os.path.isdir(result):
msg = '
vcvarsall
.
bat
and
Visual
C
++
directory
not
found
'
raise distutils.errors.DistutilsPlatformError(msg)
return result
def lookup(self, base, key):
def lookup(self, base, key):
try:
try:
return distutils.msvc9compiler.Reg.get_value(base, key)
return distutils.msvc9compiler.Reg.get_value(base, key)
...
@@ -188,22 +208,6 @@ def _query_vcvarsall(version, arch):
...
@@ -188,22 +208,6 @@ def _query_vcvarsall(version, arch):
reg = RegistryInfo(pi, version)
reg = RegistryInfo(pi, version)
reg_value = reg.lookup
reg_value = reg.lookup
# Find Microsoft Visual C++ directory
# If fail, use default path
default = r'
Microsoft
Visual
Studio
%
0.1
f
\
VC
' % version
guess_vc = os.path.join(pi.program_files_x86, default)
# Try to get "VC++ for Python" version from registry
install_base = reg_value(reg.vc_for_python, '
installdir
')
default_vc = os.path.join(install_base, '
VC
') if install_base else guess_vc
VcInstallDir = reg_value(reg.vc, '
%
0.1
f' % version) or default_vc
if not os.path.isdir(VcInstallDir):
msg = '
vcvarsall
.
bat
and
Visual
C
++
directory
not
found
'
raise distutils.errors.DistutilsPlatformError(msg)
# Find Microsoft Windows SDK directory
# Find Microsoft Windows SDK directory
WindowsSdkDir = ''
WindowsSdkDir = ''
if version == 9.0:
if version == 9.0:
...
@@ -232,7 +236,7 @@ def _query_vcvarsall(version, arch):
...
@@ -232,7 +236,7 @@ def _query_vcvarsall(version, arch):
WindowsSdkDir = d
WindowsSdkDir = d
if not WindowsSdkDir:
if not WindowsSdkDir:
# If fail, use Platform SDK
# If fail, use Platform SDK
WindowsSdkDir = os.path.join(
VcInstallDir
, '
PlatformSDK
')
WindowsSdkDir = os.path.join(
reg.find_visual_c()
, '
PlatformSDK
')
# Find Microsoft .NET Framework 32bit directory
# Find Microsoft .NET Framework 32bit directory
guess_fw = os.path.join(pi.win_dir, r'
Microsoft
.
NET
\
Framework
')
guess_fw = os.path.join(pi.win_dir, r'
Microsoft
.
NET
\
Framework
')
...
@@ -262,21 +266,21 @@ def _query_vcvarsall(version, arch):
...
@@ -262,21 +266,21 @@ def _query_vcvarsall(version, arch):
]
]
# Set Microsoft Visual C++ Includes
# Set Microsoft Visual C++ Includes
VCIncludes = [os.path.join(
VcInstallDir
, '
Include
')]
VCIncludes = [os.path.join(
reg.find_visual_c()
, '
Include
')]
# Set Microsoft Visual C++ & Microsoft Foundation Class Libraries
# Set Microsoft Visual C++ & Microsoft Foundation Class Libraries
VCLibraries = [
VCLibraries = [
os.path.join(
VcInstallDir
, '
Lib
' + pi.lib_extra),
os.path.join(
reg.find_visual_c()
, '
Lib
' + pi.lib_extra),
os.path.join(
VcInstallDir
, r'
ATLMFC
\
LIB
' + pi.lib_extra),
os.path.join(
reg.find_visual_c()
, r'
ATLMFC
\
LIB
' + pi.lib_extra),
]
]
# Set Microsoft Visual C++ Tools
# Set Microsoft Visual C++ Tools
VCTools = [
VCTools = [
os.path.join(
VcInstallDir
, '
VCPackages
'),
os.path.join(
reg.find_visual_c()
, '
VCPackages
'),
os.path.join(
VcInstallDir
, '
Bin
' + pi.tools_extra),
os.path.join(
reg.find_visual_c()
, '
Bin
' + pi.tools_extra),
]
]
if pi.tools_extra:
if pi.tools_extra:
VCTools.append(os.path.join(
VcInstallDir
, '
Bin
'))
VCTools.append(os.path.join(
reg.find_visual_c()
, '
Bin
'))
# Set Microsoft Windows SDK Include
# Set Microsoft Windows SDK Include
OSLibraries = [os.path.join(WindowsSdkDir, '
Lib
' + pi.sdk_extra)]
OSLibraries = [os.path.join(WindowsSdkDir, '
Lib
' + pi.sdk_extra)]
...
...
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