Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deal with external type bound procedures without local overwrite #677

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

haraldkl
Copy link
Contributor

An attempt to address #676.

@haraldkl haraldkl changed the title Add "proto" attribute to be externalized Deal with external type bound procedures without local overwrite Nov 16, 2024
Copy link
Contributor Author

@haraldkl haraldkl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes #676, but not very elegantly. Somehow the externalization stuff bleeds into the templates/macros.html, which does not seem very desirable. The logic for external in the progress of the correlate methods may also be needed elsewhere, and maybe it would be better to overwrite the correlate functions for the External* classes.

Comment on lines -69 to -73
if hasattr(intObj, "extends"):
if isinstance(intObj.extends, FortranType):
extDict["extends"] = obj2dict(intObj.extends)
else:
extDict["extends"] = intObj.extends
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we want to follow the extends further up, after we first hit an external project, so there isn't really a need for this information in the serialized file.

Comment on lines +64 to +65
if isinstance(intObj, str):
return intObj
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to the attribs list for type-bound procedures we need to take care of strings in the recursive serialization.

Comment on lines +794 to +798
if hasattr(r, "meta"):
self.max_nesting = max(self.max_nesting, int(r.meta.graph_maxdepth))
self.max_nodes = max(self.max_nodes, int(r.meta.graph_maxnodes))
if hasattr(r, "settings"):
self.warn = self.warn or (r.settings.warn)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The nodes we want to add here, may be from external projects and won't have the meta and settings attribute, hence we need to treat this gracefully.

break
if proc.generic:
proc.correlate(project)
if type(proc) is FortranBoundProcedure:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only continue correlation and bindings lookup for non-external BoundProcedures.

Comment on lines +170 to +173
{%- if not entity.external_url -%}
{%- if entity | meta('deprecated') -%}
<span class="badge bg-danger depwarn">Deprecated</span>
{%- endif -%}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For external projects we do not know the deprecation status and need to skip this here.

Comment on lines +332 to +337
{%- if tb.external_url %}
(external{% if not link_name %}: {{ tb | relurl(page_url) }}{% endif %})
{%- else %}
{%- if tb.generic or (tb.name != tb.bindings[0].name and tb.name != tb.bindings[0]) %} => {{ tb.bindings | join(", ") }}{% endif %}
{% if tb.binding|length == 1 %}<small>{{ tb.bindings[0].proctype }}</small>{% endif %}
{% endif %}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is an external procedure, we do not have more info on it, point it out, and link to it if not done already.

{{ binding_summary(bind.proto.procedure,proto=True) }}
{% elif bind.proto.obj == 'procedure' %}
{{ binding_summary(bind.proto,proto=True) }}
{% if not tb.external_url %}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skip these details for external procedures.

@@ -569,7 +577,9 @@ <h4>Type-Bound Procedures</h4>
{% for tb in dtype.boundprocs %}
<tr>
<td>{{ bound_declaration(tb, link_name=True) }}</td>
<td>{{ tb | meta('summary') | relurl(page_url) }}</td>
{% if not tb.external_url %}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skip the summary for external procedures.

@haraldkl haraldkl marked this pull request as ready for review November 16, 2024 23:11
Comment on lines -258 to +259
directory = Path(directory).absolute()
self.directory = Path(directory).absolute()
Copy link
Contributor Author

@haraldkl haraldkl Nov 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the feeling, that the information on the project directory is already somewhere stored in the Project object, but I somehow could not find it. I am not sure if storing this info in the settings object is the right thing to do. But it appeared natural to store it at this point.

I introduced this to allow for relative local path definitions in the external projects.

See: #676 (comment)

@ZedThree
Copy link
Member

Thanks @haraldkl! Not had chance to go through this properly yet, but it looks good so far!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants