Commit 41b91434 authored by Thanassis Tsiodras's avatar Thanassis Tsiodras

The distutils version is back to 100% coverage with flake8 and pylint reporting no errors.

parent 574bef65
......@@ -38,11 +38,11 @@ parameters, which have C callable interfaces. The necessary
stubs (to allow calling from the VM side) are also generated.
'''
from commonPy.utility import panicWithCallStack
from commonPy.asnAST import AsnInt, AsnReal, AsnBool, AsnEnumerated, isSequenceVariable, sourceSequenceLimit
from commonPy.aadlAST import AadlPort, AadlParameter
from ..commonPy.utility import panicWithCallStack
from ..commonPy.asnAST import AsnInt, AsnReal, AsnBool, AsnEnumerated, isSequenceVariable, sourceSequenceLimit
from ..commonPy.aadlAST import AadlPort, AadlParameter
from .recursiveMapper import RecursiveMapper
from ..commonPy.recursiveMapper import RecursiveMapper
from .synchronousTool import SynchronousToolGlueGenerator
isAsynchronous = False
......
......@@ -28,10 +28,10 @@ It is used to model asynchronous processes (SDL)...
'''
from commonPy.utility import panic
from commonPy.asnAST import isSequenceVariable, sourceSequenceLimit, AsnBasicNode, AsnEnumerated
from ..commonPy.utility import panic
from ..commonPy.asnAST import isSequenceVariable, sourceSequenceLimit, AsnBasicNode, AsnEnumerated
from .recursiveMapper import RecursiveMapper
from ..commonPy.recursiveMapper import RecursiveMapper
from .asynchronousTool import ASynchronousToolGlueGenerator
from . import c_B_mapper
......
......@@ -41,12 +41,12 @@ import re
import os
import math
from commonPy.utility import panic, panicWithCallStack
from commonPy.asnAST import AsnBasicNode, AsnSequence, AsnSet, AsnChoice, AsnSequenceOf, AsnSetOf, AsnEnumerated, AsnMetaMember, isSequenceVariable, sourceSequenceLimit
from commonPy.aadlAST import InParam, OutParam, InOutParam, AadlPort, AadlParameter
import commonPy.asnParser
from ..commonPy.utility import panic, panicWithCallStack
from ..commonPy.asnAST import AsnBasicNode, AsnSequence, AsnSet, AsnChoice, AsnSequenceOf, AsnSetOf, AsnEnumerated, AsnMetaMember, isSequenceVariable, sourceSequenceLimit
from ..commonPy.aadlAST import InParam, OutParam, InOutParam, AadlPort, AadlParameter
from ..commonPy import asnParser
from .recursiveMapper import RecursiveMapper
from ..commonPy.recursiveMapper import RecursiveMapper
from .synchronousTool import SynchronousToolGlueGenerator
isAsynchronous = False
......@@ -66,13 +66,13 @@ def CleanName(name):
def RegistersAllocated(node):
# The ESA FPGA needs alignment to 4 byte offsets
names = commonPy.asnParser.g_names
names = asnParser.g_names
while isinstance(node, str):
node = names[node]
retValue = None
if isinstance(node, AsnBasicNode):
retValue = 0
realLeafType = commonPy.asnParser.g_leafTypeDict[node._leafType]
realLeafType = asnParser.g_leafTypeDict[node._leafType]
if realLeafType == "INTEGER":
retValue = 8
elif realLeafType == "REAL":
......
......@@ -86,16 +86,16 @@ from importlib import import_module
from . import commonPy
# To unpickle the Py2/ANTLR2-generated pickle file...
# http://stackoverflow.com/questions/2121874/python-pickling-after-changing-a-modules-directory
from . import commonPy2
sys.modules['commonPy2'] = commonPy2
from .commonPy.utility import panic, inform
from .commonPy import verify
from . import B_mappers # NOQA pylint: disable=unused-import
# To unpickle the Py2/ANTLR2-generated pickle file...
# http://stackoverflow.com/questions/2121874/python-pickling-after-changing-a-modules-directory
from . import commonPy2
sys.modules['commonPy2'] = commonPy2
g_mappedName = {
'SEQUENCE': 'OnSequence',
'SET': 'OnSet',
......
......@@ -17,16 +17,16 @@ import platform
from subprocess import Popen, PIPE
import distutils.spawn as spawn
import commonPy.configMT
import commonPy.asnParser
from .commonPy import configMT
from .commonPy import asnParser
from commonPy.asnAST import (
from .commonPy.asnAST import (
AsnBasicNode, AsnBool, AsnReal, AsnInt,
AsnEnumerated, AsnString, AsnChoice, AsnSequence,
AsnSequenceOf, AsnSet, AsnSetOf)
from commonPy.utility import inform, panic, mysystem
from .commonPy.utility import inform, panic, mysystem
g_keepFiles = False
g_privateHeapSize = -1
......@@ -105,15 +105,15 @@ def calculateForNativeAndASN1SCC(absASN1SCCpath, autosrc, names, inputFiles):
uniqueASNfiles = {}
for asnFile in inputASN1files:
tmpNames = {}
for name in commonPy.asnParser.g_typesOfFile[asnFile]:
tmpNames[name] = commonPy.asnParser.g_names[name]
for name in asnParser.g_typesOfFile[asnFile]:
tmpNames[name] = asnParser.g_names[name]
uniqueASNfiles[asnFile] = [
copy.copy(tmpNames), # map Typename to type definition class from asnAST
copy.copy(commonPy.asnParser.g_astOfFile[asnFile]), # list of nameless type definitions
copy.copy(commonPy.asnParser.g_leafTypeDict)] # map from Typename to leafType
copy.copy(asnParser.g_astOfFile[asnFile]), # list of nameless type definitions
copy.copy(asnParser.g_leafTypeDict)] # map from Typename to leafType
commonPy.configMT.outputDir = autosrc + os.sep
configMT.outputDir = autosrc + os.sep
# dumpable.CreateDumpableCtypes(uniqueASNfiles)
for asnTypename in list(names.keys()):
......@@ -245,7 +245,7 @@ def main():
print("ASN2AADL v%s" % versionNumber)
sys.exit(0)
elif opt in ("-d", "--debug"):
commonPy.configMT.debugParser = True
configMT.debugParser = True
elif opt in ("-a", "--aadlv2"):
# Updated, June 2011: AADLv1 no longer supported.
bAADLv2 = True
......@@ -278,7 +278,7 @@ def main():
inputFiles = args[:-1]
# Parse the ASN.1 files (skip the ACN ones)
commonPy.asnParser.ParseAsnFileList([x for x in inputFiles if not x.lower().endswith('.acn')])
asnParser.ParseAsnFileList([x for x in inputFiles if not x.lower().endswith('.acn')])
autosrc = tempfile.mkdtemp(".asn1c")
inform("Created temporary directory (%s) for auto-generated files...", autosrc)
absPathOfAADLfile = os.path.abspath(aadlFile)
......@@ -292,7 +292,7 @@ def main():
# CHOICEs, however, changed the picture... what to put in?
# Time to use the maximum of Native (SIZ2) and UPER (SIZE) and ACN (SIZ3)...
messageSizes = calculateForNativeAndASN1SCC(absASN1SCCpath, autosrc, commonPy.asnParser.g_names, inputFiles)
messageSizes = calculateForNativeAndASN1SCC(absASN1SCCpath, autosrc, asnParser.g_names, inputFiles)
for nodeTypename in list(messageSizes.keys()):
messageSizes[nodeTypename] = [messageSizes[nodeTypename], (8 * (int((messageSizes[nodeTypename] - 1) / 8)) + 8)]
......@@ -343,18 +343,18 @@ properties
Data_Model::Data_Representation => Character;
end Stream_Element_Buffer;
''')
for asnTypename in list(commonPy.asnParser.g_names.keys()):
node = commonPy.asnParser.g_names[asnTypename]
for asnTypename in list(asnParser.g_names.keys()):
node = asnParser.g_names[asnTypename]
if node._isArtificial:
continue
cleanName = cleanNameAsAADLWants(asnTypename)
o.write('DATA ' + cleanName + '\n')
o.write('PROPERTIES\n')
o.write(' -- name of the ASN.1 source file:\n')
# o.write(' Source_Text => ("%s");\n' % os.path.basename(commonPy.asnParser.g_names[asnTypename]._asnFilename))
o.write(' Source_Text => ("%s");\n' % commonPy.asnParser.g_names[asnTypename]._asnFilename)
# o.write(' Source_Text => ("%s");\n' % os.path.basename(asnParser.g_names[asnTypename]._asnFilename))
o.write(' Source_Text => ("%s");\n' % asnParser.g_names[asnTypename]._asnFilename)
prefix = bAADLv2 and "TASTE::" or ""
possibleACN = ASNtoACN(commonPy.asnParser.g_names[asnTypename]._asnFilename)
possibleACN = ASNtoACN(asnParser.g_names[asnTypename]._asnFilename)
if bAADLv2 and os.path.exists(possibleACN):
prefix2 = bAADLv2 and "TASTE::" or "assert_properties::"
base = os.path.splitext(os.path.basename(possibleACN))[0]
......@@ -426,8 +426,8 @@ end Stream_Element_Buffer;
o.write('END ' + cleanName + '_Buffer.impl;\n\n')
listOfAsn1Files = {}
for asnTypename in list(commonPy.asnParser.g_names.keys()):
listOfAsn1Files[commonPy.asnParser.g_names[asnTypename]._asnFilename] = 1
for asnTypename in list(asnParser.g_names.keys()):
listOfAsn1Files[asnParser.g_names[asnTypename]._asnFilename] = 1
if bAADLv2:
for asnFilename in list(listOfAsn1Files.keys()):
......
This diff is collapsed.
......@@ -20,7 +20,7 @@ ___dmt_B_mappers_%.py,cover: ../dmt/B_mappers/%.py mini_cv.aadl DataView.aadl Da
$(MAKE) -f Makefile.M2C clean
mkdir -p output
rm -rf output/*
# coverage run -a ../aadl2glueC.py -o output -verbose mini_cv_vhdl.aadl DataViewVHDL.aadl >/dev/null
# PYTHONPATH=.. LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.aadl2glueC -o output -verbose mini_cv_vhdl.aadl DataViewVHDL.aadl >/dev/null
PYTHONPATH=.. LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.aadl2glueC -o output -verbose mini_cv.aadl DataView.aadl >/dev/null
PYTHONPATH=.. LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.aadl2glueC -o output -verbose -useOSS mini_cv.aadl DataView.aadl >/dev/null
PYTHONPATH=.. LANG=C LC_ALL=C python3 -m coverage annotate -d . ../dmt/aadl2glueC.py ../dmt/B_mappers/*.py ../dmt/commonPy/*.py
......
Markdown is supported
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