Commit 39b80f18 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Fix bug with synonym types

parent 5cb26017
......@@ -58,7 +58,9 @@ full-install: update
$(MAKE) install
publish:
@python3 setup.py sdist upload
@rm -f dist/*
@python3 setup.py sdist bdist_wheel
@twine upload dist/*
pytest:
# make sure you have installed pytest-qt:
......
......@@ -53,50 +53,17 @@ Debian 10 (buster) is the baseline. Recent versions of Ubuntu (20.x) should work
Using TASTE
-----------
__Important: OpenGEODE is already installed in the TASTE Virtual Machine, and fully integrated with the toolset, however, the current TASTE VM is a bit old - it is based on Debian 9 which does not have important dependencies to support the latest version of OpenGEODE. It is missing Python 3.7+ and PySide2. An upgrade is in the works, but it's not ready yet. If you are familiar enough with Linux, you can manually upgrade by completing the following steps.__
__Important: OpenGEODE is already installed in the TASTE10 Virtual Machine (based on Debian Buster), and fully integrated with the toolset. It is the easiest way to get started with OpenGEODE__
_Install the [TASTE VM](https://taste.tools/#install). Once logged in, enter a new shell and:_
To start a new project run:
```
# Switch to root
sudo su
# Make sure VM image is up to date
apt-get update
apt-get upgrade
apt-get dist-upgrade
# Point APT to Buster to prepare for upgrade
sed -i 's/stretch/buster/g' /etc/apt/sources.list
# Upgrade packages to Buster; when prompted allow services to be restarted automatically
apt-get upgrade
# Upgrade distribution to Buster
apt-get dist-upgrade
# Remove packages no longer needed
apt-get autoremove
# Return to taste user; exit root
exit
# Navigate to TASTE source; upgrade
cd ~/tool-src
git pull
git checkout feature_buster
./Update-TASTE.sh
$ taste
```
After this upgrade, you can work with the latest version of the tools, in particular the new Kazoo build system and Opengeode 3.xx (which you can update at any time). The Quick Reference Card has not been updated to reflect this yet.
The main differences to create/edit a project is that you must just run `taste<` (and not `taste-create-project/taste-edit-project` anymore). To build, run `make`.
Select a project name and the graphical editor will pop-up shortly after. You can add functions to the system and specify the imnplementation language to __SDL__. When you edit the function, the OpenGEODE editor will start.
You can check an example of a system using Opengeode if you go in `~/tool-src/kazoo/tests/Demo_ABB_Opengeode` and run `make` to build it. Then `taste` to edit.
In the interface view, select the SDL language for the implementation of the blocks you want to model using OpenGEODE.
Then when you right-click on the SDL block you can select the option "Open SDL Editor".
The code is automatically generated when you exit the tool.
Manual
......@@ -138,7 +105,7 @@ Once you have the dependencies installed you can update the tool by running the
```
$ git pull
$ make install # alternatively: pip3 install --user --upgrade .
$ make install # alternatively: pip3 install --user --upgrade opengeode
```
OpenGEODE Website
......@@ -175,6 +142,11 @@ The background pattern was downloaded from www.subtlepatterns.com
Changelog
=========
**3.3.1 (09/2020)**
- Fix issue with type synonyms
- Update installation procedure
- Enable pip3 installations from PyPI
**3.3.0 (08/2020)**
- Save the state as an ASN.1 model instead of a native Ada type
- Ada backend basic support for "decision any"
......
......@@ -559,6 +559,29 @@ def find_basic_type(a_type, pool=None):
'" was not found in Dataview')
return basic_type
def find_type_name(a_type, pool=None) -> str:
''' A Type may be an alias of another type, if it has a ReferencedTypeName
and the same constraints as the referenced type. This function finds the
name of the original type definition '''
if a_type.kind != 'ReferenceType':
raise TypeError('Not a referenced type')
pool = pool or types()
refname = a_type.ReferencedTypeName
Min = getattr(a_type, "Min", None)
Max = getattr(a_type, "Max", None)
for typename in pool.keys():
# Find the referenced type in the dataview
if refname.lower() == typename.lower():
parent = pool[typename].type
parent_Min = getattr(parent, "Min", None)
parent_Max = getattr(parent, "Max", None)
if((Min != None and parent_Min != Min)
or (Max != None and parent_Max != Max)
or parent.kind != 'ReferenceType'):
# Parent has different constraints or is a basic type
return refname
else:
return find_type_name(parent)
def signature(name, context):
''' Return the signature of a procecure/output/operator '''
......@@ -1190,7 +1213,18 @@ def compare_types(type_a, type_b): # type -> [warnings]
if not type_a or not type_b:
raise TypeError("Missing type definition")
if type_a.kind == 'ReferenceType' and type_b.kind == 'ReferenceType':
if type_a.ReferencedTypeName != type_b.ReferencedTypeName:
# The type names may be different but the types may still be
# the same, eg : TypeB ::= TypeA
# In that case TypeB is just an alias (renaming) of TypeA and it
# is correct to assign value of one to the other
# We must find the lowest common type name denominator before
# concluding that there is a mismatch
# The check must verify that the constraints are strictly the same, too
ref_a = type_a.ReferencedTypeName
ref_b = type_b.ReferencedTypeName
lowest_a = find_type_name (type_a)
lowest_b = find_type_name (type_b)
if lowest_a != lowest_b:
mismatch = '"{}" is not "{}"'.format(type_a.ReferencedTypeName,
type_b.ReferencedTypeName)
type_a = find_basic_type(type_a)
......
......@@ -140,7 +140,7 @@ except ImportError:
__all__ = ['opengeode', 'SDL_Scene', 'SDL_View', 'parse']
__version__ = '3.3.0'
__version__ = '3.3.1'
if hasattr(sys, 'frozen'):
# Detect if we are running on Windows (py2exe-generated)
......
......@@ -2,8 +2,8 @@
# -*- coding: utf-8 -*-
'''
Setup file for Linux distribution
Usage: python setup.py sdist --> to create a tarball
python setup.py install --> to install in python directory
Usage: python3 setup.py sdist bdist_wheel --> to create a tarball
pip3 install --user --upgrade . --> to install in ~/.local
'''
# from distutils.core import setup
......@@ -19,15 +19,17 @@ setup(
author_email='maxime.perrotin@esa.int',
description='A free SDL editor for TASTE',
long_description=open('README.md').read(),
long_description_content_type="text/markdown",
install_requires=[],
tests_require=['tabulate'],
include_package_data=True,
url='http://opengeode.net',
python_requires='>=3.7',
classifiers=[
'Programming Language :: Python',
'License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)',
'Operating System :: OS Independent',
'Programming Language :: Python :: 3.7'
'Programming Language :: Python :: 3'
],
entry_points={
'console_scripts': [
......
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