diff --git a/list_builder.py b/list_builder.py index 996dd05b..2b12fd21 100755 --- a/list_builder.py +++ b/list_builder.py @@ -1,20 +1,22 @@ #!/usr/bin/python3 import copy -import sys +import json import os import re -import json -from shutil import which -import toml import subprocess +import sys import time -from typing import TextIO, Generator, Any +from collections import OrderedDict from pathlib import Path +from shutil import which +from typing import Any, Generator, TextIO + +import toml from git import Repo -from collections import OrderedDict -from tools.packaging_v2.convert_v1_manifest_to_v2_for_catalog import convert_v1_manifest_to_v2_for_catalog +from tools.packaging_v2.convert_v1_manifest_to_v2_for_catalog import \ + convert_v1_manifest_to_v2_for_catalog now = time.time() diff --git a/tools/README-generator/__init__.py b/tools/README-generator/__init__.py index e69de29b..e5a0d9b4 100644 --- a/tools/README-generator/__init__.py +++ b/tools/README-generator/__init__.py @@ -0,0 +1 @@ +#!/usr/bin/env python3 diff --git a/tools/README-generator/make_readme.py b/tools/README-generator/make_readme.py index 5f004ea0..d71f9733 100755 --- a/tools/README-generator/make_readme.py +++ b/tools/README-generator/make_readme.py @@ -2,12 +2,13 @@ import argparse import json -import toml import os from pathlib import Path +import toml from jinja2 import Environment, FileSystemLoader + def value_for_lang(values, lang): if not isinstance(values, dict): return values diff --git a/tools/README-generator/webhook.py b/tools/README-generator/webhook.py index af220d8b..7a76eab0 100755 --- a/tools/README-generator/webhook.py +++ b/tools/README-generator/webhook.py @@ -1,15 +1,16 @@ -import os -import hmac -import shlex -import hashlib +#!/usr/bin/env python3 + import asyncio +import hashlib +import hmac +import os +import shlex import tempfile +from make_readme import generate_READMEs from sanic import Sanic, response from sanic.response import text -from make_readme import generate_READMEs - app = Sanic(__name__) github_webhook_secret = open("github_webhook_secret", "r").read().strip() diff --git a/tools/__init__.py b/tools/__init__.py index e69de29b..e5a0d9b4 100644 --- a/tools/__init__.py +++ b/tools/__init__.py @@ -0,0 +1 @@ +#!/usr/bin/env python3 diff --git a/tools/autopatches/autopatch.py b/tools/autopatches/autopatch.py index 746ee51a..6f52d309 100755 --- a/tools/autopatches/autopatch.py +++ b/tools/autopatches/autopatch.py @@ -1,9 +1,11 @@ #!/usr/bin/python3 + import json -import sys -import requests import os import subprocess +import sys + +import requests catalog = requests.get("https://raw.githubusercontent.com/YunoHost/apps/master/apps.json").json() diff --git a/tools/autopatches/patches/add-cpe/patch.sh b/tools/autopatches/patches/add-cpe/patch.sh index 02a697ce..2b6b2d6c 100644 --- a/tools/autopatches/patches/add-cpe/patch.sh +++ b/tools/autopatches/patches/add-cpe/patch.sh @@ -1,7 +1,8 @@ #!/usr/bin/python3 -import json import csv +import json + def find_cpe(app_id): with open("../../patches/add-cpe/cpe.csv", newline='') as f: diff --git a/tools/autoupdate_app_sources/autoupdate_app_sources.py b/tools/autoupdate_app_sources/autoupdate_app_sources.py index dfd15b71..b42dc781 100644 --- a/tools/autoupdate_app_sources/autoupdate_app_sources.py +++ b/tools/autoupdate_app_sources/autoupdate_app_sources.py @@ -1,13 +1,15 @@ -import time +#!/usr/bin/env python3 + +import glob import hashlib +import os import re import sys -import requests -import toml -import os -import glob +import time from datetime import datetime +import requests +import toml from rest_api import GithubAPI, GitlabAPI, RefType STRATEGIES = [ diff --git a/tools/autoupdate_app_sources/rest_api.py b/tools/autoupdate_app_sources/rest_api.py index a76821a7..ccc6b4d1 100644 --- a/tools/autoupdate_app_sources/rest_api.py +++ b/tools/autoupdate_app_sources/rest_api.py @@ -1,8 +1,11 @@ -from enum import Enum +#!/usr/bin/env python3 + import re -import requests +from enum import Enum from typing import List +import requests + class RefType(Enum): tags = 1 diff --git a/tools/autoupdater-upgrader/autoupdater-upgrader.py b/tools/autoupdater-upgrader/autoupdater-upgrader.py index 7252042c..3e9c1a26 100755 --- a/tools/autoupdater-upgrader/autoupdater-upgrader.py +++ b/tools/autoupdater-upgrader/autoupdater-upgrader.py @@ -1,14 +1,17 @@ -#!venv/bin/python3 +#!/usr/bin/env python3 -import sys, os, time -import urllib.request, json +import json +import os import re +import sys +import time +import urllib.request -from github import Github import github - +from github import Github # Debug from rich.traceback import install + install(width=150, show_locals=True, locals_max_length=None, locals_max_string=None) ##### diff --git a/tools/bot-repo-cleanup/cleanup.py b/tools/bot-repo-cleanup/cleanup.py index f2275c61..2a9fa982 100644 --- a/tools/bot-repo-cleanup/cleanup.py +++ b/tools/bot-repo-cleanup/cleanup.py @@ -1,4 +1,4 @@ -#!venv/bin/python3 +#!/usr/bin/env python3 # Obtained with `pip install PyGithub`, better within a venv from github import Github diff --git a/tools/catalog_linter.py b/tools/catalog_linter.py index 4c383a97..6ce7ef98 100755 --- a/tools/catalog_linter.py +++ b/tools/catalog_linter.py @@ -2,10 +2,10 @@ import json import sys +from difflib import SequenceMatcher from functools import cache from pathlib import Path from typing import Any, Dict, Generator, List, Tuple -from difflib import SequenceMatcher import jsonschema import toml diff --git a/tools/packaging_v2/__init__.py b/tools/packaging_v2/__init__.py index e69de29b..e5a0d9b4 100644 --- a/tools/packaging_v2/__init__.py +++ b/tools/packaging_v2/__init__.py @@ -0,0 +1 @@ +#!/usr/bin/env python3 diff --git a/tools/packaging_v2/convert_app_to_packaging_v2.py b/tools/packaging_v2/convert_app_to_packaging_v2.py index 7887cdb6..2fa166c9 100644 --- a/tools/packaging_v2/convert_app_to_packaging_v2.py +++ b/tools/packaging_v2/convert_app_to_packaging_v2.py @@ -1,7 +1,9 @@ +#!/usr/bin/env python3 + import argparse +import json import os import re -import json import subprocess from glob import glob @@ -226,7 +228,8 @@ def _convert_v1_manifest_to_v2(app_path): def _dump_v2_manifest_as_toml(manifest): import re - from tomlkit import document, nl, table, dumps, comment + + from tomlkit import comment, document, dumps, nl, table toml_manifest = document() toml_manifest.add("packaging_format", 2) diff --git a/tools/packaging_v2/convert_v1_manifest_to_v2_for_catalog.py b/tools/packaging_v2/convert_v1_manifest_to_v2_for_catalog.py index 0130c293..9fb37906 100644 --- a/tools/packaging_v2/convert_v1_manifest_to_v2_for_catalog.py +++ b/tools/packaging_v2/convert_v1_manifest_to_v2_for_catalog.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + import copy diff --git a/tools/update_app_levels/update_app_levels.py b/tools/update_app_levels/update_app_levels.py index b8df4a14..221d4f21 100644 --- a/tools/update_app_levels/update_app_levels.py +++ b/tools/update_app_levels/update_app_levels.py @@ -1,12 +1,15 @@ -import time -import toml -import requests -import tempfile +#!/usr/bin/env python3 + +import json import os import sys -import json +import tempfile +import time from collections import OrderedDict +import requests +import toml + token = open(os.path.dirname(__file__) + "/../../.github_token").read().strip() tmpdir = tempfile.mkdtemp(prefix="update_app_levels_")