[rtems-tools commit] rtemstoolkit: Fix unittests on Windows

Chris Johns chrisj at rtems.org
Wed Nov 28 23:20:23 UTC 2018


Module:    rtems-tools
Branch:    master
Commit:    6d30de6dacc17e8d1530410e762629ff91c21faf
Changeset: http://git.rtems.org/rtems-tools/commit/?id=6d30de6dacc17e8d1530410e762629ff91c21faf

Author:    Chris Johns <chrisj at rtems.org>
Date:      Thu Nov 29 08:13:51 2018 +1100

rtemstoolkit: Fix unittests on Windows

- Fix Windows host support so MSYS pythons can be used.
- Fix Windows host support for python3.
- Improve the mailer unittest.

---

 rtemstoolkit/host.py    | 3 ++-
 rtemstoolkit/version.py | 2 ++
 rtemstoolkit/windows.py | 5 ++---
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/rtemstoolkit/host.py b/rtemstoolkit/host.py
index 64032f8..ba24c9d 100644
--- a/rtemstoolkit/host.py
+++ b/rtemstoolkit/host.py
@@ -53,7 +53,7 @@ def _load():
         is_windows = True
     elif os.name == 'posix':
         uname = os.uname()
-        if uname[0].startswith('CYGWIN_NT'):
+        if uname[0].startswith('MINGW64_NT') or uname[0].startswith('CYGWIN_NT'):
             name = 'windows'
         elif uname[0] == 'Darwin':
             name = darwin
@@ -106,6 +106,7 @@ def label(mode = 'all'):
 
 if __name__ == '__main__':
     import pprint
+    print('Python\'s OS name: %s' % (os.name))
     _load()
     print('Name      : %s' % (name))
     if is_windows:
diff --git a/rtemstoolkit/version.py b/rtemstoolkit/version.py
index 82ca95d..f17a676 100644
--- a/rtemstoolkit/version.py
+++ b/rtemstoolkit/version.py
@@ -246,5 +246,7 @@ def revision():
 
 if __name__ == '__main__':
     print('Version: %s' % (str(version())))
+    print('Revision: %s' % (str(revision())))
+    print('String: %s' % (string()))
     if version() == 'undefined':
         raise Exception('version is undefined')
diff --git a/rtemstoolkit/windows.py b/rtemstoolkit/windows.py
index c40f7bd..802263b 100644
--- a/rtemstoolkit/windows.py
+++ b/rtemstoolkit/windows.py
@@ -38,7 +38,7 @@ from rtemstoolkit import error
 from rtemstoolkit import execute
 
 def cpus():
-    if os.environ.has_key('NUMBER_OF_PROCESSORS'):
+    if 'NUMBER_OF_PROCESSORS' in os.environ:
         ncpus = int(os.environ['NUMBER_OF_PROCESSORS'])
     else:
         ncpus = 1
@@ -48,7 +48,7 @@ def overrides():
     # Default to the native Windows Python.
     uname = 'win32'
     system = 'mingw32'
-    if os.environ.has_key('HOSTTYPE'):
+    if 'HOSTTYPE' in os.environ:
         hosttype = os.environ['HOSTTYPE']
     else:
         hosttype = 'i686'
@@ -102,7 +102,6 @@ def overrides():
         '__chmod':        ('exe',     'required', 'chmod'),
         '__chown':        ('exe',     'required', 'chown'),
         '__cp':           ('exe',     'required', 'cp'),
-        '__cvs':          ('exe',     'required', 'cvs'),
         '__cxx':          ('exe',     'required', 'g++'),
         '__flex':         ('exe',     'required', 'flex'),
         '__git':          ('exe',     'required', 'git'),




More information about the vc mailing list