Guest User

Untitled

a guest
Jul 11th, 2011
58
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. re_options = [
  2. r'(\.r\d+)?', # 1.1.2 or 1.1.2.r100
  3. r'c\d+', # 1.1c1 (setuptools)
  4. r'(b|beta)\d+?', # 1.1beta1 or 1.1b1 (webob, lxml, setuptools)
  5. ]
  6. rx_options = [re.compile(r'[\d\.]+%s\Z'%re_opt) for re_opt in re_options]
  7.  
  8. def mark_stable(versions):
  9. # [ver] -> [(ver, is_stable)]
  10. for rx in rx_options:
  11. stable = [bool(rx.match(ver)) for ver in versions]
  12. if any(stable):
  13. break
  14. else:
  15. stable = [True] * len(versions)
  16. return zip(versions, stable)
RAW Paste Data