From fb3c3b2a3531628a1d484955da4e107190903682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 18 Mar 2024 22:13:42 +0100 Subject: [PATCH] store: Use tomlkit when create pull requests to add apps to wishlist This keeps the comments such as the toml schema url --- store/app.py | 5 +++-- store/requirements.txt | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/store/app.py b/store/app.py index 812d2b41..a7720ee2 100644 --- a/store/app.py +++ b/store/app.py @@ -1,6 +1,7 @@ import time import re import toml +import tomlkit import base64 import hashlib import hmac @@ -331,7 +332,7 @@ def add_to_wishlist(): ) current_wishlist_sha = current_wishlist_rawtoml.sha current_wishlist_rawtoml = current_wishlist_rawtoml.decoded_content.decode() - new_wishlist = toml.loads(current_wishlist_rawtoml) + new_wishlist = tomlkit.loads(current_wishlist_rawtoml) if slug in new_wishlist: url = f"https://apps.yunohost.org/wishlist?search={slug}" @@ -356,7 +357,7 @@ def add_to_wishlist(): } new_wishlist = dict(sorted(new_wishlist.items())) - new_wishlist_rawtoml = toml.dumps(new_wishlist) + new_wishlist_rawtoml = tomlkit.dumps(new_wishlist) new_branch = f"add-to-wishlist-{slug}" try: # Get the commit base for the new branch, and create it diff --git a/store/requirements.txt b/store/requirements.txt index d572e041..82089229 100644 --- a/store/requirements.txt +++ b/store/requirements.txt @@ -2,6 +2,7 @@ Flask==2.3.2 python-slugify PyGithub toml +tomlkit pycmarkgfm gunicorn emoji