mirror of
https://github.com/YunoHost/apps.git
synced 2024-09-03 20:06:07 +02:00
[mod] pep8
This commit is contained in:
parent
ce23a229b4
commit
e73958e53b
1 changed files with 10 additions and 9 deletions
|
@ -11,7 +11,7 @@ import requests
|
||||||
from dateutil.parser import parse
|
from dateutil.parser import parse
|
||||||
|
|
||||||
|
|
||||||
## Regular expression patterns
|
# Regular expression patterns
|
||||||
|
|
||||||
"""GitHub repository URL."""
|
"""GitHub repository URL."""
|
||||||
re_github_repo = re.compile(
|
re_github_repo = re.compile(
|
||||||
|
@ -24,7 +24,7 @@ re_commit_author = re.compile(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
## Helpers
|
# Helpers
|
||||||
|
|
||||||
def fail(msg, retcode=1):
|
def fail(msg, retcode=1):
|
||||||
"""Show failure message and exit."""
|
"""Show failure message and exit."""
|
||||||
|
@ -32,7 +32,7 @@ def fail(msg, retcode=1):
|
||||||
sys.exit(retcode)
|
sys.exit(retcode)
|
||||||
|
|
||||||
|
|
||||||
## Main
|
# Main
|
||||||
|
|
||||||
# Create argument parser
|
# Create argument parser
|
||||||
parser = argparse.ArgumentParser(description='Process YunoHost application list.')
|
parser = argparse.ArgumentParser(description='Process YunoHost application list.')
|
||||||
|
@ -93,7 +93,7 @@ for app, info in apps_list.items():
|
||||||
result_dict[app] = already_built_file[app]
|
result_dict[app] = already_built_file[app]
|
||||||
continue
|
continue
|
||||||
|
|
||||||
## Hosted on GitHub
|
# Hosted on GitHub
|
||||||
github_repo = re_github_repo.match(app_url)
|
github_repo = re_github_repo.match(app_url)
|
||||||
if github_repo:
|
if github_repo:
|
||||||
owner = github_repo.group('owner')
|
owner = github_repo.group('owner')
|
||||||
|
@ -131,7 +131,8 @@ for app, info in apps_list.items():
|
||||||
else:
|
else:
|
||||||
commit_date = parse(info2['commit']['author']['date'])
|
commit_date = parse(info2['commit']['author']['date'])
|
||||||
timestamp = int(time.mktime(commit_date.timetuple()))
|
timestamp = int(time.mktime(commit_date.timetuple()))
|
||||||
## Git repository with HTTP/HTTPS (Gogs, GitLab, ...)
|
|
||||||
|
# Git repository with HTTP/HTTPS (Gogs, GitLab, ...)
|
||||||
elif app_url.startswith('http') and app_url.endswith('.git'):
|
elif app_url.startswith('http') and app_url.endswith('.git'):
|
||||||
raw_url = '%s/raw/%s/manifest.json' % (app_url[:-4], app_rev)
|
raw_url = '%s/raw/%s/manifest.json' % (app_url[:-4], app_rev)
|
||||||
try:
|
try:
|
||||||
|
@ -202,7 +203,7 @@ for app, info in apps_list.items():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Write resulting file
|
# Write resulting file
|
||||||
with open(args.output , 'w') as f:
|
with open(args.output, 'w') as f:
|
||||||
f.write(json.dumps(result_dict, sort_keys=True))
|
f.write(json.dumps(result_dict, sort_keys=True))
|
||||||
|
|
||||||
print("\nDone! Written in %s" % args.output)
|
print("\nDone! Written in %s" % args.output)
|
||||||
|
|
Loading…
Add table
Reference in a new issue