Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This request only adds a unittest to show a problem with the import feature of pyfranca. See #10
The Problem occur if an importet fidl also import another fidl file. In my example the fidl hierarchy lookls like:
P.fidl --> Type1.fidl --> Common.fidl
--> Type2.fidl --> Common.fidl
The problem is located in method import_package() in franca_processor.
When merging the imported packages only interafces and typecollections are copied. Not the imports. Later in import_package the instuction "package = self.packages[package.name]" overwrites the imported package and the imports get lost.
I try to fix the problem. I add th copy instruction for the imports to iadd in ast.py. This helps and my test fidl are imported correctly. But ther is stille another problem. Method import_package() is calling itself.
I add a print message to display all importetd fidl files. In my examples with unmodifed bevavior it looks like:
Import File: E:\project\pyfranca\pyfranca\pyfranca\tests\fidl\ImportChain\P.fidl
Import File: Type1.fidl
Import File: Type1.fidl
Import File: Type2.fidl
Import File: Type1.fidl
Import File: Type2.fidl
Import File: common.fidl
Import File: Type1.fidl
Import File: Type2.fidl
Import File: common.fidl
Import File: common.fidl
Import File: common.fidl
Import File: common.fidl
Import File: common.fidl
Import File: Type2.fidl
Import File: common.fidl
Import File: common.fidl
You see the fidls files are imported multiple times. To fix this behavior I try to remove instruction "package = self.packages[package.name]"
This result in the correct import order:
Import File: E:\project\pyfranca\pyfranca\pyfranca\tests\fidl\ImportChain\P.fidl
Import File: Type1.fidl
Import File: common.fidl
Import File: Type2.fidl
Import File: common.fidl
But I am not sure that with my changes method _update_package_references() ist still working correctly.
Please could you verify that the unittest show realy a problem?
This is a tricky issue. I hope my analysis helps you to understand the problem.