Skip to content

Commit

Permalink
Use FlatpakGenerator.build_module_as_[yaml_]str in main.
Browse files Browse the repository at this point in the history
These methods implement formatting, so why duplicate that code. Fixes #45.

* req2flatpak.py (main)
  • Loading branch information
real-yfprojects committed Mar 11, 2023
1 parent 9bb6055 commit de6e865
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions req2flatpak.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,14 +808,16 @@ def main(): # pylint: disable=too-many-branches
}

# generate flatpak-builder build module
build_module = FlatpakGenerator.build_module(requirements, downloads)

if options.yaml:
yaml.dump(build_module, output_stream, default_flow_style=False)
parser.exit()

# write output
json.dump(build_module, output_stream, indent=4)
# write yaml
output_stream.write(
FlatpakGenerator.build_module_as_yaml_str(requirements, downloads)
)
else:
# write json
output_stream.write(
FlatpakGenerator.build_module_as_str(requirements, downloads)
)


if __name__ == "__main__":
Expand Down

0 comments on commit de6e865

Please sign in to comment.