diff options
author | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2019-12-22 17:57:56 +0100 |
---|---|---|
committer | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2019-12-22 17:58:40 +0100 |
commit | 2dc3389718594238e71f8e8f3271cf0008522be4 (patch) | |
tree | 33de4aafd0cae36ba06b596fddd47ce1e65be47a | |
parent | 36680b42aadcd024995ad0ae40a03ad777e9ac07 (diff) | |
download | vendor_replicant-scripts-2dc3389718594238e71f8e8f3271cf0008522be4.tar.gz vendor_replicant-scripts-2dc3389718594238e71f8e8f3271cf0008522be4.tar.bz2 vendor_replicant-scripts-2dc3389718594238e71f8e8f3271cf0008522be4.zip |
find_lineageos_devices.py: Handle arbitrary repository paths
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-rw-r--r-- | research/README | 4 | ||||
-rwxr-xr-x | research/find_lineageos_devices.py | 28 |
2 files changed, 21 insertions, 11 deletions
diff --git a/research/README b/research/README index 5367826..cb18d94 100644 --- a/research/README +++ b/research/README @@ -1,5 +1,3 @@ == Usage == $ git clone git://github.com/LineageOS/lineage_wiki.git -$ cd lineage_wiki -$ ln -s ../find_lineageos_devices.py ./ -$ ./find_lineageos_devices.py +$ ./find_lineageos_devices.py lineage_wiki diff --git a/research/find_lineageos_devices.py b/research/find_lineageos_devices.py index cb388ca..4a4c3d3 100755 --- a/research/find_lineageos_devices.py +++ b/research/find_lineageos_devices.py @@ -17,6 +17,7 @@ import os import re +import sys import yaml basedir = '_data' + os.sep + 'devices' @@ -83,12 +84,23 @@ def print_results(results): for device in results[soc]: print ("- {0}:".format(device)) -for filename in os.listdir(basedir): - filepath = basedir + os.sep + filename - if re.search("\.yml$", filepath): - yaml_file = open(filepath, 'r') - document = yaml.load(yaml_file) - if still_supported(document) and interesting_for_replicant(document): - store_infos(results, document) +def find_devices(path): + for filename in os.listdir(path + os.sep + basedir): + filepath = path + os.sep + basedir + os.sep + filename + if re.search("\.yml$", filepath): + yaml_file = open(filepath, 'r') + document = yaml.load(yaml_file) + if still_supported(document) and interesting_for_replicant(document): + store_infos(results, document) + print_results(results) + +def usage(argv0): + progname = os.path.basename(argv0) + print("{} [path/to/lineage_wiki]".format(progname)) + sys.exit(1) + +if len(sys.argv) != 2: + usage(sys.argv[0]) + +find_devices(sys.argv[1]) -print_results(results) |