Commit 9070689e authored by Thanassis Tsiodras's avatar Thanassis Tsiodras
Browse files

asn2dataModel port to Python3 completed - but aadl2glueC depends on ANTLR for Python3...

parent 6685e91e
......@@ -4,10 +4,6 @@ import sys
import antlr
version = sys.version.split()[0]
if version < '2.2.1':
False = 0
if version < '2.3':
True = not False
### header action >>>
### header action <<<
......
......@@ -4,6 +4,5 @@
"""
aadl2glueC : B mappers -generate code that convert from/to ASN1SCC
"""
from .aadl2glueC import main
__version__ = 1.0
......@@ -91,8 +91,8 @@ import commonPy.aadlAST
import commonPy.cleanupNodes
#import aadlParser
from . import AadlLexer
from . import AadlParser
from B_mappers import AadlLexer
from B_mappers import AadlParser
import antlr
......@@ -224,10 +224,6 @@ types). This used to cover Dumpable C/Ada Types and OG headers.'''
def main():
sys.path.append(os.path.abspath(os.path.dirname(sys.argv[0])))
global underCoverageAnalysis
underCoverageAnalysis = os.environ.get('COVERAGE') == "1"
if underCoverageAnalysis:
sys.path.append(os.path.abspath(os.path.dirname(sys.argv[0]) + os.sep + ".."))
if sys.argv.count("-o") != 0:
idx = sys.argv.index("-o")
try:
......@@ -238,21 +234,12 @@ def main():
del sys.argv[idx]
if not os.path.isdir(commonPy.configMT.outputDir):
panic("'%s' is not a directory!\n" % commonPy.configMT.outputDir) # pragma: no cover
# if "-lexonly" in sys.argv:
# commonPy.configMT.debugParser = True
# sys.argv.remove("-lexonly")
if "-onlySP" in sys.argv: # pragma: no cover
commonPy.configMT.g_bOnlySubprograms = True # pragma: no cover
sys.argv.remove("-onlySP") # pragma: no cover
if "-verbose" in sys.argv:
commonPy.configMT.verbose = True
sys.argv.remove("-verbose")
# if "-ignoreINTEGERranges" in sys.argv:
# commonPy.configMT.args.append("-ignoreINTEGERranges")
# sys.argv.remove("-ignoreINTEGERranges")
# if "-ignoreREALranges" in sys.argv:
# commonPy.configMT.args.append("-ignoreREALranges")
# sys.argv.remove("-ignoreREALranges")
useOSS = "-useOSS" in sys.argv
if useOSS:
sys.argv.remove("-useOSS")
......@@ -368,10 +355,7 @@ def main():
backendFilename = "." + modelingLanguage.lower() + "_B_mapper.py"
inform("Parsing %s...", backendFilename)
try:
if underCoverageAnalysis:
backend = import_module(backendFilename[1:-3])
else: # pragma: no cover
backend = import_module(backendFilename[:-3], 'aadl2glueC') # pragma: no cover
backend = import_module(backendFilename[:-3], 'B_mappers') # pragma: no cover
if backendFilename[:-3] not in loadedBackends:
loadedBackends[backendFilename[:-3]] = 1
if commonPy.configMT.verbose:
......@@ -473,16 +457,10 @@ def main():
def mappers(lang):
if lang.lower() in ["gui_pi", "gui_ri"]:
if underCoverageAnalysis:
return [import_module("python_B_mapper"), import_module("pyside_B_mapper")]
else: # pragma: no cover
return [import_module(".python_B_mapper", "aadl2glueC"),
import_module(".pyside_B_mapper", "aadl2glueC")] # pragma: no cover
return [import_module(".python_B_mapper", "B_mappers"),
import_module(".pyside_B_mapper", "B_mappers")] # pragma: no cover
elif lang.lower() == "vhdl": # pragma: no cover
if underCoverageAnalysis:
return [import_module("vhdl_B_mapper")] # pragma: no cover
else: # pragma: no cover
return [import_module(".vhdl_B_mapper", "aadl2glueC")] # pragma: no cover
return [import_module(".vhdl_B_mapper", "B_mappers")] # pragma: no cover
for si in [x for x in SystemsAndImplementations if x[2] is not None and x[2].lower() in ["gui_ri", "gui_pi", "vhdl"]]:
# We do, start the work
......
......@@ -21,9 +21,9 @@ ___B_mappers_%.py,cover: ../B_mappers/%.py mini_cv.aadl DataView.aadl DataViewVH
mkdir -p output
rm -rf output/*
# coverage run -a ../aadl2glueC.py -o output -verbose mini_cv_vhdl.aadl DataViewVHDL.aadl >/dev/null
COVERAGE=1 LANG=C LC_ALL=C ${COVERAGE} run -a ../aadl2glueC/aadl2glueC.py -o output -verbose mini_cv.aadl DataView.aadl >/dev/null
COVERAGE=1 LANG=C LC_ALL=C ${COVERAGE} run -a ../aadl2glueC/aadl2glueC.py -o output -verbose -useOSS mini_cv.aadl DataView.aadl >/dev/null
COVERAGE=1 LANG=C LC_ALL=C ${COVERAGE} annotate -d . ../aadl2glueC/*.py ../commonPy/*.py
LANG=C LC_ALL=C ${COVERAGE} run -a ../aadl2glueC.py -o output -verbose mini_cv.aadl DataView.aadl >/dev/null
LANG=C LC_ALL=C ${COVERAGE} run -a ../aadl2glueC.py -o output -verbose -useOSS mini_cv.aadl DataView.aadl >/dev/null
LANG=C LC_ALL=C ${COVERAGE} annotate -d . ../aadl2glueC.py ../aadl2glueC/*.py ../commonPy/*.py
check:
@for i in $(PYSRC_B_COVER) ; do echo Checking $$i ... ; ./checkCoverage.pl $$i || { ( echo $$i ; ./review.pl $$i ) | less -RS ; echo $$i had issues... ; exit 1 ; } ; done
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment