Commit 121b182f authored by Jérome Perrin's avatar Jérome Perrin Committed by Julien Muchembled

tests: Fix makeNewRelease when installed as a zipped egg

python ZipFile module does not support updating an entry in place, instead make
a new zip file and copy all entries.
parent 64ac43b1
......@@ -3462,16 +3462,18 @@ def makeNewRelease(project, ws, dest, version='99.99'):
dest = os.path.join(dest, "%s-%s-py%s.egg" % (eggname, version, pyver))
if os.path.isfile(dist.location):
shutil.copy(dist.location, dest)
zip = zipfile.ZipFile(dest, 'a')
).replace("Version: %s" % oldver,
"Version: %s" % version)
with zipfile.ZipFile(dist.location, 'r') as old_zip:
with zipfile.ZipFile(dest, 'w') as new_zip:
for item in old_zip.infolist():
data =
if item.filename == 'EGG-INFO/PKG-INFO':
data = data.decode(
"Version: %s" % oldver,
"Version: %s" % version
new_zip.writestr(item, data)
shutil.copytree(dist.location, dest)
info_path = os.path.join(dest, 'EGG-INFO', 'PKG-INFO')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment