Skip to content

Commit

Permalink
cleanup update scripts, run isort
Browse files Browse the repository at this point in the history
  • Loading branch information
Félix Piédallu committed Sep 15, 2023
1 parent f46875a commit e15a2e4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
19 changes: 7 additions & 12 deletions .github/workflows/update_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -87,21 +86,17 @@ 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")


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"]:
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@
import hashlib
import logging
import os
from subprocess import run, PIPE
import textwrap
from typing import List, Tuple, Any, Optional
import requests
from packaging import version
from subprocess import PIPE, run
from typing import Any, List, Optional, Tuple

import requests
import tomlkit

from packaging import version

logging.getLogger().setLevel(logging.INFO)

Expand Down

0 comments on commit e15a2e4

Please sign in to comment.