Revision 34072d8d
Added by koszko over 1 year ago
src/hydrilla_builder/build.py | ||
---|---|---|
280 | 280 |
root_dir_path = Path(root_dir_name) |
281 | 281 |
|
282 | 282 |
def zippath(file_path): |
283 |
return str(root_dir_path / file_path.relative_to(self.srcdir)) |
|
283 |
file_path = root_dir_path / file_path.relative_to(self.srcdir) |
|
284 |
return file_path.as_posix() |
|
284 | 285 |
|
285 | 286 |
with zipfile.ZipFile(fb, 'w') as xpi: |
286 | 287 |
for file_ref in self.files_by_path.values(): |
... | ... | |
295 | 296 |
""" |
296 | 297 |
Process 'item_def' as definition of a resource/mapping and store in |
297 | 298 |
memory its processed form and files used by it. |
299 |
|
|
300 |
Return a minimal item reference suitable for using in source |
|
301 |
description. |
|
298 | 302 |
""" |
299 | 303 |
copy_props = ['type', 'identifier', 'long_name', 'uuid', 'description'] |
300 | 304 |
if 'comment' in item_def: |
... | ... | |
326 | 330 |
|
327 | 331 |
new_item_obj['version'] = normalize_version(item_def['version']) |
328 | 332 |
new_item_obj['api_schema_version'] = [1, 0, 1] |
333 |
new_item_obj['source_copyright'] = self.copyright_file_refs |
|
334 |
new_item_obj['source_name'] = self.source_name |
|
329 | 335 |
|
330 | 336 |
item_list.append(new_item_obj) |
331 | 337 |
|
338 |
return dict([(prop, new_item_obj[prop]) |
|
339 |
for prop in ('type', 'identifier', 'version')]) |
|
340 |
|
|
332 | 341 |
def _process_index_json(self, index_obj: dict): |
333 | 342 |
""" |
334 | 343 |
Process 'index_obj' as contents of source package's index.json and store |
... | ... | |
338 | 347 |
""" |
339 | 348 |
jsonschema.validate(index_obj, index_json_schema) |
340 | 349 |
|
350 |
self.source_name = index_obj['source_name'] |
|
351 |
|
|
341 | 352 |
generate_spdx = index_obj.get('reuse_generate_spdx_report', False) |
342 | 353 |
if generate_spdx: |
343 | 354 |
contents = generate_spdx_report(self.srcdir) |
... | ... | |
347 | 358 |
spdx_ref.include_in_zipfile = False |
348 | 359 |
self.files_by_path[spdx_path] = spdx_ref |
349 | 360 |
|
350 |
copyright_file_refs = \ |
|
361 |
self.copyright_file_refs = \
|
|
351 | 362 |
[self._process_file(f['file']) for f in index_obj['copyright']] |
352 | 363 |
|
353 | 364 |
if generate_spdx and not spdx_ref.include_in_distribution: |
... | ... | |
358 | 369 |
for file_ref in index_obj.get('additional_files', []): |
359 | 370 |
self._process_file(file_ref['file'], include_in_distribution=False) |
360 | 371 |
|
361 |
root_dir_path = Path(index_obj['source_name'])
|
|
372 |
root_dir_path = Path(self.source_name)
|
|
362 | 373 |
|
363 | 374 |
source_archives_obj = { |
364 | 375 |
'zip' : { |
... | ... | |
368 | 379 |
|
369 | 380 |
self.source_description = { |
370 | 381 |
'api_schema_version': [1, 0, 1], |
371 |
'source_name': index_obj['source_name'],
|
|
372 |
'source_copyright': copyright_file_refs, |
|
382 |
'source_name': self.source_name,
|
|
383 |
'source_copyright': self.copyright_file_refs,
|
|
373 | 384 |
'upstream_url': index_obj['upstream_url'], |
374 | 385 |
'definitions': item_refs, |
375 | 386 |
'source_archives': source_archives_obj |
Also available in: Unified diff
extend the automated test case