Commit bbcee27b authored by Xavier Thompson's avatar Xavier Thompson

[wkrd] Fix zc.recipe.egg name in test index

With recent setuptools, calling `python setup.py sdist` to create an
archive for zc.recipe.egg creates a zc_recipe_egg-xyz.zip instead of
a zc.recipe.egg-xyz.zip. This is called during test setup to prepare
a local package index, as the tests prevent access to PyPI. The name
change leads the index to find an entry for zc-recipe-egg instead of
zc.recipe.egg (as normalization replaces _ with -), which causes the
tests to fail to find a distribution for zc.recipe.egg.
parent 407b7a7f
......@@ -2893,12 +2893,12 @@ def wont_downgrade_due_to_prefer_final():
... [buildout]
... parts =
... [versions]
... zc.buildout = >.1
... zc.buildout = >0.1
... ''')
>>> [str(l.split('= >', 1)[1].strip())
... for l in system(buildout+' -vv').split('\n')
... if l.startswith('zc.buildout =')]
['.1']
['0.1']
>>> write('buildout.cfg',
... '''
......@@ -3870,10 +3870,20 @@ def buildout_txt_setup(test):
dist = pkg_resources.working_set.find(
pkg_resources.Requirement.parse('zc.recipe.egg'))
mkdir(eggs, 'zc.recipe.egg')
dest = os.path.join(eggs, 'zc.recipe.egg')
zc.buildout.testing.sdist(
os.path.dirname(dist.location),
os.path.join(eggs, 'zc.recipe.egg'),
dest,
)
# Workaround recent setuptools generating zc_recipe_egg-xyz.zip
# rather than zc.recipe.egg-xyz.zip, and resulting in the index
# containing an entry for zc-recipe-egg instead of zc.recipe.egg
# (after normalisation). Even though running python setup.py sdist
# directly __is__ deprecated.
zipfile, = os.listdir(dest)
correct = zipfile.replace('zc_recipe_egg', 'zc.recipe.egg')
if correct != zipfile:
shutil.move(os.path.join(dest, zipfile), os.path.join(dest, correct))
egg_parse = re.compile(r'([0-9a-zA-Z_.]+)-([0-9a-zA-Z_.+]+)-py(\d[.]\d+)$'
).match
......
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