@@ -233,6 +233,7 @@ class NpmVersionRange(VersionRange):
233233 ">=" : ">=" ,
234234 "<" : "<" ,
235235 ">" : ">" ,
236+ "=" : "=" ,
236237 }
237238
238239 @classmethod
@@ -260,6 +261,37 @@ def from_native(cls, string):
260261
261262 return cls (constraints = anyof_constraints )
262263
264+ @classmethod
265+ def from_gitlab_native (cls , string ):
266+ constraints = []
267+ parsed_constraints = set ()
268+ pipe_separated_constraints = string .split ("||" )
269+ for pipe_separated_constraints in pipe_separated_constraints :
270+ space_seperated_constraints = pipe_separated_constraints .split (" " )
271+ constraints .extend (space_seperated_constraints )
272+ comparator = ""
273+ while "" in constraints :
274+ constraints .remove ("" )
275+ for constraint in constraints :
276+ if constraint in cls .vers_by_native_comparators :
277+ comparator = cls .vers_by_native_comparators [constraint ]
278+ continue
279+ if comparator :
280+ parsed_constraints .add (
281+ VersionConstraint (comparator = comparator , version = cls .version_class (constraint ))
282+ )
283+ else :
284+ comparator , version_constraint = split_req (
285+ constraint , cls .vers_by_native_comparators
286+ )
287+ parsed_constraints .add (
288+ VersionConstraint (
289+ comparator = comparator , version = cls .version_class (version_constraint )
290+ )
291+ )
292+ comparator = ""
293+ return cls (constraints = list (parsed_constraints ))
294+
263295
264296def get_allof_constraints (cls , clause ):
265297 """
@@ -319,6 +351,37 @@ def from_native(cls, string):
319351
320352 return cls (constraints = constraints )
321353
354+ @classmethod
355+ def from_gitlab_native (cls , string ):
356+ constraints = []
357+ parsed_constraints = []
358+ pipe_separated_constraints = string .split ("||" )
359+ for pipe_separated_constraints in pipe_separated_constraints :
360+ space_seperated_constraints = pipe_separated_constraints .split (" " )
361+ constraints .extend (space_seperated_constraints )
362+ comparator = ""
363+ while "" in constraints :
364+ constraints .remove ("" )
365+ for constraint in constraints :
366+ if constraint in cls .vers_by_native_comparators :
367+ comparator = cls .vers_by_native_comparators [constraint ]
368+ continue
369+ if comparator :
370+ parsed_constraints .append (
371+ VersionConstraint (comparator = comparator , version = cls .version_class (constraint ))
372+ )
373+ else :
374+ comparator , version_constraint = split_req (
375+ constraint , cls .vers_by_native_comparators
376+ )
377+ parsed_constraints .append (
378+ VersionConstraint (
379+ comparator = comparator , version = cls .version_class (version_constraint )
380+ )
381+ )
382+ comparator = ""
383+ return cls (constraints = parsed_constraints )
384+
322385
323386def split_req (string , comparators , default = None , strip = "" ):
324387 """
@@ -583,6 +646,14 @@ def from_native(cls, string):
583646
584647 return cls (constraints = constraints )
585648
649+ @classmethod
650+ def from_gitlab_native (cls , string ):
651+ constraints = []
652+ pipe_separated_constraints = string .split ("||" )
653+ for pipe_separated_constraints in pipe_separated_constraints :
654+ constraints .extend (cls .from_native (pipe_separated_constraints ).constraints )
655+ return cls (constraints = constraints )
656+
586657
587658class MavenVersionRange (VersionRange ):
588659 """
0 commit comments