From 812de035824c6fec687592f93f7bbb5a0651f828 Mon Sep 17 00:00:00 2001 From: Laurent Peuch <cortex@worlddomination.be> Date: Fri, 20 Jan 2017 11:34:55 +0100 Subject: [PATCH 01/12] [mod] make code more lisible --- list_builder.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/list_builder.py b/list_builder.py index 55740fb..e0ff66f 100755 --- a/list_builder.py +++ b/list_builder.py @@ -85,7 +85,10 @@ for app, info in apps_list.items(): manifest = {} timestamp = None - if already_built_file.get(app, {}).get("git", {}).get("revision", None) == app_rev and already_built_file.get(app, {}).get("git", {}).get("url") == app_url: + revision = already_built_file.get(app, {}).get("git", {}).get("revision", None) + url = already_built_file.get(app, {}).get("git", {}).get("url") + + if revision == app_rev and url == app_url: print("%s[%s] is already up to date in target output, ignore" % (app, app_rev)) result_dict[app] = already_built_file[app] continue From 0ddb0235169108bde488a1f2edcf9ca459214a78 Mon Sep 17 00:00:00 2001 From: Laurent Peuch <cortex@worlddomination.be> Date: Fri, 20 Jan 2017 11:35:49 +0100 Subject: [PATCH 02/12] [mod] pep8 --- list_builder.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/list_builder.py b/list_builder.py index e0ff66f..69fbedf 100755 --- a/list_builder.py +++ b/list_builder.py @@ -11,7 +11,7 @@ import requests from dateutil.parser import parse -## Regular expression patterns +# Regular expression patterns """GitHub repository URL.""" re_github_repo = re.compile( @@ -24,7 +24,7 @@ re_commit_author = re.compile( ) -## Helpers +# Helpers def fail(msg, retcode=1): """Show failure message and exit.""" @@ -32,7 +32,7 @@ def fail(msg, retcode=1): sys.exit(retcode) -## Main +# Main # Create argument parser parser = argparse.ArgumentParser(description='Process YunoHost application list.') @@ -93,14 +93,14 @@ for app, info in apps_list.items(): result_dict[app] = already_built_file[app] continue - ## Hosted on GitHub + # Hosted on GitHub github_repo = re_github_repo.match(app_url) if github_repo: owner = github_repo.group('owner') repo = github_repo.group('repo') raw_url = 'https://raw.githubusercontent.com/%s/%s/%s/manifest.json' % ( - owner, repo, app_rev + owner, repo, app_rev ) try: # Retrieve and load manifest @@ -115,7 +115,7 @@ for app, info in apps_list.items(): continue api_url = 'https://api.github.com/repos/%s/%s/commits/%s' % ( - owner, repo, app_rev + owner, repo, app_rev ) try: # Retrieve last commit information @@ -131,7 +131,8 @@ for app, info in apps_list.items(): else: commit_date = parse(info2['commit']['author']['date']) 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'): raw_url = '%s/raw/%s/manifest.json' % (app_url[:-4], app_rev) try: @@ -147,7 +148,7 @@ for app, info in apps_list.items(): continue obj_url = '%s/objects/%s/%s' % ( - app_url, app_rev[0:2], app_rev[2:] + app_url, app_rev[0:2], app_rev[2:] ) try: # Retrieve last commit information @@ -202,7 +203,7 @@ for app, info in apps_list.items(): continue # 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)) print("\nDone! Written in %s" % args.output) From 018cb777062ee248bb1841baf5a03a4b92bca34e Mon Sep 17 00:00:00 2001 From: Laurent Peuch <cortex@worlddomination.be> Date: Fri, 20 Jan 2017 11:45:43 +0100 Subject: [PATCH 03/12] [mod] make variable more readable --- list_builder.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/list_builder.py b/list_builder.py index 69fbedf..ad282c1 100755 --- a/list_builder.py +++ b/list_builder.py @@ -85,10 +85,10 @@ for app, info in apps_list.items(): manifest = {} timestamp = None - revision = already_built_file.get(app, {}).get("git", {}).get("revision", None) - url = already_built_file.get(app, {}).get("git", {}).get("url") + previous_rev = already_built_file.get(app, {}).get("git", {}).get("revision", None) + previous_url = already_built_file.get(app, {}).get("git", {}).get("url") - if revision == app_rev and url == app_url: + if previous_rev == app_rev and previous_url == app_url: print("%s[%s] is already up to date in target output, ignore" % (app, app_rev)) result_dict[app] = already_built_file[app] continue From 6c9173ff634a442e820d6ee5e126b4b3a6d56a67 Mon Sep 17 00:00:00 2001 From: Laurent Peuch <cortex@worlddomination.be> Date: Fri, 20 Jan 2017 11:52:04 +0100 Subject: [PATCH 04/12] [fix] modify state of a cached app if it has changed --- list_builder.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/list_builder.py b/list_builder.py index ad282c1..7c30316 100755 --- a/list_builder.py +++ b/list_builder.py @@ -81,6 +81,9 @@ for app, info in apps_list.items(): # Store usefull values app_url = info['url'] app_rev = info['revision'] + app_state = info["state"] + + previous_state = already_built_file.get(app, {}).get("state", {}) manifest = {} timestamp = None @@ -91,6 +94,9 @@ for app, info in apps_list.items(): if previous_rev == app_rev and previous_url == app_url: print("%s[%s] is already up to date in target output, ignore" % (app, app_rev)) result_dict[app] = already_built_file[app] + if previous_state != app_state: + result_dict[app]["state"] = app_state + print("... but has changed of state, updating it from '%s' to '%s'" % (previous_state, app_state)) continue # Hosted on GitHub From 255db43aba4cf34cab02e4f68e6773bbc0ba18ac Mon Sep 17 00:00:00 2001 From: Maniack Crudelis <maniackcrudelis@users.noreply.github.com> Date: Thu, 12 Jan 2017 13:04:09 +0100 Subject: [PATCH 05/12] =?UTF-8?q?Int=C3=A8gre=20le=20level=20du=20json=20a?= =?UTF-8?q?u=20-build.json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- list_builder.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/list_builder.py b/list_builder.py index 7c30316..e9e5a46 100755 --- a/list_builder.py +++ b/list_builder.py @@ -202,7 +202,8 @@ for app, info in apps_list.items(): }, 'lastUpdate': timestamp, 'manifest': manifest, - 'state': info['state'] + 'state': info['state'], + 'level': info['level'] } except KeyError as e: print("-> Error: invalid app info or manifest, %s" % e) From 3c8140ca2217a4244faba8cca049b90fb2b1389c Mon Sep 17 00:00:00 2001 From: Laurent Peuch <cortex@worlddomination.be> Date: Mon, 30 Jan 2017 23:52:05 +0100 Subject: [PATCH 06/12] [enh] more robust code --- list_builder.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/list_builder.py b/list_builder.py index e9e5a46..d7640f2 100755 --- a/list_builder.py +++ b/list_builder.py @@ -203,7 +203,7 @@ for app, info in apps_list.items(): 'lastUpdate': timestamp, 'manifest': manifest, 'state': info['state'], - 'level': info['level'] + 'level': info.get('level', '?') } except KeyError as e: print("-> Error: invalid app info or manifest, %s" % e) From c26c08a9fd0c11f636ac5a9adfe684f1dd315e53 Mon Sep 17 00:00:00 2001 From: Laurent Peuch <cortex@worlddomination.be> Date: Tue, 31 Jan 2017 00:04:52 +0100 Subject: [PATCH 07/12] [enh] handle level modification in caching --- list_builder.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/list_builder.py b/list_builder.py index d7640f2..4b6db05 100755 --- a/list_builder.py +++ b/list_builder.py @@ -82,6 +82,7 @@ for app, info in apps_list.items(): app_url = info['url'] app_rev = info['revision'] app_state = info["state"] + app_level = info.get("level") previous_state = already_built_file.get(app, {}).get("state", {}) @@ -90,6 +91,7 @@ for app, info in apps_list.items(): previous_rev = already_built_file.get(app, {}).get("git", {}).get("revision", None) previous_url = already_built_file.get(app, {}).get("git", {}).get("url") + previous_level = already_built_file.get(app, {}).get("level") if previous_rev == app_rev and previous_url == app_url: print("%s[%s] is already up to date in target output, ignore" % (app, app_rev)) @@ -97,6 +99,9 @@ for app, info in apps_list.items(): if previous_state != app_state: result_dict[app]["state"] = app_state print("... but has changed of state, updating it from '%s' to '%s'" % (previous_state, app_state)) + if previous_level != app_level or app_level is None: + result_dict[app]["level"] = app_level + print("... but has changed of level, updating it from '%s' to '%s'" % (previous_level, app_level)) continue # Hosted on GitHub From 772d59014d692072601e28d4ed306df2237043cf Mon Sep 17 00:00:00 2001 From: Laurent Peuch <cortex@worlddomination.be> Date: Fri, 24 Feb 2017 09:26:37 +0100 Subject: [PATCH 08/12] This procedure is not valid anymore --- README.md | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/README.md b/README.md index 8269811..5faf4bc 100644 --- a/README.md +++ b/README.md @@ -54,26 +54,6 @@ App example addition: } ``` -#### How to propose your app to be integrated in the official applications list - -Here is the procedure to request that your app will be part of the list of official applications of YunoHost: - -* before everything, having you application joining the list of official applications will make you a maintainer of it and will requires you to ensure this position or to find someone else to do it in the future -* your app must be tested on several architectures (32/64 bits, ARM) or depends on cross-platform systems -* you must be subscribed to the [apps official mailing list](https://list.yunohost.org/cgi-bin/mailman/listinfo/apps) since this is the way that we communicate to apps maintainers -* your application package must have the following scripts: - * a install script, obviously - * a remove script - * an upgrade script if needed - * a backup/restore script if your application stores data -* your application must be installable on a custom path (`domain.tld/custom_path/`) in addition to the root path (`some.domain.tld/`) -* if relevant, your application must be integrated with YunoHost SSO -* the application you have packaged must be free software, as in free speech -* once all those requirements are fulfilled, fork this repository, add your application to the official.json list with the status "validated" following the documentation above, then open a pull request -* we will then start a reviewing process and we will work together to bring your application to a state where we can hopefully include it to the official applications list :) - -Since our documentation regarding all those part is not as complete as it should be, don't hesitate to ask questions on the [apps mailing list](https://list.yunohost.org/cgi-bin/mailman/listinfo/apps) regarding those points. - #### Helper script You can use the <code>add_or_update.py</code> python script to add or update From 7b0a59f7c9804254ee6e8af6359804ccd04f83d5 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin <alex.aubin@mailoo.org> Date: Wed, 29 Mar 2017 22:40:03 +0200 Subject: [PATCH 09/12] Fixing weird image display bug in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5faf4bc..425f251 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # YunoHost apps directory <img src="https://yunohost.org/logo.png" width=80> +      - <img src="https://yunohost.org/images/freshrss_logo.png" width=60> <img src="https://yunohost.org/images/Icons_mumble.svg" width=60> <img src="https://yunohost.org/images/Lutim_small.png" width=50> From f8fbe69032de946daf5655692692aa4ff4297b52 Mon Sep 17 00:00:00 2001 From: Laurent Peuch <cortex@worlddomination.be> Date: Fri, 31 Mar 2017 23:32:39 +0200 Subject: [PATCH 10/12] [enh] include translation in manifest when rebuilding it --- list_builder.py | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/list_builder.py b/list_builder.py index 4b6db05..a32bebc 100755 --- a/list_builder.py +++ b/list_builder.py @@ -32,6 +32,31 @@ def fail(msg, retcode=1): sys.exit(retcode) +def include_translations_in_manifest(app_name, manifest): + for i in os.listdir("locales"): + if not i.endswith("json"): + continue + + if i == "en.json": + continue + + current_lang = i.split(".")[0] + translations = json.load(open(os.path.join("locales", i), "r")) + + key = "%s_manifest_description" % app_name + if key in translations and translations[key]: + manifest["description"][current_lang] = translations[key] + + for category, questions in manifest["arguments"].items(): + for question in questions: + key = "%s_manifest_arguments_%s_%s" % (app_name, category, question["name"]) + if key in translations and translations[key]: + print current_lang, key + question["ask"][current_lang] = translations[key] + + return manifest + + # Main # Create argument parser @@ -102,6 +127,10 @@ for app, info in apps_list.items(): if previous_level != app_level or app_level is None: result_dict[app]["level"] = app_level print("... but has changed of level, updating it from '%s' to '%s'" % (previous_level, app_level)) + + print "update translations but don't download anything" + result_dict[app]['manifest'] = include_translations_in_manifest(app, result_dict[app]['manifest']) + continue # Hosted on GitHub @@ -206,7 +235,7 @@ for app, info in apps_list.items(): 'url': app_url }, 'lastUpdate': timestamp, - 'manifest': manifest, + 'manifest': include_translations_in_manifest(manifest['id'], manifest), 'state': info['state'], 'level': info.get('level', '?') } From b1757b72a20dddaee254c8baca78c6bd743aa414 Mon Sep 17 00:00:00 2001 From: Laurent Peuch <cortex@worlddomination.be> Date: Thu, 6 Apr 2017 15:00:58 +0200 Subject: [PATCH 11/12] [enh] help keys are now translatables --- list_builder.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/list_builder.py b/list_builder.py index a32bebc..47c4b38 100755 --- a/list_builder.py +++ b/list_builder.py @@ -51,9 +51,14 @@ def include_translations_in_manifest(app_name, manifest): for question in questions: key = "%s_manifest_arguments_%s_%s" % (app_name, category, question["name"]) if key in translations and translations[key]: - print current_lang, key + print "[ask]", current_lang, key question["ask"][current_lang] = translations[key] + key = "%s_manifest_arguments_%s_help_%s" % (app_name, category, question["name"]) + if key in translations and translations[key]: + print "[help]", current_lang, key + question["help"][current_lang] = translations[key] + return manifest From 76722ffeeebe464b86673e678f103ba2ad39fc92 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin <alex.aubin@mailoo.org> Date: Mon, 4 Sep 2017 19:41:26 +0200 Subject: [PATCH 12/12] Remove dirty screenshot from README ? (#328) * Delete screenshot.jpg * Remove screenshot in README --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 425f251..8f07e7a 100644 --- a/README.md +++ b/README.md @@ -35,8 +35,6 @@ sudo yunohost app fetchlist -n community -u https://yunohost.org/community.json ## Contributing - - #### How to add your app to the community list * Fork and edit the [community list](https://github.com/YunoHost/apps/tree/master/community.json)