@@ -260,6 +260,37 @@ def from_native(cls, string):
260260
261261 return cls (constraints = anyof_constraints )
262262
263+ @classmethod
264+ def from_gitlab_native (cls , string ):
265+ constraints = []
266+ parsed_constraints = set ()
267+ pipe_separated_constraints = string .split ("||" )
268+ for pipe_separated_constraints in pipe_separated_constraints :
269+ space_seperated_constraints = pipe_separated_constraints .split (" " )
270+ constraints .extend (space_seperated_constraints )
271+ comparator = ""
272+ while "" in constraints :
273+ constraints .remove ("" )
274+ for constraint in constraints :
275+ if constraint in cls .vers_by_native_comparators :
276+ comparator = cls .vers_by_native_comparators [constraint ]
277+ continue
278+ if comparator :
279+ parsed_constraints .add (
280+ VersionConstraint (comparator = comparator , version = cls .version_class (constraint ))
281+ )
282+ else :
283+ comparator , version_constraint = split_req (
284+ constraint , cls .vers_by_native_comparators
285+ )
286+ parsed_constraints .add (
287+ VersionConstraint (
288+ comparator = comparator , version = cls .version_class (version_constraint )
289+ )
290+ )
291+ comparator = ""
292+ return cls (constraints = list (parsed_constraints ))
293+
263294
264295def get_allof_constraints (cls , clause ):
265296 """
@@ -319,6 +350,18 @@ def from_native(cls, string):
319350
320351 return cls (constraints = constraints )
321352
353+ @classmethod
354+ def from_gitlab_native (cls , string ):
355+ constraints = set ()
356+ parsed_constraints = []
357+ pipe_separated_constraints = string .split ("||" )
358+ for pipe_separated_constraints in pipe_separated_constraints :
359+ space_seperated_constraints = pipe_separated_constraints .split (" " )
360+ constraints .update (space_seperated_constraints )
361+ for constraint in constraints :
362+ parsed_constraints .extend (cls .from_native (constraint ).constraints )
363+ return cls (constraints = parsed_constraints )
364+
322365
323366def split_req (string , comparators , default = None , strip = "" ):
324367 """
@@ -583,6 +626,14 @@ def from_native(cls, string):
583626
584627 return cls (constraints = constraints )
585628
629+ @classmethod
630+ def from_gitlab_native (cls , string ):
631+ constraints = []
632+ pipe_separated_constraints = string .split ("||" )
633+ for pipe_separated_constraints in pipe_separated_constraints :
634+ constraints .extend (cls .from_native (pipe_separated_constraints ).constraints )
635+ return cls (constraints = constraints )
636+
586637
587638class MavenVersionRange (VersionRange ):
588639 """
0 commit comments