mirror of
https://github.com/YunoHost-Apps/mediawiki_ynh.git
synced 2024-09-03 19:46:05 +02:00
cleanup update scripts, run isort
This commit is contained in:
parent
f46875a9d5
commit
e15a2e41e8
2 changed files with 11 additions and 17 deletions
19
.github/workflows/update_extensions.py
vendored
19
.github/workflows/update_extensions.py
vendored
|
@ -3,14 +3,13 @@
|
|||
Download extensions for the current mediawiki version, and update the conf files.
|
||||
"""
|
||||
|
||||
from typing import List, Optional, Any
|
||||
import hashlib
|
||||
import urllib
|
||||
import datetime
|
||||
from html.parser import HTMLParser
|
||||
import hashlib
|
||||
from typing import Any, List, Optional
|
||||
|
||||
import requests
|
||||
import tomlkit
|
||||
from packaging import version
|
||||
import requests
|
||||
|
||||
GITHUB_API_URL = "https://api.github.com/repos"
|
||||
|
||||
|
@ -87,13 +86,9 @@ def get_last_commit_of(repo: str, branch: str) -> str:
|
|||
return commit["sha"]
|
||||
|
||||
|
||||
def timestamp_of_commit(repo: str, sha: str) -> int:
|
||||
def timestamp_of_commit(repo: str, sha: str) -> datetime.datetime:
|
||||
commit = github_get(f"{repo}/commits/{sha}")
|
||||
try:
|
||||
date = commit["commit"]["author"]["date"]
|
||||
except :
|
||||
print(date)
|
||||
raise
|
||||
date = commit["commit"]["author"]["date"]
|
||||
return datetime.datetime.strptime(date, "%Y-%m-%dT%H:%M:%SZ")
|
||||
|
||||
|
||||
|
@ -101,7 +96,7 @@ def main():
|
|||
print('Updating extensions source files...')
|
||||
with open("manifest.toml", "r", encoding="utf-8") as file:
|
||||
manifest = tomlkit.loads(file.read())
|
||||
mediawiki_version = version.Version(manifest["version"].value.split("~")[0])
|
||||
# mediawiki_version = version.Version(manifest["version"].value.split("~")[0])
|
||||
|
||||
for name, descr in manifest["resources"]["sources"].items():
|
||||
if "extension" not in descr["url"]:
|
||||
|
|
9
.github/workflows/updater.py
vendored
9
.github/workflows/updater.py
vendored
|
@ -12,14 +12,13 @@ You need to enable the action by removing `if ${{ false }}` in updater.yml!
|
|||
import hashlib
|
||||
import logging
|
||||
import os
|
||||
from subprocess import run, PIPE
|
||||
import textwrap
|
||||
from typing import List, Tuple, Any, Optional
|
||||
from subprocess import PIPE, run
|
||||
from typing import Any, List, Optional, Tuple
|
||||
|
||||
import requests
|
||||
from packaging import version
|
||||
|
||||
import tomlkit
|
||||
|
||||
from packaging import version
|
||||
|
||||
logging.getLogger().setLevel(logging.INFO)
|
||||
|
||||
|
|
Loading…
Reference in a new issue