Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: packagerChrome.py

Issue 11544056: Prepared buildtools for Safari (Closed)
Patch Set: Made first run page always generated, fix absolute URLs for Safari during build, introduced browser… Created Oct. 31, 2013, 10:48 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « packager.py ('k') | packagerGecko.py » ('j') | packagerSafari.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-2013 Eyeo GmbH 4 # Copyright (C) 2006-2013 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 16 matching lines...) Expand all
27 result = set(('store.description',)) 27 result = set(('store.description',))
28 28
29 # Hack: ignore all lib subdirectories 29 # Hack: ignore all lib subdirectories
30 libDir = os.path.join(params['baseDir'], 'lib') 30 libDir = os.path.join(params['baseDir'], 'lib')
31 for file in os.listdir(libDir): 31 for file in os.listdir(libDir):
32 if os.path.isdir(os.path.join(libDir, file)): 32 if os.path.isdir(os.path.join(libDir, file)):
33 result.add(file) 33 result.add(file)
34 return result 34 return result
35 35
36 def getPackageFiles(params): 36 def getPackageFiles(params):
37 result = set(('_locales', 'icons', 'jquery-ui', 'lib', 'skin', 'ui',)) 37 result = set(('_locales', 'icons', 'jquery-ui', 'lib', 'skin', 'ui', 'ext'))
38 38
39 if params['devenv']: 39 if params['devenv']:
40 result.add('qunit') 40 result.add('qunit')
41 41
42 baseDir = params['baseDir'] 42 baseDir = params['baseDir']
43 for file in os.listdir(baseDir): 43 for file in os.listdir(baseDir):
44 if file.endswith('.js') or file.endswith('.html') or file.endswith('.xml'): 44 if file.endswith('.js') or file.endswith('.html') or file.endswith('.xml'):
45 result.add(file) 45 result.add(file)
46 return result 46 return result
47 47
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 'pt': 'pt_PT', 272 'pt': 'pt_PT',
273 } 273 }
274 for chromeLocale, operaLocale in operaMapping.iteritems(): 274 for chromeLocale, operaLocale in operaMapping.iteritems():
275 chromeFile = '_locales/%s/messages.json' % chromeLocale 275 chromeFile = '_locales/%s/messages.json' % chromeLocale
276 operaFile = '_locales/%s/messages.json' % operaLocale if operaLocale != No ne else None 276 operaFile = '_locales/%s/messages.json' % operaLocale if operaLocale != No ne else None
277 if chromeFile in files: 277 if chromeFile in files:
278 if operaFile != None: 278 if operaFile != None:
279 files[operaFile] = files[chromeFile] 279 files[operaFile] = files[chromeFile]
280 del files[chromeFile] 280 del files[chromeFile]
281 281
282 # Hack: Replace "Chrome" by "Opera" in the locales
283 for path, data in files.iteritems():
284 if path.startswith("_locales/") and path.endswith("/messages.json"):
285 files[path] = re.sub(r"\bChrome\b", "Opera", data)
286
287 def signBinary(zipdata, keyFile): 282 def signBinary(zipdata, keyFile):
288 import M2Crypto 283 import M2Crypto
289 if not os.path.exists(keyFile): 284 if not os.path.exists(keyFile):
290 M2Crypto.RSA.gen_key(1024, 65537, callback=lambda x: None).save_key(keyFile, cipher=None) 285 M2Crypto.RSA.gen_key(1024, 65537, callback=lambda x: None).save_key(keyFile, cipher=None)
291 key = M2Crypto.EVP.load_key(keyFile) 286 key = M2Crypto.EVP.load_key(keyFile)
292 key.sign_init() 287 key.sign_init()
293 key.sign_update(zipdata) 288 key.sign_update(zipdata)
294 return key.final() 289 return key.final()
295 290
296 def getPublicKey(keyFile): 291 def getPublicKey(keyFile):
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 files = Files(getPackageFiles(params), getIgnoredFiles(params), 323 files = Files(getPackageFiles(params), getIgnoredFiles(params),
329 process=lambda path, data: processFile(path, data, params)) 324 process=lambda path, data: processFile(path, data, params))
330 files['manifest.json'] = createManifest(params) 325 files['manifest.json'] = createManifest(params)
331 if metadata.has_section('mapping'): 326 if metadata.has_section('mapping'):
332 files.readMappedFiles(metadata.items('mapping')) 327 files.readMappedFiles(metadata.items('mapping'))
333 files.read(baseDir) 328 files.read(baseDir)
334 329
335 if metadata.has_section('convert_js'): 330 if metadata.has_section('convert_js'):
336 convertJS(params, files) 331 convertJS(params, files)
337 332
333 if metadata.has_section('convert_img'):
334 from imageConversion import convertImages
335 convertImages(params, files)
336
337 if metadata.has_section('preprocess'):
338 files.preprocess(
339 [f for f, _ in metadata.items('preprocess')],
340 {'needsExt': True}
341 )
342
338 if metadata.has_section('import_locales'): 343 if metadata.has_section('import_locales'):
339 importGeckoLocales(params, files) 344 importGeckoLocales(params, files)
340 345
341 if devenv: 346 if devenv:
342 files['devenvPoller__.js'] = createPoller(params) 347 files['devenvPoller__.js'] = createPoller(params)
343 348
344 if (metadata.has_option('general', 'backgroundScripts') and 349 if (metadata.has_option('general', 'backgroundScripts') and
345 'lib/info.js' in re.split(r'\s+', metadata.get('general', 'backgroundScrip ts')) and 350 'lib/info.js' in re.split(r'\s+', metadata.get('general', 'backgroundScrip ts')) and
346 'lib/info.js' not in files): 351 'lib/info.js' not in files):
347 files['lib/info.js'] = createInfoModule(params) 352 files['lib/info.js'] = createInfoModule(params)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 def shutdown_server(server): 384 def shutdown_server(server):
380 time.sleep(10) 385 time.sleep(10)
381 server.shutdown() 386 server.shutdown()
382 thread.start_new_thread(shutdown_server, (server,)) 387 thread.start_new_thread(shutdown_server, (server,))
383 server.serve_forever() 388 server.serve_forever()
384 389
385 if connections[0] == 0: 390 if connections[0] == 0:
386 print 'Warning: No incoming connections, extension probably not active in th e browser yet' 391 print 'Warning: No incoming connections, extension probably not active in th e browser yet'
387 else: 392 else:
388 print 'Handled %i connection(s)' % connections[0] 393 print 'Handled %i connection(s)' % connections[0]
OLDNEW
« no previous file with comments | « packager.py ('k') | packagerGecko.py » ('j') | packagerSafari.py » ('J')

Powered by Google App Engine
This is Rietveld