Package distutils :: Module versionpredicate
[hide private]
[frames] | no frames]

Module versionpredicate

Module for parsing and testing package version predicate strings.

Classes [hide private]
VersionPredicate
Parse and test package version predicates.
Functions [hide private]
 
splitUp(pred)
Parse a single version comparison.
 
split_provision(value)
Return the name and optional version number of a provision.
Variables [hide private]
  re_validPackage = re.compile(r'(?i)^\s*([a-z_]\w*(?:\.[a-z_]\w...
  re_paren = re.compile(r'^\s*\((.*)\)\s*$')
  re_splitComparison = re.compile(r'^\s*(<=|>=|<|>|!=|==)\s*([^\...
  compmap = {'!=': <built-in function ne>, '<': <built-in functi...
  _provision_rx = None

Imports: re, distutils, operator


Function Details [hide private]

splitUp(pred)

 

Parse a single version comparison.

Return (comparison string, StrictVersion)

split_provision(value)

 

Return the name and optional version number of a provision.

The version number, if given, will be returned as a `StrictVersion` instance, otherwise it will be `None`.

>>> split_provision('mypkg')
('mypkg', None)
>>> split_provision(' mypkg( 1.2 ) ')
('mypkg', StrictVersion ('1.2'))

Variables Details [hide private]

re_validPackage

Value:
re.compile(r'(?i)^\s*([a-z_]\w*(?:\.[a-z_]\w*)*)(.*)')

re_splitComparison

Value:
re.compile(r'^\s*(<=|>=|<|>|!=|==)\s*([^\s,]+)\s*$')

compmap

Value:
{'!=': <built-in function ne>,
 '<': <built-in function lt>,
 '<=': <built-in function le>,
 '==': <built-in function eq>,
 '>': <built-in function gt>,
 '>=': <built-in function ge>}