Skip to content

Commit

Permalink
Add ifexgen_dbus command and required dependencies
Browse files Browse the repository at this point in the history
l. ifexgen_dbus is a frontend / executable command, defined in the
package information (setup.py) and which calls the actual code.  I just
followed the same pattern as for ifexgen.

2. Rename D-Bus (correct spelling) to DBus (wrong spelling)
   because...python reasons :(

Signed-off-by: Gunnar Andersson <gunnar_dev@[email protected]>
  • Loading branch information
Gunnar Andersson committed Aug 15, 2023
1 parent 54ff60a commit 54cb2f9
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
23 changes: 23 additions & 0 deletions ifex/scripts/generator_dbus.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# SPDX-FileCopyrightText: Copyright (c) 2023 MBition GmbH.
# SPDX-License-Identifier: MPL-2.0

# User-invocation script for D-Bus generation
# (small wrapper around the main implementation)

from ifex.model.ifex_parser import get_ast_from_yaml_file
from ifex.generators.DBus import dbus_generator
import argparse, dacite

def ifex_dbus_generator_run():
parser = argparse.ArgumentParser(description='Runs IFEX to D-Bus XML translator.')
parser.add_argument('input', metavar='ifex-input-file', type=str, help='path to input IFEX (YAML) file')

try:
args = parser.parse_args()
dbus_generator.main_generate(args.input)

except dacite.UnexpectedDataError as e:
print(f"ERROR: Read error resulting from {filename}: {e}")

if __name__ == "__main__":
ifex_dbus_generator_run()
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
attrs==22.1.0
iniconfig==1.1.1
Jinja2==3.1.2
lxml
MarkupSafe==2.1.1
packaging==21.3
pluggy==1.0.0
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ def get_template_files():
entry_points='''
[console_scripts]
ifexgen=ifex.scripts.generator:ifex_generator_run
ifexgen_dbus=ifex.scripts.generator_dbus:ifex_dbus_generator_run
'''
)

0 comments on commit 54cb2f9

Please sign in to comment.