diff options
author | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2019-12-23 17:30:25 +0100 |
---|---|---|
committer | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2019-12-26 00:52:25 +0100 |
commit | 55b91bf31247b285132f964389c734be32415bde (patch) | |
tree | fcc3da3b5d950d158761f3ff827a344a755b4b21 | |
parent | cba9dbb1d2c942427e9a55ff2b71dc480037ec0b (diff) | |
download | presentations-55b91bf31247b285132f964389c734be32415bde.tar.gz presentations-55b91bf31247b285132f964389c734be32415bde.tar.bz2 presentations-55b91bf31247b285132f964389c734be32415bde.zip |
revert scripts
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
-rw-r--r-- | .gitmodules | 3 | ||||
-rwxr-xr-x | 36c3/Replicant_sustainability/scripts/find_lineageos_devices_with_removable_batteries.py | 133 | ||||
m--------- | external_resources/lineage_wiki | 0 |
3 files changed, 0 insertions, 136 deletions
diff --git a/.gitmodules b/.gitmodules index 8120fbd..1986570 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ [submodule "Replicant_contributors_meeting_27_28_July_2019_Paris_France/bootloaders/replicant_website"] path = external_resources/replicant_website url = https://git.replicant.us/replicant/website.git -[submodule "external_resources/lineage_wiki"] - path = external_resources/lineage_wiki - url = git://github.com/LineageOS/lineage_wiki.git diff --git a/36c3/Replicant_sustainability/scripts/find_lineageos_devices_with_removable_batteries.py b/36c3/Replicant_sustainability/scripts/find_lineageos_devices_with_removable_batteries.py deleted file mode 100755 index d94499b..0000000 --- a/36c3/Replicant_sustainability/scripts/find_lineageos_devices_with_removable_batteries.py +++ /dev/null @@ -1,133 +0,0 @@ -#!/bin/env python -# Program to find devices to support in LineageOS -# Copyright (C) 2019 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <https://www.gnu.org/licenses/>. - -import os -import re -import sys -import yaml - -basedir = '_data' + os.sep + 'devices' -results = {} -last_lineageos_version = 16.0 - -def still_supported(document): - if not last_lineageos_version in document['versions']: - return False - if 'discontinued' in document['channels']: - return False - - return True - -def interesting_for_sustainability(document): - # Non removable batteries are not sustainable - removable_battery = None - battery = document.get('battery', {}) - if type(battery) is not list: - removable_battery = battery.get('removable', None) - if removable_battery == None: - return False - elif removable_battery == False: - return False - else: - for battery_version in battery: - nr_removable = 0 - nr_not_removable = 0 - removable = battery_version.get('removable', None) - if removable == None: - return False - elif removable == True: - nr_removable += 1 - elif removable == False: - nr_not_removable += 1 - - if nr_removable == 0 and nr_not_removable > 0: - return False - elif nr_not_removable == 0 and nr_removable > 0: - return True - else: - print("TODO: The data has removable and non-removable batteries versions for the same device:" + battery) - print(" Add support for it in the parsing code") - sys.exit(1) - return True - return True - -def store_infos(results, document): - fields = ['vendor', 'name', 'type'] - - device_dict = {} - for field in fields: - device_dict[field] = document[field] - - removable_battery = None - battery = document.get('battery', {}) - if type(battery) is not list: - removable_battery = battery.get('removable', None) - else: - print(battery) - if removable_battery == None: - device_dict['removable_battery'] = 'Unknown' - else: - device_dict['removable_battery'] = removable_battery - - soc = document['soc'] - if not soc in results: - results[soc] = [] - - results[soc].append(device_dict) - -def print_results(results): - socs = list(results.keys()) - socs.sort() - - formfactors = [] - for soc in socs: - for device in results[soc]: - if device['type'] not in formfactors: - formfactors.append(device['type']) - - if len(formfactors) == 1: - print("{0}:".format(formfactors[0][0].capitalize() + formfactors[0][1:] + 's')) - for soc in socs: - print ("- {0}:".format(soc)) - for device in results[soc]: - print (" * {0}: {1}".format(device['vendor'], device['name'])) - else: - for soc in socs: - print ("{0}:".format(soc)) - for device in results[soc]: - print ("- {0}: {1} ({2})".format(device['vendor'], device['name'], device['type'])) - -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_sustainability(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]) - diff --git a/external_resources/lineage_wiki b/external_resources/lineage_wiki deleted file mode 160000 -Subproject 065f4989b7aceafdcad091ec6e76770989ff21f |