1
0
Fork 0
mirror of https://github.com/matomo-org/matomo-icons.git synced 2024-09-19 17:03:45 +02:00

error if new DeviceDetector objects are missing icons

This commit is contained in:
Lukas Winkler 2018-02-04 11:33:33 +01:00
parent 8687539ccc
commit 5af41d4473
No known key found for this signature in database
GPG key ID: 94AFBE7C2656A5B5

View file

@ -13,6 +13,7 @@
# You should have received a copy of the GNU General Public License along with # You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>. # this program. If not, see <http://www.gnu.org/licenses/>.
import json import json
import sys
from glob import glob from glob import glob
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
from urllib.parse import urlparse from urllib.parse import urlparse
@ -20,7 +21,6 @@ from urllib.parse import urlparse
import hashlib import hashlib
import os import os
import re import re
import sys
import yaml import yaml
from PIL import Image from PIL import Image
@ -47,6 +47,9 @@ ignore_that_icon_isnt_square = [
"dist/plugins/gears.png", "dist/plugins/gears.png",
"dist/brand/Landvo.png" "dist/brand/Landvo.png"
] ]
# @formatter:off
less_important_device_detector_icons = ['os|BMP', 'os|INF', 'os|MCD', 'os|MLD', 'os|MTK', 'os|RZD', 'os|SYS', 'os|S40', 'os|S60', 'os|SY3', 'os|WTV', 'browsers|AF', 'browsers|CX', 'browsers|CS', 'browsers|DB', 'browsers|DO', 'browsers|EB', 'browsers|LU', 'browsers|OD', 'browsers|SC', 'browsers|SN', 'browsers|SR', 'browsers|VB', 'browsers|WT', 'browsers|XI', 'brand|Ainol', 'brand|Airness', 'brand|Airties', 'brand|Allview', 'brand|Altech_UEC', 'brand|Amoi', 'brand|Arnova', 'brand|ARRIS', 'brand|Axxion', 'brand|Barnes_&_Noble', 'brand|BenQ-Siemens', 'brand|Bird', 'brand|Blackview', 'brand|Blu', 'brand|Bmobile', 'brand|Boway', 'brand|Bravis', 'brand|Brondi', 'brand|Bush', 'brand|Capitel', 'brand|Captiva', 'brand|Carrefour', 'brand|Casio', 'brand|Changhong', 'brand|China_Mobile', 'brand|Coby_Kyros', 'brand|Cowon', 'brand|Cube', 'brand|CUBOT', 'brand|Datang', 'brand|Dbtel', 'brand|Desay', 'brand|Dicam', 'brand|DNS', 'brand|Doogee', 'brand|Doov', 'brand|Dopod', 'brand|Dune_HD', 'brand|E-Boda', 'brand|EBEST', 'brand|ECS', 'brand|Elephone', 'brand|Energy_Sistem', 'brand|Ericy', 'brand|Eton', 'brand|Explay', 'brand|Ezio', 'brand|Ezze', 'brand|Fairphone', 'brand|Foxconn', 'brand|Garmin-Asus', 'brand|Gateway', 'brand|GOCLEVER', 'brand|Goly', 'brand|Hasee', 'brand|Hi-Level', 'brand|Hisense', 'brand|Homtom', 'brand|Hosin', 'brand|i-Joy', 'brand|i-mate', 'brand|iBall', 'brand|iKoMo', 'brand|iNew', 'brand|Infinix', 'brand|Inkti', 'brand|Innostream', 'brand|Intex', 'brand|iOcean', 'brand|iTel', 'brand|Jiayu', 'brand|K-Touch', 'brand|Kiano', 'brand|Kingsun', 'brand|Komu', 'brand|Konka', 'brand|Koobee', 'brand|KOPO', 'brand|Koridy', 'brand|KT-Tech', 'brand|Kumai', 'brand|LCT', 'brand|LeEco', 'brand|Lenco', 'brand|Lexand', 'brand|Lexibook', 'brand|Lingwin', 'brand|Logicom', 'brand|M.T.T.', 'brand|Majestic', 'brand|Mecer', 'brand|Mediacom', 'brand|MEEG', 'brand|Memup', 'brand|MEU', 'brand|MIXC', 'brand|MLLED', 'brand|Mobistel', 'brand|Modecom', 'brand|Mofut', 'brand|Mpman', 'brand|Netgear', 'brand|Newgen', 'brand|NextBook', 'brand|Noain', 'brand|Nomi', 'brand|Nous', 'brand|Opsson', 'brand|Ouki', 'brand|OUYA', 'brand|Overmax', 'brand|Oysters', 'brand|Pentagram', 'brand|phoneOne', 'brand|Pioneer', 'brand|Ployer', 'brand|Point_of_View', 'brand|Pomp', 'brand|Positivo', 'brand|PPTV', 'brand|Prestigio', 'brand|ProScan', 'brand|PULID', 'brand|Qilive', 'brand|Qtek', 'brand|Ramos', 'brand|RCA_Tablets', 'brand|Readboy', 'brand|Rikomagic', 'brand|Roku', 'brand|Rover', 'brand|Sendo', 'brand|Senseit', 'brand|Skyworth', 'brand|Smartisan', 'brand|Star', 'brand|Stonex', 'brand|Storex', 'brand|Sumvision', 'brand|SunVan', 'brand|SuperSonic', 'brand|Supra', 'brand|Symphony', 'brand|TB_Touch', 'brand|Telenor', 'brand|Tesco', 'brand|ThL', 'brand|TIANYU', 'brand|Toplux', 'brand|Trevi', 'brand|Turbo-X', 'brand|TVC', 'brand|Uniscope', 'brand|Unknown', 'brand|Unowhy', 'brand|UTStarcom', 'brand|Vastking', 'brand|Vitelcom', 'brand|Vizio', 'brand|VK_Mobile', 'brand|Voto', 'brand|Walton', 'brand|Web_TV', 'brand|WellcoM', 'brand|Wexler', 'brand|Wonu', 'brand|Xolo', 'brand|Ytone', 'brand|Yusun', 'brand|Zeemi']
# @formatter:on
build_script_regex = re.compile(r"rm [-rf]+ plugins/Morpheus/icons/(.*)") build_script_regex = re.compile(r"rm [-rf]+ plugins/Morpheus/icons/(.*)")
@ -216,6 +219,7 @@ def test_if_all_search_and_social_sites_have_an_icon():
def test_if_there_are_icons_for_all_device_detector_categories(): def test_if_there_are_icons_for_all_device_detector_categories():
global error
process = Popen(["php", "devicedetector.php"], stdout=PIPE) process = Popen(["php", "devicedetector.php"], stdout=PIPE)
(output, err) = process.communicate() (output, err) = process.communicate()
process.wait() process.wait()
@ -231,9 +235,14 @@ def test_if_there_are_icons_for_all_device_detector_categories():
if os.path.isfile("src/{type}/{slug}.{ext}".format(type=name, slug=slug, ext=filetype)): if os.path.isfile("src/{type}/{slug}.{ext}".format(type=name, slug=slug, ext=filetype)):
found = True found = True
if not found: if not found:
print_warning("icon for {icon} missing (should be at src/{type}/{slug}.{{png|svg}})".format( warning = "icon for {icon} missing (should be at src/{type}/{slug}.{{png|svg}})".format(
type=name, icon=category[code], slug=slug type=name, icon=category[code], slug=slug
)) )
if "|".join([name, slug]) in less_important_device_detector_icons:
print_warning(warning)
else:
print_error(warning)
error = True
if __name__ == "__main__": if __name__ == "__main__":