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