Revision 50a0341b
Added by koszko about 1 year ago
| src/hydrilla/builder/build.py | ||
|---|---|---|
| 200 | 200 |
path = piggybacked.resolve_file(desired_path) |
| 201 | 201 |
if path is None: |
| 202 | 202 |
path = (self.srcdir / desired_path).resolve() |
| 203 |
if not path.is_relative_to(self.srcdir): |
|
| 203 |
try: |
|
| 204 |
rel_path = path.relative_to(self.srcdir) |
|
| 205 |
except ValueError: |
|
| 204 | 206 |
raise FileReferenceError(_('loading_{}_outside_package_dir')
|
| 205 | 207 |
.format(filename)) |
| 206 | 208 |
|
| 207 |
if str(path.relative_to(self.srcdir)) == 'index.json':
|
|
| 209 |
if str(rel_path) == 'index.json':
|
|
| 208 | 210 |
raise FileReferenceError(_('loading_reserved_index_json'))
|
| 209 | 211 |
else: |
| 210 | 212 |
include_in_source_archive = False |
| src/hydrilla/builder/piggybacking.py | ||
|---|---|---|
| 98 | 98 |
|
| 99 | 99 |
path = path.resolve() |
| 100 | 100 |
|
| 101 |
if not path.is_relative_to(root_path): |
|
| 101 |
try: |
|
| 102 |
path.relative_to(root_path) |
|
| 103 |
except ValueError: |
|
| 102 | 104 |
raise FileReferenceError(_('loading_{}_outside_piggybacked_dir')
|
| 103 | 105 |
.format(file_ref_name)) |
| 104 | 106 |
|
| tests/test_build.py | ||
|---|---|---|
| 281 | 281 |
@collect(variant_makers) |
| 282 | 282 |
def sample_source_add_comments(monkeypatch, sample_source): |
| 283 | 283 |
"""Add index.json comments that should be preserved.""" |
| 284 |
for dictionary in index_obj, *index_obj['definitions'], *expected:
|
|
| 284 |
for dictionary in (index_obj, *index_obj['definitions'], *expected):
|
|
| 285 | 285 |
monkeypatch.setitem(dictionary, 'comment', 'index.json comment') |
| 286 | 286 |
|
| 287 | 287 |
@collect(variant_makers) |
| ... | ... | |
| 356 | 356 |
def sample_source_make_version_2(monkeypatch, sample_source, |
| 357 | 357 |
expected_documents_to_modify=[]): |
| 358 | 358 |
"""Increase sources' schema version from 1 to 2.""" |
| 359 |
for obj in index_obj, *expected_documents_to_modify:
|
|
| 359 |
for obj in (index_obj, *expected_documents_to_modify):
|
|
| 360 | 360 |
monkeypatch.setitem(obj, '$schema', obj['$schema'].replace('1', '2'))
|
| 361 | 361 |
|
| 362 | 362 |
permission_variant_makers = [] |
Also available in: Unified diff
restore compatibility with python 3.7