Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion buildingspy/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ BuildingsPy Changelog

Version 5.2.1, ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

- In buildingspy/development/regressiontest.py, changed MODELICAPATH on Windows to use ';' instead of ':'
(https://github.com/lbl-srg/BuildingsPy/issues/609)
- Updated pyfunnel to version 2.0.1 to fix plotting issues.
With this change, Python 2 is no longer supported.
(https://github.com/lbl-srg/BuildingsPy/issues/599)
Expand Down
11 changes: 11 additions & 0 deletions buildingspy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,14 @@
version_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'VERSION'))
with open(version_path) as f:
__version__ = f.read().strip()

class BuildingsPy:
"""Class with static methods that are used in various modules.

"""
@staticmethod
def getModelicaPathSeparator():
''' Returns the `MODELICAPATH` separator, which is `;` on Windows and `:` otherwise.
'''
import platform
return ';' if platform.system() == 'Windows' else ':'
6 changes: 2 additions & 4 deletions buildingspy/development/regressiontest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3673,6 +3673,7 @@ def _write_python_runscripts(self, iPro, tra_data_pro):
import inspect
import buildingspy.development.regressiontest as r
import jinja2
from buildingspy import BuildingsPy

directory = self._temDir[iPro]

Expand Down Expand Up @@ -3721,10 +3722,7 @@ def _getStartStopTime(key, dat):
model_modifier = ""

# Get delimiter for MODELICAPATH
if os.name == 'nt':
col = ";"
else:
col = ":"
col = BuildingsPy.getModelicaPathSeparator()

# Get the MODELICAPATH
if 'MODELICAPATH' in os.environ:
Expand Down
6 changes: 2 additions & 4 deletions buildingspy/simulate/OpenModelica.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ def _translate_and_simulate(self, simulate):
# import datetime

from sys import platform
from buildingspy import BuildingsPy

# Delete output files
self.deleteOutputFiles()
Expand All @@ -211,10 +212,7 @@ def _translate_and_simulate(self, simulate):
file_name = "{}.py".format(self.modelName.replace(".", "_"))

# Get delimiter for MODELICAPATH
if os.name == 'nt':
col = ";"
else:
col = ":"
col = BuildingsPy.getModelicaPathSeparator()

# Get the MODELICAPATH
if 'MODELICAPATH' in os.environ:
Expand Down
11 changes: 4 additions & 7 deletions buildingspy/simulate/base_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -548,17 +548,14 @@ def prependToModelicaPath(env, path):
>>> env = os.environ.copy()
>>> env = s.prependToModelicaPath(env, os.getcwd())

'''
'''
from buildingspy import BuildingsPy

if path is None:
return env
else:
if 'MODELICAPATH' in env:
import platform

if platform.system() == 'Windows':
env['MODELICAPATH'] = ";".join([path, env['MODELICAPATH']])
else:
env['MODELICAPATH'] = ":".join([path, env['MODELICAPATH']])
env['MODELICAPATH'] = BuildingsPy.getModelicaPathSeparator().join([path, env['MODELICAPATH']])
else:
env['MODELICAPATH'] = path
return env