Commit 905b5dc7 authored by Léo-Paul Géneau's avatar Léo-Paul Géneau 👾

Fix version comparison

This will avoid bugs if one day major version becomes greater than 9.
parent 724c6872
...@@ -274,7 +274,7 @@ class Recipe(object): ...@@ -274,7 +274,7 @@ class Recipe(object):
def get_dependency_list(self, gem_dict, gem_executable, version): def get_dependency_list(self, gem_dict, gem_executable, version):
gem_search_pattern = '^' + gem_dict['gemname'].replace('.',r'\.') + '$' gem_search_pattern = '^' + gem_dict['gemname'].replace('.',r'\.') + '$'
if version[0] < '3': if int(version.split(".")[0]) < 3:
gem_search_pattern = '/' + gem_search_pattern + '/' gem_search_pattern = '/' + gem_search_pattern + '/'
cmd = [ cmd = [
......
...@@ -272,6 +272,11 @@ class RubyGemsDefaultTestCase(RubyGemsTestCase): ...@@ -272,6 +272,11 @@ class RubyGemsDefaultTestCase(RubyGemsTestCase):
rubygems.Recipe, buildout, name, options rubygems.Recipe, buildout, name, options
) )
@fixture({'recipe': {'gems': 'sass', 'version': '10.0.0'}})
def test_2_digits_version(self, path, patches, buildout, name, options, version):
recipe = rubygems.Recipe(buildout, name, options)
recipe.update()
class deployment_fixture(fixture): class deployment_fixture(fixture):
def mocked_check_output_for_dependencies(self, cmd, **kwargs): def mocked_check_output_for_dependencies(self, cmd, **kwargs):
...@@ -300,7 +305,7 @@ class RubyGemsDeploymentTestCase(RubyGemsTestCase): ...@@ -300,7 +305,7 @@ class RubyGemsDeploymentTestCase(RubyGemsTestCase):
gem_dict_list = list(map(recipe.get_gem_dict, recipe.gems)) gem_dict_list = list(map(recipe.get_gem_dict, recipe.gems))
for gem_dict in gem_dict_list: for gem_dict in gem_dict_list:
gem_search_pattern = '^' + gem_dict['gemname'].replace('.',r'\.') + '$' gem_search_pattern = '^' + gem_dict['gemname'].replace('.',r'\.') + '$'
if version[0] < '3': if int(version.split(".")[0]) < 3:
gem_search_pattern = '/' + gem_search_pattern + '/' gem_search_pattern = '/' + gem_search_pattern + '/'
gem_executable = str(path.joinpath(name, 'bin', 'gem')) gem_executable = str(path.joinpath(name, 'bin', '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