Commit 38e84663 authored by Léo-Paul Géneau's avatar Léo-Paul Géneau 👾 Committed by Kirill Smelkov

Handle version exclusion constraint

Handle gem version exclusion from gemspec ( != symbol )

/reviewed-by @kirr
/reviewed-on !6
parent a0fb8b36
Pipeline #16612 passed with stage
in 0 seconds
......@@ -49,8 +49,8 @@ class Recipe(object):
deployment = options.get('deployment')
self.deployment = is_true(deployment) if deployment else not allow_picked_versions()
self.gem_regex = re.compile(r'\s+([\w\-_.]+) \((<|~>|>=) '
r'((\d+\.)*\d+)(, (<|~>|>=) ((\d+\.)*\d+))?\)')
self.gem_regex = re.compile(r'\s+([\w\-_.]+) \((<|~>|>=|!=) '
r'((\d+\.)*\d+)(, (<|~>|>=|!=) ((\d+\.)*\d+))?\)')
def run(self, cmd, environ=None):
"""Run the given ``cmd`` in a child process."""
......@@ -109,6 +109,9 @@ class Recipe(object):
elif cons_dict['symbol'] == '>=':
if dep_version_list >= cons_version_list:
return
elif cons_dict['symbol'] == '!=':
if dep_version_list != cons_version_list:
return
else:
raise ValueError(
'Unhandled symbol in constraint %s for dependecy %s of gem %s'
......
Gem sass-1.0.0
hashie (>= 0.3.0, != 1.0.0)
......@@ -482,3 +482,23 @@ class RubyGemsDeploymentTestCase(RubyGemsTestCase):
def test_deployment_similar_second_constraint_success(
self, path, patches, buildout, name, options, version):
self.deployment_install_test(buildout, name, path, patches, options, version)
@deployment_fixture({'recipe': {
'gems': 'hashie==1.0.0 sass==1.0.0'
}})
def test_deployment_version_exclusion_constraint_error(
self, path, patches, buildout, name, options, version):
recipe = rubygems.Recipe(buildout, name, options)
self.assertRaisesRegexp(
zc.buildout.UserError,
'Configuration error, version 1.0.0 for gem hashie '
'does not satisfy dependency constraint != 1.0.0 of gem sass',
recipe.install
)
@deployment_fixture({'recipe': {
'gems': 'hashie==0.3.1 sass==1.0.0'
}})
def test_deployment_version_exclusion_constraint_success(
self, path, patches, buildout, name, options, version):
self.deployment_install_test(buildout, name, path, patches, options, version)
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