 Issue 5406295150559232:
  wrong icons parameter value in manifest.json for chrome buildtool fix.  (Closed)
    
  
    Issue 5406295150559232:
  wrong icons parameter value in manifest.json for chrome buildtool fix.  (Closed) 
  | Left: | ||
| Right: | 
| OLD | NEW | 
|---|---|
| 1 # coding: utf-8 | 1 # coding: utf-8 | 
| 2 | 2 | 
| 3 # This file is part of the Adblock Plus build tools, | 3 # This file is part of the Adblock Plus build tools, | 
| 4 # Copyright (C) 2006-2014 Eyeo GmbH | 4 # Copyright (C) 2006-2014 Eyeo GmbH | 
| 5 # | 5 # | 
| 6 # Adblock Plus is free software: you can redistribute it and/or modify | 6 # Adblock Plus is free software: you can redistribute it and/or modify | 
| 7 # it under the terms of the GNU General Public License version 3 as | 7 # it under the terms of the GNU General Public License version 3 as | 
| 8 # published by the Free Software Foundation. | 8 # published by the Free Software Foundation. | 
| 9 # | 9 # | 
| 10 # Adblock Plus is distributed in the hope that it will be useful, | 10 # Adblock Plus is distributed in the hope that it will be useful, | 
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 | 66 | 
| 67 if metadata.has_option('general', 'browserAction') and metadata.get('general', 'browserAction') != '': | 67 if metadata.has_option('general', 'browserAction') and metadata.get('general', 'browserAction') != '': | 
| 68 if re.search(r'\s+', metadata.get('general', 'browserAction')): | 68 if re.search(r'\s+', metadata.get('general', 'browserAction')): | 
| 69 icon, popup = re.split(r'\s+', metadata.get('general', 'browserAction'), 1 ) | 69 icon, popup = re.split(r'\s+', metadata.get('general', 'browserAction'), 1 ) | 
| 70 else: | 70 else: | 
| 71 icon, popup = (metadata.get('general', 'browserAction'), None) | 71 icon, popup = (metadata.get('general', 'browserAction'), None) | 
| 72 templateData['browserAction'] = {'icon': icon, 'popup': popup} | 72 templateData['browserAction'] = {'icon': icon, 'popup': popup} | 
| 73 | 73 | 
| 74 if metadata.has_option('general', 'icons'): | 74 if metadata.has_option('general', 'icons'): | 
| 75 icons = {} | 75 icons = {} | 
| 76 iconsDir = baseDir | 76 for icon in re.split('\s+', metadata.get('general', 'icons')): | 
| 77 for dir in metadata.get('general', 'icons').split('/')[0:-1]: | 77 match = re.search("\d+(?=\.)", icon) | 
| 
Wladimir Palant
2014/03/18 17:22:50
Determining icon size that way is even more a hack
 
saroyanm
2014/03/19 09:04:35
Good point, thanks for pointing.
Updated.
 | |
| 78 iconsDir = os.path.join(iconsDir, dir) | 78 if match: | 
| 79 | 79 value = match.group() | 
| 80 prefix, suffix = metadata.get('general', 'icons').split('/')[-1].split('?', 1) | 80 icons[value] = icon | 
| 81 for file in os.listdir(iconsDir): | |
| 82 path = os.path.join(iconsDir, file) | |
| 83 if os.path.isfile(path) and file.startswith(prefix) and file.endswith(suff ix): | |
| 84 size = file[len(prefix):-len(suffix)] | |
| 85 if not re.search(r'\D', size): | |
| 86 icons[size] = os.path.relpath(path, baseDir).replace('\\', '/') | |
| 87 | |
| 88 templateData['icons'] = icons | 81 templateData['icons'] = icons | 
| 89 | 82 | 
| 90 if metadata.has_option('general', 'permissions'): | 83 if metadata.has_option('general', 'permissions'): | 
| 91 templateData['permissions'] = re.split(r'\s+', metadata.get('general', 'perm issions')) | 84 templateData['permissions'] = re.split(r'\s+', metadata.get('general', 'perm issions')) | 
| 92 if params['experimentalAPI']: | 85 if params['experimentalAPI']: | 
| 93 templateData['permissions'].append('experimental') | 86 templateData['permissions'].append('experimental') | 
| 94 | 87 | 
| 95 if metadata.has_option('general', 'backgroundScripts'): | 88 if metadata.has_option('general', 'backgroundScripts'): | 
| 96 templateData['backgroundScripts'] = re.split(r'\s+', metadata.get('general', 'backgroundScripts')) | 89 templateData['backgroundScripts'] = re.split(r'\s+', metadata.get('general', 'backgroundScripts')) | 
| 97 if params['devenv']: | 90 if params['devenv']: | 
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 409 def shutdown_server(server): | 402 def shutdown_server(server): | 
| 410 time.sleep(10) | 403 time.sleep(10) | 
| 411 server.shutdown() | 404 server.shutdown() | 
| 412 thread.start_new_thread(shutdown_server, (server,)) | 405 thread.start_new_thread(shutdown_server, (server,)) | 
| 413 server.serve_forever() | 406 server.serve_forever() | 
| 414 | 407 | 
| 415 if connections[0] == 0: | 408 if connections[0] == 0: | 
| 416 print 'Warning: No incoming connections, extension probably not active in th e browser yet' | 409 print 'Warning: No incoming connections, extension probably not active in th e browser yet' | 
| 417 else: | 410 else: | 
| 418 print 'Handled %i connection(s)' % connections[0] | 411 print 'Handled %i connection(s)' % connections[0] | 
| OLD | NEW |