From cd4ac2d9ddff2e33100ead16d9c532266c34a5fd Mon Sep 17 00:00:00 2001 From: Leonhard Markert Date: Sat, 10 Oct 2020 07:33:42 +0000 Subject: [PATCH 1/2] Travis: build with Python 3 Travis CI currently uses Python 2.7 and fails on `master`. The underlying problem is this: ``` File "/home/travis/virtualenv/python2.7.15/lib/python2.7/site-packages/buildingspy/development/validator.py", line 84, in _getInfoRevisionsHTML with open(moFile, mode="r", encoding="utf-8") as f: TypeError: 'encoding' is an invalid keyword argument for this function ``` https://travis-ci.org/github/RWTH-EBC/AixLib/jobs/734457254#L295 In Python 2.7, `open` does not accept an `encoding` parameter. In Python 3.8, it does. https://docs.python.org/2.7/library/functions.html#open https://docs.python.org/3.8/library/functions.html#open Additionally, the call stack clearly shows that `open` is called from the BuildingsPy library. The BuildingsPy library build instruction make it clear that Python 3 is required. https://simulationresearch.lbl.gov/modelica/buildingspy/install.html Python 3.9 is the latest and greatest Python version, but it was released less than a week ago. Python 3.8 was released a year ago and still receives bugfixes (as opposed to older versions which only receive security updates), so that seems like a good compromise. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 7bf9194d31..b666a59201 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: python python: - - "2.7" + - "3.8" cache: pip From 3209a8469426b594a9cdb0f0829eabc137d67042 Mon Sep 17 00:00:00 2001 From: Leonhard Markert Date: Sat, 10 Oct 2020 09:41:12 +0200 Subject: [PATCH 2/2] 2to3 runUnitTests.py --- bin/runUnitTests.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/runUnitTests.py b/bin/runUnitTests.py index 6606c87bad..f7fb413262 100755 --- a/bin/runUnitTests.py +++ b/bin/runUnitTests.py @@ -43,9 +43,9 @@ def _validate_html(path): n_msg = len(errMsg) for i in range(n_msg): if i == 0: - print "The following malformed html syntax has been found:\n%s" % errMsg[i] + print("The following malformed html syntax has been found:\n%s" % errMsg[i]) else: - print errMsg[i] + print(errMsg[i]) if n_msg == 0: return 0 @@ -57,7 +57,7 @@ def _setEnvironmentVariables(var, value): ''' import os import platform - if os.environ.has_key(var): + if var in os.environ: if platform.system() == "Windows": os.environ[var] = value + ";" + os.environ[var] else: