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

Side by Side Diff: packager.py

Issue 29345751: Issue 4028 - Add support for Edge extensions to buildtools (Closed)
Patch Set: Address comments on patch set 1 Created June 17, 2016, 5:51 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 # This Source Code Form is subject to the terms of the Mozilla Public 1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this 2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4 4
5 # Note: These are the base functions common to all packagers, the actual 5 # Note: These are the base functions common to all packagers, the actual
6 # packagers are implemented in packagerGecko and packagerChrome. 6 # packagers are implemented in packagerGecko and packagerChrome.
7 7
8 import sys 8 import sys
9 import os 9 import os
10 import re 10 import re
11 import codecs
Sebastian Noack 2016/07/01 15:56:03 I suppose you can remove the respective putty-igno
Vasily Kuznetsov 2016/07/01 19:51:28 It seems that there's no A301 ignore for this file
Sebastian Noack 2016/07/05 14:30:37 You are right. Importing codecs doesn't cause a A3
Vasily Kuznetsov 2016/07/07 16:23:48 Done.
12 import subprocess 11 import subprocess
13 import json 12 import json
14 import zipfile 13 import zipfile
15 from StringIO import StringIO 14 from StringIO import StringIO
16 from chainedconfigparser import ChainedConfigParser 15 from chainedconfigparser import ChainedConfigParser
17 16
18 import buildtools 17 import buildtools
19 18
20 19
21 def getDefaultFileName(metadata, version, ext): 20 def getDefaultFileName(metadata, version, ext):
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 # version components. 62 # version components.
64 while version.count('.') < 2: 63 while version.count('.') < 2:
65 version += '.0' 64 version += '.0'
66 version += '.' + buildNum 65 version += '.' + buildNum
67 return version 66 return version
68 67
69 68
70 def getTemplate(template, autoEscape=False): 69 def getTemplate(template, autoEscape=False):
71 import jinja2 70 import jinja2
72 71
73 templatePath = buildtools.__path__[0] 72 templatePath = os.path.join(buildtools.__path__[0], 'templates')
Sebastian Noack 2016/07/01 15:56:04 While changing every line using this variable, min
Vasily Kuznetsov 2016/07/01 19:51:28 Done.
73 loader = jinja2.FileSystemLoader(templatePath)
74 if autoEscape: 74 if autoEscape:
75 env = jinja2.Environment(loader=jinja2.FileSystemLoader(templatePath), a utoescape=True) 75 env = jinja2.Environment(loader=loader, autoescape=True)
76 else: 76 else:
77 env = jinja2.Environment(loader=jinja2.FileSystemLoader(templatePath)) 77 env = jinja2.Environment(loader=loader)
78 env.filters.update({'json': json.dumps}) 78 env.filters.update({'json': json.dumps})
79 return env.get_template(template) 79 return env.get_template(template)
80 80
81 81
82 class Files(dict): 82 class Files(dict):
83 def __init__(self, includedFiles, ignoredFiles, process=None): 83 def __init__(self, includedFiles, ignoredFiles, process=None):
84 self.includedFiles = includedFiles 84 self.includedFiles = includedFiles
85 self.ignoredFiles = ignoredFiles 85 self.ignoredFiles = ignoredFiles
86 self.process = process 86 self.process = process
87 87
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 names = self.keys() 139 names = self.keys()
140 names.sort(key=sortKey) 140 names.sort(key=sortKey)
141 for name in names: 141 for name in names:
142 zip.writestr(name, self[name]) 142 zip.writestr(name, self[name])
143 zip.close() 143 zip.close()
144 144
145 def zipToString(self, sortKey=None): 145 def zipToString(self, sortKey=None):
146 buffer = StringIO() 146 buffer = StringIO()
147 self.zip(buffer, sortKey=sortKey) 147 self.zip(buffer, sortKey=sortKey)
148 return buffer.getvalue() 148 return buffer.getvalue()
OLDNEW

Powered by Google App Engine
This is Rietveld