aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/msvc.py
diff options
context:
space:
mode:
authorJ. Goutin <JGoutin@users.noreply.github.com>2016-07-03 15:17:08 +0200
committerGitHub <noreply@github.com>2016-07-03 15:17:08 +0200
commit7b9290771ec850cf7f5e21e168048b12e1e59cf4 (patch)
treec8d08ddf308fac78bfaf05529f4e46e402d91494 /setuptools/msvc.py
parent2d0a77530153a53e3a9a00ae1f7d0d800d6af604 (diff)
downloadexternal_python_setuptools-7b9290771ec850cf7f5e21e168048b12e1e59cf4.tar.gz
external_python_setuptools-7b9290771ec850cf7f5e21e168048b12e1e59cf4.tar.bz2
external_python_setuptools-7b9290771ec850cf7f5e21e168048b12e1e59cf4.zip
Update msvc.py
Diffstat (limited to 'setuptools/msvc.py')
-rw-r--r--setuptools/msvc.py29
1 files changed, 11 insertions, 18 deletions
diff --git a/setuptools/msvc.py b/setuptools/msvc.py
index b85d66e0..8216e94a 100644
--- a/setuptools/msvc.py
+++ b/setuptools/msvc.py
@@ -1,27 +1,16 @@
"""
This module adds improved support for Microsoft Visual C++ compilers.
"""
-
import os
+import platform
import itertools
import distutils.errors
from setuptools.extern.six.moves import filterfalse
try:
from setuptools.extern.six.moves import winreg
- safe_env = os.environ
except ImportError:
- """
- Mock winreg and environ so the module can be imported
- on this platform.
- """
- class winreg:
- HKEY_USERS = None
- HKEY_CURRENT_USER = None
- HKEY_LOCAL_MACHINE = None
- HKEY_CLASSES_ROOT = None
- safe_env = dict()
-
+ pass
try:
# Distutil file for MSVC++ 9.0 and upper (Python 2.7 to 3.4)
@@ -35,7 +24,7 @@ try:
except ImportError:
pass
-
+
unpatched = dict()
@@ -57,6 +46,10 @@ def patch_for_specialized_compiler():
Microsoft Visual C++ 14.0:
Microsoft Visual C++ Build Tools 2015 (x86, x64, arm)
"""
+ if platform.system() != Windows:
+ # Compilers only availables on Microsoft Windows
+ return
+
if 'distutils' not in globals():
# The module isn't available to be patched
return
@@ -249,7 +242,7 @@ class PlatformInfo:
arch: str
Target architecture.
"""
- current_cpu = safe_env.get('processor_architecture', '').lower()
+ current_cpu = os.environ.get('processor_architecture', '').lower()
def __init__(self, arch):
self.arch = arch.lower().replace('x64', 'amd64')
@@ -462,9 +455,9 @@ class SystemInfo:
"""
# Variables and properties in this class use originals CamelCase variables
# names from Microsoft source files for more easy comparaison.
- WinDir = safe_env.get('WinDir', '')
- ProgramFiles = safe_env.get('ProgramFiles', '')
- ProgramFilesx86 = safe_env.get('ProgramFiles(x86)', ProgramFiles)
+ WinDir = os.environ.get('WinDir', '')
+ ProgramFiles = os.environ.get('ProgramFiles', '')
+ ProgramFilesx86 = os.environ.get('ProgramFiles(x86)', ProgramFiles)
def __init__(self, registry_info, vc_ver=None):
self.ri = registry_info