diff options
Diffstat (limited to 'meta/recipes-devtools/python/python3/create_manifest3.py')
-rw-r--r-- | meta/recipes-devtools/python/python3/create_manifest3.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/meta/recipes-devtools/python/python3/create_manifest3.py b/meta/recipes-devtools/python/python3/create_manifest3.py index fddb23cdc4..f7d4587030 100644 --- a/meta/recipes-devtools/python/python3/create_manifest3.py +++ b/meta/recipes-devtools/python/python3/create_manifest3.py | |||
@@ -22,7 +22,7 @@ | |||
22 | # | 22 | # |
23 | # | 23 | # |
24 | # This way we will create a new manifest from the data structure that was built during | 24 | # This way we will create a new manifest from the data structure that was built during |
25 | # this process, ont this new manifest each package will contain specifically only | 25 | # this process, on this new manifest each package will contain specifically only |
26 | # what it needs to run. | 26 | # what it needs to run. |
27 | # | 27 | # |
28 | # There are some caveats which we try to deal with, such as repeated files on different | 28 | # There are some caveats which we try to deal with, such as repeated files on different |
@@ -36,7 +36,7 @@ | |||
36 | # Tha method to handle cached files does not work when a module includes a folder which | 36 | # Tha method to handle cached files does not work when a module includes a folder which |
37 | # itself contains the pycache folder, gladly this is almost never the case. | 37 | # itself contains the pycache folder, gladly this is almost never the case. |
38 | # | 38 | # |
39 | # Author: Alejandro Enedino Hernandez Samaniego "aehs29" <aehs29@gmail.com> | 39 | # Author: Alejandro Enedino Hernandez Samaniego "aehs29" <aehs29 at gmail dot com> |
40 | 40 | ||
41 | 41 | ||
42 | import sys | 42 | import sys |
@@ -78,9 +78,21 @@ def isCached(item): | |||
78 | else: | 78 | else: |
79 | return False | 79 | return False |
80 | 80 | ||
81 | def prepend_comments(comments, json_manifest): | ||
82 | with open(json_manifest, 'r+') as manifest: | ||
83 | json_contents = manifest.read() | ||
84 | manifest.seek(0, 0) | ||
85 | manifest.write(comments + json_contents) | ||
86 | |||
81 | # Read existing JSON manifest | 87 | # Read existing JSON manifest |
82 | with open('python3-manifest.json') as manifest: | 88 | with open('python3-manifest.json') as manifest: |
83 | old_manifest = json.load(manifest, object_pairs_hook=collections.OrderedDict) | 89 | # The JSON format doesn't allow comments so we hack the call to keep the comments using a marker |
90 | manifest_str = manifest.read() | ||
91 | json_start = manifest_str.find('# EOC') + 6 # EOC + \n | ||
92 | manifest.seek(0) | ||
93 | comments = manifest.read(json_start) | ||
94 | manifest_str = manifest.read() | ||
95 | old_manifest = json.loads(manifest_str, object_pairs_hook=collections.OrderedDict) | ||
84 | 96 | ||
85 | # | 97 | # |
86 | # First pass to get core-package functionality, because we base everything on the fact that core is actually working | 98 | # First pass to get core-package functionality, because we base everything on the fact that core is actually working |
@@ -402,6 +414,8 @@ with open('python3-manifest.json.new','w') as outfile: | |||
402 | json.dump(new_manifest,outfile, indent=4) | 414 | json.dump(new_manifest,outfile, indent=4) |
403 | outfile.write('\n') | 415 | outfile.write('\n') |
404 | 416 | ||
417 | prepend_comments(comments,'python3-manifest.json.new') | ||
418 | |||
405 | if (repeated): | 419 | if (repeated): |
406 | error_msg = '\n\nERROR:\n' | 420 | error_msg = '\n\nERROR:\n' |
407 | error_msg += 'The following files are repeated (contained in more than one package),\n' | 421 | error_msg += 'The following files are repeated (contained in more than one package),\n' |