Skip to content

Commit c845538

Browse files
committed
Revert "Updating to OMPython 4.0 (OpenModelica#244)"
This reverts commit 3aa8a07.
1 parent 3aa8a07 commit c845538

12 files changed

Lines changed: 48 additions & 136 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 0 additions & 27 deletions
This file was deleted.

.devcontainer/install.mos

Lines changed: 0 additions & 2 deletions
This file was deleted.

.devcontainer/install.sh

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,12 @@ jobs:
5353
- name: Install Python dependencies
5454
shell: bash
5555
run: |
56-
sed -i '/^juliacall/d' requirements.txt # Remove juliacall to check if it works without
5756
pip install -r requirements.txt
5857
5958
- name: Run library test
6059
shell: bash
61-
env:
62-
MY_SANITY_CHECK_DIRECTORY: sanityCheck
6360
run: |
61+
export MY_SANITY_CHECK_DIRECTORY=sanityCheck
6462
python test.py --branch="${{ matrix.omc-version }}" --noclean --verbose ${{ matrix.msysEnvironment }} configs/sanityCheck.json
6563
6664
- name: Generate HTML results
@@ -75,7 +73,7 @@ jobs:
7573
- name: Verify that overview.html contains simulation and verification
7674
shell: bash
7775
run: |
78-
if ! grep -q '<tr><td><a href="${{ matrix.omc-version }}/MyLibrary_1.0.0/MyLibrary_1.0.0.html">${{ matrix.omc-version }}</a></td><td><a>2</a></td><td><a>2</a></td><td><a>2</a></td><td><a>2</a></td><td><a>2</a></td><td><a>2</a></td><td><a>2</a></td><td><a>2</a></td><td><a>2</a></td></tr></table>' overview.html; then
76+
if ! grep -q "<tr><td><a href=\"${{ matrix.omc-version }}/MyLibrary_1.0.0/MyLibrary_1.0.0.html\">${{ matrix.omc-version }}</a></td><td><a>2</a></td><td><a>2</a></td><td><a>2</a></td><td><a>2</a></td><td><a>2</a></td><td><a>2</a></td><td><a>2</a></td><td><a>2</a></td><td><a>2</a></td></tr></table>" overview.html; then
7977
echo "Failed to find 2 simulating and 2 verifying models in overwiew.html:"
8078
cat overview.html
8179
exit 1

.github/workflows/test_julia.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,8 @@ jobs:
9494
9595
- name: Run library test
9696
shell: bash
97-
env:
98-
MY_SANITY_CHECK_DIRECTORY: sanityCheck
9997
run: |
98+
export MY_SANITY_CHECK_DIRECTORY=sanityCheck
10099
python test.py --branch="${{ matrix.omc-version }}" --basemodelica-mtk-import --no-julia-sys-image --noclean --verbose configs/sanityCheck.json
101100
102101
- name: Generate HTML results

conversionscript.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

4-
from OMPython import OMCSessionZMQ
5-
import pyparsing
4+
from OMPython import OMCSessionZMQ, pyparsing
65
import argparse
76
import glob
87
import json
@@ -33,12 +32,12 @@
3332
os.mkdir("converted-libraries/.openmodelica")
3433
os.mkdir("converted-libraries/.openmodelica/libraries")
3534

36-
def omcAssert(omc: OMCSessionZMQ, cmd: str, extra: str = ""):
35+
def omcAssert(omc, cmd, extra=""):
3736
res = omc.sendExpression(cmd)
3837
if not res:
3938
raise Exception(cmd + "\n" + extra + "\n" + (omc.sendExpression("getErrorString()") or ""))
4039

41-
def omcSendExpression(omc: OMCSessionZMQ, cmd: str, extra: str = ""):
40+
def omcSendExpression(omc, cmd, extra=""):
4241
try:
4342
return omc.sendExpression(cmd)
4443
except pyparsing.ParseException as e:

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ juliacall
44
matplotlib
55
monotonic
66
natsort
7-
OMPython==4.0
7+
ompython==3.6
88
psutil
99
simplejson

shared.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ def getReferenceFileName(conf):
7474
else:
7575
modelName += "."+conf["referenceFileNameExtraName"]
7676
referenceFile = conf["referenceFiles"]+"/"+modelName.replace(".",conf["referenceFileNameDelimiter"])+(conf.get("referenceFinalDot") or ".")+conf["referenceFileExtension"]
77-
if os.path.exists(referenceFile):
78-
referenceFile = os.path.abspath(referenceFile)
79-
8077
if not os.path.exists(referenceFile) and not os.path.isdir(referenceFile):
8178
if conf.get("allReferenceFilesExist"):
8279
raise Exception("Missing reference file %s for config %s" % (referenceFile,conf))
@@ -108,3 +105,5 @@ def isFMPy(fmisimulator):
108105
return 'fmpy' in fmisimulator
109106
else:
110107
return False
108+
109+

single-model.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

4-
import argparse
4+
import sys, argparse
5+
import simplejson as json
56
import shared
67

78
parser = argparse.ArgumentParser(description='OpenModelica model testing report generation tool')
@@ -20,7 +21,8 @@
2021

2122
libs = {}
2223

23-
import sqlite3, datetime
24+
import cgi, sqlite3, time, datetime
25+
from omcommon import friendlyStr, multiple_replace
2426

2527
conn = sqlite3.connect('sqlite3.db')
2628
cursor = conn.cursor()

test.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
if (sys.version_info < (3, 0)):
99
raise Exception("Python2 is no longer supported")
1010

11-
import html, shutil, os, re, glob, time, argparse, sqlite3, datetime, math
11+
import html, shutil, os, re, glob, time, argparse, sqlite3, datetime, math, platform
1212
from joblib import Parallel, delayed
1313
import simplejson as json
1414
import psutil, subprocess, threading, hashlib
15+
from subprocess import call
1516
from monotonic import monotonic
1617
from omcommon import friendlyStr, multiple_replace
1718
from natsort import natsorted
@@ -259,19 +260,14 @@ def target():
259260
print("Error: Expected at least one configuration file to start the library test")
260261
sys.exit(1)
261262

262-
from OMPython import OMCSessionZMQ, OMCProcessDocker
263+
from OMPython import OMCSession, OMCSessionZMQ
263264

264265
# Try to make the processes a bit nicer...
265266
os.environ["GC_MARKERS"]="1"
266267

267268
print("Start OMC version")
268269

269-
if docker:
270-
omc = OMCProcessDocker(docker=docker, dockerExtraArgs=dockerExtraArgs)
271-
omhome=omc.sendExpression('getInstallationDirectoryPath()')
272-
omc_version=omc.sendExpression('getVersion()')
273-
ompython_omc_version=omc_version
274-
elif ompython_omhome != "":
270+
if ompython_omhome != "":
275271
# Use a different OMC for running OMPython than for running the tests
276272
omhome = os.environ["OPENMODELICAHOME"]
277273
omc_version = check_output_log(omc_cmd + ["--version"], stderr=subprocess.STDOUT).decode("ascii").strip()
@@ -280,11 +276,10 @@ def target():
280276
ompython_omc_version=omc.sendExpression('getVersion()')
281277
os.environ["OPENMODELICAHOME"] = omhome
282278
else:
283-
omc = OMCSessionZMQ()
279+
omc = OMCSessionZMQ(docker=docker, dockerExtraArgs=dockerExtraArgs)
284280
omhome=omc.sendExpression('getInstallationDirectoryPath()')
285281
omc_version=omc.sendExpression('getVersion()')
286282
ompython_omc_version=omc_version
287-
288283
ompython_omc_version=ompython_omc_version.replace("OMCompiler","").strip()
289284

290285
def timeSeconds(f):

0 commit comments

Comments
 (0)