|
18 | 18 | # Copyright (c) OWASP Foundation. All Rights Reserved. |
19 | 19 |
|
20 | 20 | import re |
21 | | -from os.path import dirname, join |
| 21 | +from os.path import dirname, join, realpath |
22 | 22 | from urllib.request import urlretrieve |
23 | 23 |
|
24 | 24 | SOURCE_ROOT = 'https://raw.githubusercontent.com/CycloneDX/specification/refs/tags/1.6.1/schema/' |
25 | | -TARGET_ROOT = join(dirname(__file__), '..', 'cyclonedx', 'schema', '_res') |
| 25 | +TARGET_ROOT = realpath(join(dirname(__file__), '..', 'cyclonedx', 'schema', '_res')) |
26 | 26 |
|
27 | 27 | BOM_XSD = { |
28 | 28 | 'versions': ['1.6', '1.5', '1.4', '1.3', '1.2', '1.1', '1.0'], |
|
101 | 101 | source = dspec['sourcePattern'].replace('%s', version) |
102 | 102 | target = dspec['targetPattern'].replace('%s', version) |
103 | 103 | tempfile, _ = urlretrieve(source) # nosec B310 |
104 | | - with open(tempfile, 'r') as tmpf: |
105 | | - with open(target, 'w', newline='\n') as tarf: |
| 104 | + print(source, '->', target) |
| 105 | + with open(tempfile, 'r') as tmpf, \ |
| 106 | + open(target, 'w', newline='\n') as tarf: |
106 | 107 | text = tmpf.read() |
107 | 108 | for search, replace in dspec['replace']: |
108 | 109 | text = text.replace(search, replace) |
|
0 commit comments