Revision edbed9ce
Added by koszko over 1 year ago
| src/hydrilla/builder/build.py | ||
|---|---|---|
| 35 | 35 |
import click |
| 36 | 36 |
|
| 37 | 37 |
from .. import util |
| 38 |
from . import _version |
|
| 38 | 39 |
|
| 39 | 40 |
here = Path(__file__).resolve().parent |
| 40 | 41 |
|
| ... | ... | |
| 42 | 43 |
|
| 43 | 44 |
index_validator = util.validator_for('package_source-1.schema.json')
|
| 44 | 45 |
|
| 46 |
generated_by = {
|
|
| 47 |
'name': 'hydrilla.builder', |
|
| 48 |
'version': _version.version |
|
| 49 |
} |
|
| 50 |
|
|
| 45 | 51 |
class FileReferenceError(Exception): |
| 46 | 52 |
""" |
| 47 | 53 |
Exception used to report various problems concerning files referenced from |
| ... | ... | |
| 278 | 284 |
new_item_obj.update([(p, item_def[p]) for p in copy_props]) |
| 279 | 285 |
|
| 280 | 286 |
new_item_obj['version'] = util.normalize_version(item_def['version']) |
| 281 |
new_item_obj['api_schema_version'] = [1, 0, 1]
|
|
| 287 |
new_item_obj['api_schema_version'] = [1] |
|
| 282 | 288 |
new_item_obj['source_copyright'] = self.copyright_file_refs |
| 283 | 289 |
new_item_obj['source_name'] = self.source_name |
| 290 |
new_item_obj['generated_by'] = generated_by |
|
| 284 | 291 |
|
| 285 | 292 |
item_list.append(new_item_obj) |
| 286 | 293 |
|
| ... | ... | |
| 327 | 334 |
} |
| 328 | 335 |
|
| 329 | 336 |
self.source_description = {
|
| 330 |
'api_schema_version': [1, 0, 1],
|
|
| 337 |
'api_schema_version': [1], |
|
| 331 | 338 |
'source_name': self.source_name, |
| 332 | 339 |
'source_copyright': self.copyright_file_refs, |
| 333 | 340 |
'upstream_url': index_obj['upstream_url'], |
| 334 | 341 |
'definitions': item_refs, |
| 335 |
'source_archives': source_archives_obj |
|
| 342 |
'source_archives': source_archives_obj, |
|
| 343 |
'generated_by': generated_by |
|
| 336 | 344 |
} |
| 337 | 345 |
|
| 338 | 346 |
if 'comment' in index_obj: |
| src/hydrilla/schemas | ||
|---|---|---|
| 1 |
Subproject commit a8442778ff400fd9d50cac7944b491c7d641df1f |
|
| 1 |
Subproject commit b19171081e23bcccf9b41588c0464ca9c2c657c0 |
|
| src/test/test_hydrilla_builder.py | ||
|---|---|---|
| 17 | 17 |
from jsonschema import ValidationError |
| 18 | 18 |
|
| 19 | 19 |
from hydrilla import util as hydrilla_util |
| 20 |
from hydrilla.builder import build |
|
| 20 |
from hydrilla.builder import build, _version
|
|
| 21 | 21 |
|
| 22 | 22 |
here = Path(__file__).resolve().parent |
| 23 | 23 |
|
| 24 |
expected_generated_by = {
|
|
| 25 |
'name': 'hydrilla.builder', |
|
| 26 |
'version': _version.version |
|
| 27 |
} |
|
| 28 |
|
|
| 24 | 29 |
default_srcdir = here / 'source-package-example' |
| 25 | 30 |
|
| 26 | 31 |
default_js_filenames = ['bye.js', 'hello.js', 'message.js'] |
| ... | ... | |
| 57 | 62 |
self.contents = default_contents.copy() |
| 58 | 63 |
|
| 59 | 64 |
self.expected_resources = [{
|
| 60 |
'api_schema_version': [1, 0, 1],
|
|
| 65 |
'api_schema_version': [1], |
|
| 61 | 66 |
'source_name': 'hello', |
| 62 | 67 |
'source_copyright': [{
|
| 63 | 68 |
'file': 'report.spdx', |
| ... | ... | |
| 80 | 85 |
}, {
|
| 81 | 86 |
'file': 'bye.js', |
| 82 | 87 |
'sha256': self.sha256_hashes['bye.js'] |
| 83 |
}] |
|
| 88 |
}], |
|
| 89 |
'generated_by': expected_generated_by |
|
| 84 | 90 |
}, {
|
| 85 |
'api_schema_version': [1, 0, 1],
|
|
| 91 |
'api_schema_version': [1], |
|
| 86 | 92 |
'source_name': 'hello', |
| 87 | 93 |
'source_copyright': [{
|
| 88 | 94 |
'file': 'report.spdx', |
| ... | ... | |
| 102 | 108 |
'scripts': [{
|
| 103 | 109 |
'file': 'message.js', |
| 104 | 110 |
'sha256': self.sha256_hashes['message.js'] |
| 105 |
}] |
|
| 111 |
}], |
|
| 112 |
'generated_by': expected_generated_by |
|
| 106 | 113 |
}] |
| 107 | 114 |
self.expected_mapping = {
|
| 108 |
'api_schema_version': [1, 0, 1],
|
|
| 115 |
'api_schema_version': [1], |
|
| 109 | 116 |
'source_name': 'hello', |
| 110 | 117 |
'source_copyright': [{
|
| 111 | 118 |
'file': 'report.spdx', |
| ... | ... | |
| 127 | 134 |
'https://hachettebugs.koszko.org/***': {
|
| 128 | 135 |
'identifier': 'helloapple' |
| 129 | 136 |
} |
| 130 |
} |
|
| 137 |
}, |
|
| 138 |
'generated_by': expected_generated_by |
|
| 131 | 139 |
} |
| 132 | 140 |
self.expected_source_description = {
|
| 133 |
'api_schema_version': [1, 0, 1],
|
|
| 141 |
'api_schema_version': [1], |
|
| 134 | 142 |
'source_name': 'hello', |
| 135 | 143 |
'source_copyright': [{
|
| 136 | 144 |
'file': 'report.spdx', |
| ... | ... | |
| 160 | 168 |
'identifier': 'helloapple', |
| 161 | 169 |
'long_name': 'Hello Apple', |
| 162 | 170 |
'version': [2021, 11, 10], |
| 163 |
}] |
|
| 171 |
}], |
|
| 172 |
'generated_by': expected_generated_by |
|
| 164 | 173 |
} |
| 165 | 174 |
|
| 166 | 175 |
def expected(self) -> list[dict]: |
Also available in: Unified diff
when generating JSON documents, put generating software info in 'generated_by' property