Skip to content
Snippets Groups Projects
Commit 38b88aed authored by Lorenzo Pagliai's avatar Lorenzo Pagliai
Browse files

Change to substitute only the corresponding reference in manifest file

parent 4489614b
No related branches found
No related tags found
No related merge requests found
...@@ -44,7 +44,26 @@ def update_manifest(manifest, project: Project, new_revision): ...@@ -44,7 +44,26 @@ def update_manifest(manifest, project: Project, new_revision):
# We are doing this using a plain text replace action. Unfortunately # We are doing this using a plain text replace action. Unfortunately
# all python libraries for handling XML data are not able to preserve # all python libraries for handling XML data are not able to preserve
# the file layout, and we want a minimal diff. # the file layout, and we want a minimal diff.
manifest = manifest.replace(old_revision, new_revision) aux_manifest_file="manifest.txt"
with open(aux_manifest_file, "w") as file:
file.write(manifest)
file.close()
readfile = open(aux_manifest_file, "r")
replaced_content = ""
for line in readfile:
if project.path in line:
new_line = line.replace(old_revision, new_revision)
else:
new_line = line
# concatenate the new string and add an end-line break
replaced_content = replaced_content + new_line
readfile.close()
writefile = open(aux_manifest_file, "w")
writefile.write(replaced_content)
writefile.close()
with open(aux_manifest_file, 'r') as file:
manifest = file.read()
return manifest return manifest
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment