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