summaryrefslogtreecommitdiffstats
path: root/source-builder/sb/windows.py
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2016-03-07 11:56:02 +1100
committerChris Johns <chrisj@rtems.org>2016-03-07 15:02:58 +1100
commit3a972f610213bab8374b5518f6a139ceed95823a (patch)
tree9ee412fc09f09ea4d83a785981180100ac157891 /source-builder/sb/windows.py
parentClean up 4.9 build issues. (diff)
downloadrtems-source-builder-3a972f610213bab8374b5518f6a139ceed95823a.tar.bz2
sb: Update code base to support Python3 and Python2.
Fix Windows support to allow MSYS2 Python to be used. Updates #2619.
Diffstat (limited to 'source-builder/sb/windows.py')
-rw-r--r--source-builder/sb/windows.py36
1 files changed, 18 insertions, 18 deletions
diff --git a/source-builder/sb/windows.py b/source-builder/sb/windows.py
index 96ed1ac..f613da2 100644
--- a/source-builder/sb/windows.py
+++ b/source-builder/sb/windows.py
@@ -30,7 +30,7 @@ import execute
def load():
# Default to the native Windows Python.
uname = 'win32'
- if os.environ.has_key('PROCESSOR_ARCHITECTURE'):
+ if 'PROCESSOR_ARCHITECTURE' in os.environ:
if os.environ['PROCESSOR_ARCHITECTURE'] == 'AMD64':
hosttype = 'x86_64'
machsize = '64'
@@ -41,30 +41,30 @@ def load():
hosttype = 'x86_64'
machsize = '32'
- # See if this is actually Cygwin Python
+ uname = 'mingw32'
+ machine = 'w%s' % (machsize)
+
+ # See if this is actually MSYS2/Cygwin Python
if os.name == 'posix':
- try:
- uname = os.uname()
- hosttype = uname[4]
- uname = uname[0]
- if uname.startswith('CYGWIN'):
- uname = 'cygwin'
- host_triple = hosttype + '-pc-' + uname
- build_triple = hosttype + '-pc-' + uname
- else:
- raise error.general('invalid POSIX python')
- except:
+ _uname = os.uname()
+ if _uname[0].startswith('MINGW'):
pass
- else:
- host_triple = '%s-w%s-mingw32' % (hosttype, machsize)
- build_triple = '%s-w%s-mingw32' % (hosttype, machsize)
+ elif _uname[0].startswith('CYGWIN'):
+ hosttype = _uname[4]
+ uname = 'cygwin'
+ machine = 'pc'
+ else:
+ raise error.general('invalid POSIX python for Windows')
+
+ host_triple = '%s-%s-%s' % (hosttype, machine, uname)
+ build_triple = '%s-%s-%s' % (hosttype, machine, uname)
- if os.environ.has_key('NUMBER_OF_PROCESSORS'):
+ if 'NUMBER_OF_PROCESSORS' in os.environ:
ncpus = os.environ['NUMBER_OF_PROCESSORS']
else:
ncpus = '1'
- if os.environ.has_key('MSYSTEM'):
+ if 'MSYSTEM' in os.environ:
os.environ.pop('NUMBER_OF_PROCESSORS')
version = uname[2]