Commit 2fd8c2a3 authored by Thanassis Tsiodras's avatar Thanassis Tsiodras

Address Python 3.5 issue (see: https://goo.gl/gOJ75p )

parent 9b10c290
PY_SRC:=$(wildcard dmt/asn2dataModel.py dmt/aadl2glueC.py dmt/smp2asn.py dmt/*mappers/[a-zA-Z]*py dmt/commonPy/[a-zA-Z]*py)
PY_SRC:=$(filter-out dmt/B_mappers/antlr.main.py dmt/A_mappers/Stubs.py dmt/B_mappers/pyside_B_mapper.py, ${PY_SRC})
# Python3.5 includes an older version of typing, which by default has priority over
# the one installed in $HOME/.local via setup.py.
#
# To address this, we find where our pip-installed typing lives:
TYPING_FOLDER:=$(shell pip3 show typing | grep ^Location | sed 's,^.*: ,,')
export PYTHONPATH=${TYPING_FOLDER}
all: flake8 pylint mypy coverage
flake8:
......
import re
import sys
from lxml import etree
from typing import List, Union, Optional, Any, Tuple, Dict # NOQA pylint: disable=unused-import
from lxml import etree
from .asnAST import (
AsnBool, AsnInt, AsnReal, AsnEnumerated, AsnOctetString, AsnSequenceOf,
AsnSet, AsnSetOf, AsnSequence, AsnChoice, AsnMetaMember, AsnNode)
......
......@@ -5,6 +5,13 @@ 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=___dmt_B_mappers_%.py,cover)
# Python3.5 includes an older version of typing, which by default has priority over
# the one installed in $HOME/.local via setup.py.
#
# To address this, we find where our pip-installed typing lives:
TYPING_FOLDER:=$(shell pip3 show typing | grep ^Location | sed 's,^.*: ,,')
export PYTHONPATH:=${TYPING_FOLDER}:..
.PHONY: check
all: $(PYSRC_B_COVER) check
......@@ -20,10 +27,10 @@ ___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/*
# 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
# LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.aadl2glueC -o output -verbose mini_cv_vhdl.aadl DataViewVHDL.aadl >/dev/null
LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.aadl2glueC -o output -verbose mini_cv.aadl DataView.aadl >/dev/null
LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.aadl2glueC -o output -verbose -useOSS mini_cv.aadl DataView.aadl >/dev/null
LANG=C LC_ALL=C python3 -m coverage annotate -d . ../dmt/aadl2glueC.py ../dmt/B_mappers/*.py ../dmt/commonPy/*.py
check:
ifneq ($(CIRCLECI),)
......
......@@ -5,6 +5,13 @@ VPATH=..:../dmt/A_mappers:../dmt/commonPy
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)
# Python3.5 includes an older version of typing, which by default has priority over
# the one installed in $HOME/.local via setup.py.
#
# To address this, we find where our pip-installed typing lives:
TYPING_FOLDER:=$(shell pip3 show typing | grep ^Location | sed 's,^.*: ,,')
export PYTHONPATH:=${TYPING_FOLDER}:..
.PHONY: check
all: $(PYSRC_A_COVER) check
......@@ -13,21 +20,21 @@ ___dmt_A_mappers_%.py,cover: ../A_mappers/%.py DataTypesSimulink.asn
@echo Update required: $@ depends on $?
mkdir -p output
rm -rf output/*
PYTHONPATH=.. LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel 2>/dev/null || echo -n
PYTHONPATH=.. LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o output 2>/dev/null || echo -n
PYTHONPATH=.. LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o output -toRTDS DataTypesSimulink.asn >/dev/null
PYTHONPATH=.. LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o output -toQGenAda DataTypesSimulink.asn >/dev/null
PYTHONPATH=.. LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o output -toQGenC DataTypesSimulink.asn >/dev/null
PYTHONPATH=.. LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o output -verbose -toSIMULINK DataTypesSimulink.asn >/dev/null
PYTHONPATH=.. LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o output -toOG DataTypesSimulink.asn
PYTHONPATH=.. LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o output -toAda DataTypesSimulink.asn
PYTHONPATH=.. LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o output -toC DataTypesSimulink.asn >/dev/null
PYTHONPATH=.. LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o output -toSMP2 DataTypesSimulink.asn >/dev/null
PYTHONPATH=.. LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o output -toPython DataTypesSimulink.asn >/dev/null
PYTHONPATH=.. LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o output -toSCADE6 DataTypesSimulink.asn >/dev/null
PYTHONPATH=.. LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o output -toSQL DataTypesSimulink.asn >/dev/null
PYTHONPATH=.. LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o output -toSqlalchemy DataTypesSimulink.asn >/dev/null
PYTHONPATH=.. LANG=C LC_ALL=C python3 -m coverage annotate -d . ../dmt/asn2dataModel.py ../dmt/A_mappers/*.py ../dmt/commonPy/*.py
LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel 2>/dev/null || echo -n
LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o output 2>/dev/null || echo -n
LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o output -toRTDS DataTypesSimulink.asn >/dev/null
LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o output -toQGenAda DataTypesSimulink.asn >/dev/null
LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o output -toQGenC DataTypesSimulink.asn >/dev/null
LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o output -verbose -toSIMULINK DataTypesSimulink.asn >/dev/null
LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o output -toOG DataTypesSimulink.asn
LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o output -toAda DataTypesSimulink.asn
LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o output -toC DataTypesSimulink.asn >/dev/null
LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o output -toSMP2 DataTypesSimulink.asn >/dev/null
LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o output -toPython DataTypesSimulink.asn >/dev/null
LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o output -toSCADE6 DataTypesSimulink.asn >/dev/null
LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o output -toSQL DataTypesSimulink.asn >/dev/null
LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o output -toSqlalchemy DataTypesSimulink.asn >/dev/null
LANG=C LC_ALL=C python3 -m coverage annotate -d . ../dmt/asn2dataModel.py ../dmt/A_mappers/*.py ../dmt/commonPy/*.py
check:
ifneq ($(CIRCLECI),)
......
include common.mk
# Python3.5 includes an older version of typing, which by default has priority over
# the one installed in $HOME/.local via setup.py.
#
# To address this, we find where our pip-installed typing lives:
TYPING_FOLDER:=$(shell pip3 show typing | grep ^Location | sed 's,^.*: ,,')
export PYTHONPATH:=${TYPING_FOLDER}:..
all:
make clean
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
LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.asn2dataModel -o . -toSMP2 DataTypesSimulink.asn >/dev/null
LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.smp2asn >/dev/null 2>&1 ; exit 0
LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.smp2asn -h >/dev/null 2>&1 ; exit 0
LANG=C LC_ALL=C python3 -m coverage run -a -m dmt.smp2asn -z >/dev/null 2>&1 ; exit 0
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
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
LANG=C LC_ALL=C ${COVERAGE} annotate -d . ../dmt/smp2asn.py ../dmt/commonPy/*.py || exit 1
ifneq ($(CIRCLECI),)
./checkCoverage.pl ___dmt_smp2asn.py,cover || { echo smp2asn.py failed... ; cp __dmt_smp2asn.py,cover ${CIRCLE_ARTIFACTS} ; exit 1 ; }
else
......
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