| OLD | NEW |
| 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 import errno | 5 import errno |
| 6 import io | 6 import io |
| 7 import json | 7 import json |
| 8 import os | 8 import os |
| 9 import re | 9 import re |
| 10 from StringIO import StringIO | 10 from StringIO import StringIO |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 modules = [] | 176 modules = [] |
| 177 | 177 |
| 178 if 'module' in current_args and info_module: | 178 if 'module' in current_args and info_module: |
| 179 modules.append(('info', info_module)) | 179 modules.append(('info', info_module)) |
| 180 | 180 |
| 181 for input_filename in input_files: | 181 for input_filename in input_files: |
| 182 module_name = os.path.splitext(os.path.basename(input_filename))[0] | 182 module_name = os.path.splitext(os.path.basename(input_filename))[0] |
| 183 prefix = os.path.basename(os.path.dirname(input_filename)) | 183 prefix = os.path.basename(os.path.dirname(input_filename)) |
| 184 if prefix != 'lib': | 184 if prefix != 'lib': |
| 185 module_name = '{}_{}'.format(prefix, module_name) | 185 module_name = '{}_{}'.format(prefix, module_name) |
| 186 with open(os.path.join(base_dir, input_filename), 'r') as file: | 186 if input_filename in files: |
| 187 modules.append((module_name, file.read().decode('utf-8'))) | 187 modules.append((module_name, files.pop(input_filename))) |
| 188 files.pop(input_filename, None) | 188 else: |
| 189 with open(os.path.join(base_dir, input_filename), 'r') as file: |
| 190 modules.append((module_name, file.read().decode('utf-8'))) |
| 189 | 191 |
| 190 files[filename] = template.render( | 192 files[filename] = template.render( |
| 191 args=current_args, | 193 args=current_args, |
| 192 modules=modules, | 194 modules=modules, |
| 193 basename=params['metadata'].get('general', 'basename'), | 195 basename=params['metadata'].get('general', 'basename'), |
| 194 version=params['metadata'].get('general', 'version') | 196 version=params['metadata'].get('general', 'version') |
| 195 ).encode('utf-8') | 197 ).encode('utf-8') |
| 196 | 198 |
| 197 | 199 |
| 198 def toJson(data): | 200 def toJson(data): |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 files['qunit/index.html'] = createScriptPage(params, 'testIndex.html.tmp
l', | 410 files['qunit/index.html'] = createScriptPage(params, 'testIndex.html.tmp
l', |
| 409 ('general', 'testScripts')) | 411 ('general', 'testScripts')) |
| 410 | 412 |
| 411 zipdata = files.zipToString() | 413 zipdata = files.zipToString() |
| 412 signature = None | 414 signature = None |
| 413 pubkey = None | 415 pubkey = None |
| 414 if keyFile != None: | 416 if keyFile != None: |
| 415 signature = signBinary(zipdata, keyFile) | 417 signature = signBinary(zipdata, keyFile) |
| 416 pubkey = getPublicKey(keyFile) | 418 pubkey = getPublicKey(keyFile) |
| 417 writePackage(outFile, pubkey, signature, zipdata) | 419 writePackage(outFile, pubkey, signature, zipdata) |
| OLD | NEW |