Commit 28f71c5c authored by Léo-Paul Géneau's avatar Léo-Paul Géneau 👾 Committed by Julien Muchembled

Change from hexagonit to slapos download recipe

hexagonit.recipe.download having not been ported to Python3, changing
for slapos.recipe.downloadunpacked is a Python3 portage for this recipe.
parent c58aba06
......@@ -13,7 +13,7 @@ import zc.buildout
import six.moves.urllib as urllib
import hexagonit.recipe.download
from slapos.recipe.downloadunpacked import Recipe as Download
strip = lambda x:x.strip() # noqa
......@@ -135,13 +135,13 @@ class Recipe(object):
def _install_rubygems(self):
url, version = self._get_latest_rubygems()
srcdir = os.path.join(self.buildout['buildout']['parts-directory'],
'rubygems-' + version)
options = {
'url': url,
'destination': self.buildout['buildout']['parts-directory'],
'destination': srcdir,
}
HexagonitDownload = hexagonit.recipe.download.Recipe
recipe = HexagonitDownload(self.buildout, self.name, options)
recipe = Download(self.buildout, self.name, options)
recipe.install()
current_dir = os.getcwd()
......@@ -156,8 +156,6 @@ class Recipe(object):
) % self.options['location'])
raise zc.buildout.UserError('Configuration error')
srcdir = os.path.join(self.buildout['buildout']['parts-directory'],
'rubygems-%s' % version)
os.chdir(srcdir)
env = self._get_env()
......
......@@ -27,7 +27,7 @@ setup(name=name,
'six',
'zc.buildout',
'setuptools',
'hexagonit.recipe.download'
'slapos.recipe.build',
],
tests_require=[
'mock',
......
......@@ -57,7 +57,7 @@ class fixture(object):
self.patch((
('check_output', 'rubygems.subprocess.check_output'),
('urlopen', 'rubygems.urllib.request.urlopen'),
('hexagonit', 'rubygems.hexagonit.recipe.download.Recipe'),
('download', 'rubygems.Download'),
))
self.patches['urlopen'].return_value = BytesIO(
b'https://rubygems.org/rubygems/rubygems-1.0.zip'
......@@ -97,15 +97,13 @@ class RubyGemsTests(unittest.TestCase):
args = patches['urlopen'].mock_calls[0][1]
self.assertEqual(args, ('https://rubygems.org/pages/download',))
# One hexagonit.recipe.download call to download rubygems
self.assertEqual(patches['hexagonit'].call_count, 1)
# One slapos.recipe.downloadunpacked call to download rubygems
self.assertEqual(patches['download'].call_count, 1)
args = patches['hexagonit'].mock_calls[0][1]
args = patches['download'].mock_calls[0][1]
self.assertEqual(args[2], {
'url': (
'https://rubygems.org/rubygems/rubygems-1.0.zip'
),
'destination': str(path),
'url': 'https://rubygems.org/rubygems/rubygems-1.0.zip',
'destination': str(path / 'rubygems-1.0'),
})
# Two check_output calls to install rubygems and specified gem
......
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