Skip to content

Commit

Permalink
Fixed palette generation; adjusted action script to new command line;
Browse files Browse the repository at this point in the history
updated docs
  • Loading branch information
awicenec committed Aug 13, 2022
1 parent ad4b759 commit 66dd9be
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/create-palettes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ jobs:
- name: Create palettes
run: |
python3 tools/xml2palette/xml2palette.py -i ./ -t daliuge -o $OUTPUT_FILENAME.palette -p
python3 tools/xml2palette/xml2palette.py -i ./ -t template -o $OUTPUT_FILENAME-template.palette -p
python3 tools/xml2palette/xml2palette.py -t daliuge -r ./ $OUTPUT_FILENAME.palette
python3 tools/xml2palette/xml2palette.py -t template -r ./ $OUTPUT_FILENAME-template.palette
- name: Commit palettes to EAGLE
env:
Expand Down
21 changes: 16 additions & 5 deletions docs/development/app_development/eagle_app_integration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,30 @@ The xml2palette.py script is located in the tools directory within the DALiuGE r

The xml2palette.py script can be run using this command line:

.. code-block:: none
.. code-block::
python3 xml2palette.py -i <path_to_input_directory> -t <tag> -o <path_output_file>
python3 xml2palette.py [-h] [-m MODULE] [-t TAG] [-c] [-r] [-s] [-v] idir ofile
positional arguments:
idir input directory path or file name
ofile output file name
If no tag is specified, all components found in the input directory will part of the output file. If, however, a tag is specified, then only those components with a matching tag will be part of the output. Tags can be added to the Doxygen comments for a component using:
optional arguments:
-h, --help show this help message and exit
-m MODULE, --module MODULE
Module load path name
-t TAG, --tag TAG filter components with matching tag
-c C mode, if not set Python will be used
-r, --recursive Traverse sub-directories
-s, --parse_all Try to parse non DAliuGE compliant functions and methods
-v, --verbose increase output verbosity
If no tag is specified, all components found in the input directory will part of the output file. If, however, a tag is specified, then only those components with a matching tag will be part of the output. Tags can be added to the Doxygen comments for a component using:
.. code-block:: python
# @param tag <tag_name>
There are also two optional arguments for xml2palette. Allow missing "EAGLE start" (-s) which allows xml2palette.py to run on code without any eagle-specific doxygen comments. Finally (-m) restricts xml2palette.py to produce a palette that only contains methods from within the specified module.

Component Doxygen Markup Guide
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
In order to support the direct usage of newly written application components in the EAGLE editor, the |daliuge| system supports a custom set of Doxygen directives and tools. When writing an application component, developers can add specific custom `Doxygen <https://www.doxygen.nl/>`_ comments to the source code. These comments describe the component and can be used to automatically generate a JSON DALiuGE component description which in turn can be used in the *EAGLE*. A few basic rules to remember:
Expand Down
35 changes: 22 additions & 13 deletions tools/xml2palette/xml2palette.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#!/usr/bin/env python
"""
Script processes a file or a directory of source files and
produces a DALiuGE compatible palette file containing the
information required to use functions and components in graphs.
For more information please refer to the documentation
https://daliuge.readthedocs.io/en/latest/development/app_development/eagle_app_integration.html#automatic-eagle-palette-generation
"""

import argparse
import csv
Expand Down Expand Up @@ -92,33 +100,34 @@ class Language(Enum):

def get_args():
# inputdir, tag, outputfile, allow_missing_eagle_start, module_path, language
parser = argparse.ArgumentParser()
parser.add_argument("-v", "--verbose", help="increase output verbosity",
action="store_true")
parser.add_argument("-i", "--idir", help="input directory path spec")
parser.add_argument("-o","--ofile", help="output file name")
parser.add_argument("-t", "--tag", help="tag to search for", default="")
parser.add_argument("-p", "--python", help="Python mode",
action="store_true")
parser.add_argument("-c", help="C mode",
parser = argparse.ArgumentParser(epilog=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument("idir", help="input directory path or file name")
parser.add_argument("ofile", help="output file name")
parser.add_argument("-m", "--module", help="Module load path name",
default="")
parser.add_argument("-t", "--tag", help="filter components with matching tag", default="")
parser.add_argument("-c", help="C mode, if not set Python will be used",
action="store_true")
parser.add_argument("-r", "--recursive", help="Traverse sub-directories",
action="store_true")
parser.add_argument("-m", "--module_path", help="Module load path name",
default="")
parser.add_argument("-s", "--parse_all",
help="Try to parse non DAliuGE compliant modules",
help="Try to parse non DAliuGE compliant functions and methods",
action="store_true")
parser.add_argument("-v", "--verbose", help="increase output verbosity",
action="store_true")
args = parser.parse_args()
if args.verbose:
logging.getLogger().setLevel(logging.DEBUG)
logging.debug("DEBUG logging switched on")
if args.recursive:
DOXYGEN_SETTINGS.append(("RECURSIVE", "YES"))
logging.info("Recursive flag ON")
else:
DOXYGEN_SETTINGS.append(("RECURSIVE", "NO"))
logging.info("Recursive flag OFF")
language = Language.C if args.c else Language.PYTHON
return args.idir, args.tag, args.ofile, args.parse_all, args.module_path, language
return args.idir, args.tag, args.ofile, args.parse_all, args.module, language

def check_environment_variables():
required_environment_variables = ["PROJECT_NAME", "PROJECT_VERSION", "GIT_REPO"]
Expand Down

0 comments on commit 66dd9be

Please sign in to comment.