Commit 574bef65 authored by Thanassis Tsiodras's avatar Thanassis Tsiodras
Browse files

[distutils] No more symlinks. Extremely tough challenges with aadl2glueC and antlr met.

parent 4d31450c
../commonPy/createInternalTypes.py
\ No newline at end of file
......@@ -33,7 +33,7 @@ import distutils.spawn as spawn
from ..commonPy import asnParser
from ..commonPy.utility import panic, inform
from ..commonPy.asnAST import AsnBool, AsnInt, AsnReal, AsnString, AsnEnumerated, AsnSequence, AsnSet, AsnChoice, AsnMetaMember, AsnSequenceOf, AsnSetOf
from .createInternalTypes import ScanChildren
from ..commonPy.createInternalTypes import ScanChildren
# The file written to
g_outputFile = None
......
......@@ -28,7 +28,7 @@ from ..commonPy import asnParser
from ..commonPy.asnAST import (
AsnBool, AsnInt, AsnReal, AsnString, AsnEnumerated, AsnSequence,
AsnSet, AsnChoice, AsnMetaMember, AsnSequenceOf, AsnSetOf)
from .createInternalTypes import ScanChildren
from ..commonPy.createInternalTypes import ScanChildren
# The file written to
g_outputFile = None
......
......@@ -25,7 +25,7 @@ from ..commonPy import asnParser
from ..commonPy.asnAST import (
AsnBool, AsnInt, AsnReal, AsnString, AsnEnumerated, AsnSequence,
AsnSet, AsnChoice, AsnMetaMember, AsnSequenceOf, AsnSetOf)
from .createInternalTypes import ScanChildren
from ..commonPy.createInternalTypes import ScanChildren
# The file written to
g_outputFile = None
......
......@@ -25,7 +25,7 @@ Base class for all asynchronous tools
import re
import os
from commonPy.utility import inform, panicWithCallStack
from ..commonPy.utility import inform, panicWithCallStack
class ASynchronousToolGlueGenerator:
......
......@@ -36,10 +36,10 @@ To that end, this backend creates "glue" functions for input and
output parameters, which have C callable interfaces.
'''
from commonPy.utility import panic
from commonPy.asnAST import sourceSequenceLimit, isSequenceVariable, targetSequenceLimit
from ..commonPy.utility import panic
from ..commonPy.asnAST import sourceSequenceLimit, isSequenceVariable, targetSequenceLimit
from commonPy.recursiveMapper import RecursiveMapper
from ..commonPy.recursiveMapper import RecursiveMapper
from .asynchronousTool import ASynchronousToolGlueGenerator
isAsynchronous = True
......
../commonPy
\ No newline at end of file
......@@ -21,10 +21,12 @@
import re
import os
from commonPy.asnAST import AsnBasicNode, AsnEnumerated, AsnSequence, AsnSet, AsnChoice, AsnSequenceOf, AsnSetOf, AsnMetaMember, \
AsnInt, AsnReal, AsnOctetString, AsnBool, isSequenceVariable, sourceSequenceLimit
from commonPy.utility import panic, panicWithCallStack
import commonPy.asnParser
from ..commonPy.asnAST import (
AsnBasicNode, AsnEnumerated, AsnSequence, AsnSet, AsnChoice,
AsnSequenceOf, AsnSetOf, AsnMetaMember, AsnInt, AsnReal, AsnOctetString,
AsnBool, isSequenceVariable, sourceSequenceLimit)
from ..commonPy.utility import panic, panicWithCallStack
from ..commonPy import asnParser
g_HeaderFile = None
g_SourceFile = None
......@@ -171,7 +173,7 @@ enumFieldNames = {}
def VerifySingleFieldEnums(node):
names = commonPy.asnParser.g_names
names = asnParser.g_names
while isinstance(node, str):
node = names[node]
if isinstance(node, AsnBasicNode):
......@@ -194,8 +196,8 @@ def VerifySingleFieldEnums(node):
def OneTimeOnly(unused_modelingLanguage, asnFile, subProgram, subProgramImplementation, outputDir, maybeFVname, unused_useOSS):
for typename in commonPy.asnParser.g_names:
node = commonPy.asnParser.g_names[typename]
for typename in asnParser.g_names:
node = asnParser.g_names[typename]
VerifySingleFieldEnums(node)
global g_outputDir
......@@ -455,8 +457,8 @@ def OnStartup(modelingLanguage, asnFile, subProgram, subProgramImplementation, o
g_MyTelemetryActions.write(' long long arrivalTime = getTimeInMilliseconds();\n')
g_MyTelemetryActions.write(" wxMutexGuiEnter();\n")
g_MyTelemetryActions.write(" char *pData = (char *)message_data_received;\n")
names = commonPy.asnParser.g_names
leafTypeDict = commonPy.asnParser.g_leafTypeDict
names = asnParser.g_names
leafTypeDict = asnParser.g_leafTypeDict
for param in subProgram._params:
node = names[param._signal._asnNodename]
CleanParam = CleanName(param._id)
......
......@@ -89,9 +89,9 @@ hpredef.h :
Contains the prototypes (extern declarations) of the vm callbacks.
'''
from commonPy.asnAST import isSequenceVariable, sourceSequenceLimit, AsnInt, AsnBool, AsnReal, AsnEnumerated
from ..commonPy.asnAST import isSequenceVariable, sourceSequenceLimit, AsnInt, AsnBool, AsnReal, AsnEnumerated
from .recursiveMapper import RecursiveMapper
from ..commonPy.recursiveMapper import RecursiveMapper
from .asynchronousTool import ASynchronousToolGlueGenerator
isAsynchronous = True
......
......@@ -4,12 +4,12 @@
import re
import os
from commonPy.asnAST import \
AsnInt, AsnBool, AsnReal, AsnEnumerated, \
AsnOctetString, AsnChoice, AsnSequence, AsnSet, \
AsnSequenceOf, AsnSetOf, AsnMetaMember
from ..commonPy.asnAST import (
AsnInt, AsnBool, AsnReal, AsnEnumerated,
AsnOctetString, AsnChoice, AsnSequence, AsnSet,
AsnSequenceOf, AsnSetOf, AsnMetaMember)
from commonPy.utility import panic
from ..commonPy.utility import panic
g_PyDataModel = None
g_iter = 1
......
../commonPy/recursiveMapper.py
\ No newline at end of file
......@@ -35,11 +35,11 @@ parameters, which have C callable interfaces. The necessary
stubs (to allow calling from the VM side) are also generated.
'''
from commonPy.utility import panic, panicWithCallStack
from commonPy.asnAST import isSequenceVariable, sourceSequenceLimit
from commonPy.aadlAST import AadlPort, AadlParameter
from ..commonPy.utility import panic, panicWithCallStack
from ..commonPy.asnAST import isSequenceVariable, sourceSequenceLimit
from ..commonPy.aadlAST import AadlPort, AadlParameter
from .recursiveMapper import RecursiveMapper
from ..commonPy.recursiveMapper import RecursiveMapper
from .synchronousTool import SynchronousToolGlueGenerator
isAsynchronous = False
......
......@@ -89,9 +89,9 @@ hpredef.h :
Contains the prototypes (extern declarations) of the vm callbacks.
'''
from commonPy.asnAST import isSequenceVariable, sourceSequenceLimit, AsnInt, AsnBool, AsnReal, AsnEnumerated
from ..commonPy.asnAST import isSequenceVariable, sourceSequenceLimit, AsnInt, AsnBool, AsnReal, AsnEnumerated
from .recursiveMapper import RecursiveMapper
from ..commonPy.recursiveMapper import RecursiveMapper
from .asynchronousTool import ASynchronousToolGlueGenerator
isAsynchronous = True
......
......@@ -35,11 +35,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
......
......@@ -24,8 +24,8 @@ Base class for all synchronous tools
import re
import os
from commonPy.utility import panic, inform, panicWithCallStack
from commonPy.aadlAST import InParam, OutParam, InOutParam
from ..commonPy.utility import panic, inform, panicWithCallStack
from ..commonPy.aadlAST import InParam, OutParam, InOutParam
class SynchronousToolGlueGenerator:
......
......@@ -84,16 +84,17 @@ import copy
import distutils.spawn as spawn
from importlib import import_module
import commonPy.configMT
from . import commonPy
import commonPy.asnParser
import commonPy.aadlAST
import commonPy.cleanupNodes
# 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.utility import panic, inform
from .commonPy import verify
import commonPy.verify as verify
import B_mappers # NOQA pylint: disable=unused-import
from . import B_mappers # NOQA pylint: disable=unused-import
g_mappedName = {
'SEQUENCE': 'OnSequence',
......@@ -144,7 +145,7 @@ of each SUBPROGRAM param.'''
patchMe(cn)
try:
import pickle
astInfo = pickle.load(open(astFile, 'rb'))
astInfo = pickle.load(open(astFile, 'rb'), fix_imports=False)
for k in ['g_processImplementations', 'g_apLevelContainers',
'g_signals', 'g_systems', 'g_subProgramImplementations',
'g_threadImplementations']:
......@@ -176,7 +177,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])))
if sys.argv.count("-o") != 0:
idx = sys.argv.index("-o")
try:
......@@ -301,7 +301,7 @@ def main():
backendFilename = "." + modelingLanguage.lower() + "_B_mapper.py"
inform("Parsing %s...", backendFilename)
try:
backend = import_module(backendFilename[:-3], 'B_mappers') # pragma: no cover
backend = import_module(backendFilename[:-3], 'dmt.B_mappers') # pragma: no cover
if backendFilename[:-3] not in loadedBackends:
loadedBackends[backendFilename[:-3]] = 1
if commonPy.configMT.verbose:
......@@ -401,10 +401,10 @@ def main():
def mappers(lang):
if lang.lower() in ["gui_pi", "gui_ri"]:
return [import_module(".python_B_mapper", "B_mappers"),
import_module(".pyside_B_mapper", "B_mappers")] # pragma: no cover
return [import_module(".python_B_mapper", "dmt.B_mappers"),
import_module(".pyside_B_mapper", "dmt.B_mappers")] # pragma: no cover
elif lang.lower() == "vhdl": # pragma: no cover
return [import_module(".vhdl_B_mapper", "B_mappers")] # pragma: no cover
return [import_module(".vhdl_B_mapper", "dmt.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
......@@ -454,4 +454,9 @@ def main():
b.OnFinal() # pragma: no cover
if __name__ == "__main__":
if "-pdb" in sys.argv:
sys.argv.remove("-pdb") # pragma: no cover
import pdb # pragma: no cover pylint: disable=wrong-import-position,wrong-import-order
pdb.run('main()') # pragma: no cover
else:
main()
......@@ -7,6 +7,7 @@
from . import configMT
from . import asnParser
from . import asnAST
from . import aadlAST
from . import utility
from . import createInternalTypes
from . import verify
......
......@@ -4,9 +4,9 @@ import sys
from typing import Any, Dict # NOQA pylint: disable=unused-import
from lxml import etree
from commonPy.asnAST import AsnBool, AsnInt, AsnReal, \
AsnEnumerated, AsnOctetString, AsnSequenceOf, AsnSet, \
AsnSetOf, AsnSequence, AsnChoice, AsnMetaMember
from .asnAST import (
AsnBool, AsnInt, AsnReal, AsnEnumerated, AsnOctetString, AsnSequenceOf,
AsnSet, AsnSetOf, AsnSequence, AsnChoice, AsnMetaMember)
# Level of verbosity
g_verboseLevel = 0
......
......@@ -21,14 +21,14 @@
import re
from typing import Any, Dict, List # NOQA pylint: disable=unused-import
from ..commonPy import asnParser
from . import asnParser
from ..commonPy.asnAST import (
from .asnAST import (
AsnString, AsnBasicNode, AsnSetOf, AsnSequenceOf, AsnSet,
AsnSequence, AsnChoice, AsnMetaMember, AsnEnumerated,
AsnNode
)
from ..commonPy.utility import panic
from .utility import panic
# Separate cache per ASN.1 AST dictionary (i.e. per 'names' parameter of ScanChildren)
......
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