Use pathlib.Path
This commit is contained in:
parent
b5af26a872
commit
9ed2f8d017
1 changed files with 11 additions and 11 deletions
|
@ -4,15 +4,21 @@ import argparse
|
||||||
import glob
|
import glob
|
||||||
import hashlib
|
import hashlib
|
||||||
import os
|
import os
|
||||||
|
import subprocess
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
from pathlib import Path
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
import toml
|
import toml
|
||||||
from rest_api import GithubAPI, GitlabAPI, GiteaForgejoAPI, RefType
|
from rest_api import GithubAPI, GitlabAPI, GiteaForgejoAPI, RefType
|
||||||
|
|
||||||
|
REPO_APPS_ROOT = Path(subprocess.check_output([
|
||||||
|
"git", "-C", Path(__file__).parent, "rev-parse", "--show-toplevel"]).decode("utf-8").strip())
|
||||||
|
|
||||||
|
|
||||||
STRATEGIES = [
|
STRATEGIES = [
|
||||||
"latest_github_release",
|
"latest_github_release",
|
||||||
"latest_github_tag",
|
"latest_github_tag",
|
||||||
|
@ -468,7 +474,7 @@ def paste_on_haste(data):
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("app_dir", nargs="?", type=str)
|
parser.add_argument("app_dir", nargs="?", type=Path)
|
||||||
parser.add_argument("--commit-and-create-PR", action="store_true")
|
parser.add_argument("--commit-and-create-PR", action="store_true")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
@ -476,17 +482,11 @@ def main() -> None:
|
||||||
dry_run = args.commit_and_create_PR
|
dry_run = args.commit_and_create_PR
|
||||||
|
|
||||||
if args.app_dir:
|
if args.app_dir:
|
||||||
AppAutoUpdater(args.app_dir, app_id_is_local_app_dir=True).run()
|
AppAutoUpdater(str(args.app_dir), app_id_is_local_app_dir=True).run()
|
||||||
else:
|
else:
|
||||||
GITHUB_LOGIN = (
|
GITHUB_LOGIN = (REPO_APPS_ROOT / ".github_login").open("r", encoding="utf-8").read().strip()
|
||||||
open(os.path.dirname(__file__) + "/../../.github_login").read().strip()
|
GITHUB_TOKEN = (REPO_APPS_ROOT / ".github_token").open("r", encoding="utf-8").read().strip()
|
||||||
)
|
GITHUB_EMAIL = (REPO_APPS_ROOT / ".github_email").open("r", encoding="utf-8").read().strip()
|
||||||
GITHUB_TOKEN = (
|
|
||||||
open(os.path.dirname(__file__) + "/../../.github_token").read().strip()
|
|
||||||
)
|
|
||||||
GITHUB_EMAIL = (
|
|
||||||
open(os.path.dirname(__file__) + "/../../.github_email").read().strip()
|
|
||||||
)
|
|
||||||
|
|
||||||
from github import Github, InputGitAuthor
|
from github import Github, InputGitAuthor
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue