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
......@@ -32,12 +32,12 @@ import os
import sys
import getopt
import commonPy.asnParser
from commonPy.createInternalTypes import ScanChildren
from commonPy.asnAST import AsnMetaType
from commonPy.commonSMP2 import \
info, panic, green, white, red, setVerbosity, \
DashUnderscoreAgnosticDict, ConvertCatalogueToASN_AST
from .commonPy import asnParser
from .commonPy.createInternalTypes import ScanChildren
from .commonPy.asnAST import AsnMetaType
from .commonPy.commonSMP2 import (
info, panic, green, white, red, setVerbosity,
DashUnderscoreAgnosticDict, ConvertCatalogueToASN_AST)
def usage(coloredMsg=""):
......@@ -57,11 +57,11 @@ def usage(coloredMsg=""):
def MergeASN1_AST(smp2AsnAST):
'''Merges the ASN.1 AST generated from SMP2 files (smp2AsnAST param)
into the ASN.1 AST stored in commonPy.asnParser.g_names. Uses smart
into the ASN.1 AST stored in asnParser.g_names. Uses smart
merging, i.e. diff-like semantics.'''
typesToAddVerbatim = []
identicals = {}
d = commonPy.asnParser.g_names
d = asnParser.g_names
for k, v in smp2AsnAST.items():
if k in d:
# Type name exists in both trees - is it the same?
......@@ -76,7 +76,7 @@ def MergeASN1_AST(smp2AsnAST):
for k2, v2 in d.items():
if v2._isArtificial:
# Avoid mapping to artificially generated inner types
# (see last part of VerifyAndFixAST in commonPy.asnParser)
# (see last part of VerifyAndFixAST in asnParser)
continue
if v2.IdenticalPerSMP2(v, d, smp2AsnAST):
info(1, green, k, white, "is identical to", red, k2, white)
......@@ -85,7 +85,7 @@ def MergeASN1_AST(smp2AsnAST):
else:
info(1, green, k, white, "must be copied (no equivalent type found)...")
typesToAddVerbatim.append(k)
# Merge missing types in commonPy.asnParser.g_names
# Merge missing types in asnParser.g_names
for nodeTypename in typesToAddVerbatim:
results = []
node = smp2AsnAST[nodeTypename]
......@@ -97,22 +97,22 @@ def MergeASN1_AST(smp2AsnAST):
node = smp2AsnAST[r]
d[r] = node
if isinstance(node, AsnMetaType):
commonPy.asnParser.g_metatypes[r] = r._containedType # pragma: no cover
asnParser.g_metatypes[r] = r._containedType # pragma: no cover
d[r] = smp2AsnAST[r._containedType] # pragma: no cover
commonPy.asnParser.g_typesOfFile.setdefault(node._asnFilename, []).append(r)
asnParser.g_typesOfFile.setdefault(node._asnFilename, []).append(r)
return identicals
def SaveASN_AST(bPruneUnnamedInnerTASTEtypes, outputAsn1Grammar, identicals):
d = DashUnderscoreAgnosticDict()
for k, v in commonPy.asnParser.g_names.items():
for k, v in asnParser.g_names.items():
d[k] = v
with open(outputAsn1Grammar, 'w') as f:
f.write('DATAVIEW DEFINITIONS AUTOMATIC TAGS ::= BEGIN\n\n')
for k, v in d.items():
if v._isArtificial:
# Don't emit artificially generated inner types
# (see last part of VerifyAndFixAST in commonPy.asnParser)
# (see last part of VerifyAndFixAST in asnParser)
continue
if bPruneUnnamedInnerTASTEtypes and 'TaStE' in k:
# Don't emit artificially generated SMP2 types
......@@ -169,7 +169,7 @@ def main(args):
smp2AsnAST, unused_idToTypeDict = ConvertCatalogueToASN_AST(inputSmp2Files)
if inputAsn1Grammar:
commonPy.asnParser.ParseAsnFileList([inputAsn1Grammar])
asnParser.ParseAsnFileList([inputAsn1Grammar])
identicals = MergeASN1_AST(smp2AsnAST)
SaveASN_AST(bPrune, outputAsn1Grammar, identicals)
return 0
......
......@@ -17,12 +17,6 @@ setup(
name='dmt',
version=commonPy.__version__,
packages=find_packages(),
data_files=[
('dmt-utils', [
'dmt/utils/learn_CHOICE_enums.py',
'dmt/utils/parse_aadl.py',
'dmt/utils/asn2aadlPlus.py']),
],
author='Thanassis Tsiodras',
author_email='Thanassis.Tsiodras@esa.int',
description='TASTE Data Modelling Technologies based on ASN.1',
......@@ -38,11 +32,12 @@ setup(
],
entry_points={
'console_scripts': [
# 'asn2aadlPlus = asn2aadlPlus:main',
'asn2aadlPlus = asn2aadlPlus:main',
'asn2dataModel = dmt.asn2dataModel:main',
'aadl2glueC = dmt.aadl2glueC:main',
'msgPrinter = dmt.msgPrinter:main',
'msgPrinterASN1 = dmt.msgPrinterASN1:main',
'smp2asn = dmt.smp2asn:main',
'dmt = dmt.commonPy:print_version'
]
}
......
include common.mk
VPATH=.:../B_mappers:../commonPy
VPATH=..:../dmt/B_mappers:../dmt/commonPy
PYSRC_B := asynchronousTool.py ada_B_mapper.py c_B_mapper.py og_B_mapper.py simulink_B_mapper.py scade6_B_mapper.py # pyside_B_mapper.py vhdl_B_mapper.py
PYSRC_B_COVER := $(PYSRC_B:%.py=___B_mappers_%.py,cover)
PYSRC_B_COVER := $(PYSRC_B:%.py=___dmt_B_mappers_%.py,cover)
.PHONY: check
all: $(PYSRC_B_COVER) check
DataView.aadl: DataTypesSimulink.asn
../asn2aadlPlus/asn2aadlPlus.py $< $@
PYTHONPATH=.. python3 -m dmt.asn2aadlPlus $< $@
DataViewVHDL.aadl: DataTypesSimulinkVHDL.asn
../asn2aadlPlus/asn2aadlPlus.py $< $@
PYTHONPATH=.. python3 -m dmt.asn2aadlPlus $< $@
___B_mappers_%.py,cover: ../B_mappers/%.py mini_cv.aadl DataView.aadl DataViewVHDL.aadl
___dmt_B_mappers_%.py,cover: ../dmt/B_mappers/%.py mini_cv.aadl DataView.aadl DataViewVHDL.aadl
@echo Update required: $@ depends on $?
$(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
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 ../B_mappers/*.py ../commonPy/*.py
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
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
......
include common.mk
VPATH=..:../dmt/A_mappers:../commonPy
VPATH=..:../dmt/A_mappers:../dmt/commonPy
PYSRC_A := createInternalTypes.py ada_A_mapper.py c_A_mapper.py og_A_mapper.py simulink_A_mapper.py python_A_mapper.py scade6_A_mapper.py smp2_A_mapper.py sqlalchemy_A_mapper.py rtds_A_mapper.py qgenada_A_mapper.py qgenc_A_mapper.py
PYSRC_A := ada_A_mapper.py c_A_mapper.py og_A_mapper.py simulink_A_mapper.py python_A_mapper.py scade6_A_mapper.py smp2_A_mapper.py sqlalchemy_A_mapper.py rtds_A_mapper.py qgenada_A_mapper.py qgenc_A_mapper.py
PYSRC_A_COVER := $(PYSRC_A:%.py=___dmt_A_mappers_%.py,cover)
.PHONY: check
......@@ -30,7 +30,7 @@ ___dmt_A_mappers_%.py,cover: ../A_mappers/%.py DataTypesSimulink.asn
PYTHONPATH=.. LANG=C LC_ALL=C python3 -m coverage annotate -d . ../dmt/asn2dataModel.py ../dmt/A_mappers/*.py ../dmt/commonPy/*.py
check:
@for i in ___dmt_asn2dataModel.py,cover $(PYSRC_A_COVER) ; do echo Checking $$i ... ; ./checkCoverage.pl $$i || { ( echo $$i ; ./review.pl $$i ) | less -RS ; exit 1 ; } ; done
@for i in ___dmt_commonPy_createInternalTypes.py,cover ___dmt_asn2dataModel.py,cover $(PYSRC_A_COVER) ; do echo Checking $$i ... ; ./checkCoverage.pl $$i || { ( echo $$i ; ./review.pl $$i ) | less -RS ; exit 1 ; } ; done
clean:
${COVERAGE} erase
......
......@@ -2,14 +2,15 @@ include common.mk
all:
make clean
LANG=C LC_ALL=C ../asn2dataModel.py -toSMP2 DataTypesSimulink.asn || exit 1
LANG=C LC_ALL=C ${COVERAGE} run -a ../smp2asn.py >/dev/null 2>&1 ; exit 0
LANG=C LC_ALL=C ${COVERAGE} run -a ../smp2asn.py -h >/dev/null 2>&1 ; exit 0
LANG=C LC_ALL=C ${COVERAGE} run -a ../smp2asn.py -z >/dev/null 2>&1 ; exit 0
LANG=C LC_ALL=C ${COVERAGE} run -a ../smp2asn.py -o smp2.asn -a nonexisting.asn nonexisting.cat >/dev/null 2>&1 ; exit 0
LANG=C LC_ALL=C ${COVERAGE} run -a ../smp2asn.py -o smp2.asn -a DataTypesSimulink.asn -v -p datatypessimulink.cat >/dev/null 2>&1 || exit 1
LANG=C LC_ALL=C ${COVERAGE} annotate -d . ../smp2asn.py ../commonPy/*.py || exit 1
./checkCoverage.pl ___smp2asn.py,cover || { echo smp2asn.py ; ./review.pl ___smp2asn.py,cover | less -RS ; exit 1 ; }
PYTHONPATH=.. LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o . -toSMP2 DataTypesSimulink.asn >/dev/null
PYTHONPATH=.. LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.smp2asn >/dev/null 2>&1 ; exit 0
PYTHONPATH=.. LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.smp2asn -h >/dev/null 2>&1 ; exit 0
PYTHONPATH=.. LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.smp2asn -z >/dev/null 2>&1 ; exit 0
PYTHONPATH=.. LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.smp2asn -o smp2.asn -a nonexisting.asn nonexisting.cat >/dev/null 2>&1 ; exit 0
PYTHONPATH=.. LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.smp2asn -o smp2.asn -a DataTypesSimulink.asn -v -p datatypessimulink.cat >/dev/null 2>&1 || exit 1
PYTHONPATH=.. LANG=C LC_ALL=C ${COVERAGE} annotate -d . ../dmt/smp2asn.py ../dmt/commonPy/*.py || exit 1
./checkCoverage.pl ___dmt_smp2asn.py,cover || { echo smp2asn.py ; ./review.pl ___dmt_smp2asn.py,cover | less -RS ; exit 1 ; }
# ./checkCoverage.pl ___dmt_commonPy_commonSMP2.py,cover || { echo commonSMP2.py ; ./review.pl ___dmt_commonPy_commonSMP2.py,cover | less -RS ; exit 1 ; }
clean:
${COVERAGE} erase
......
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