diff --git a/pym/cl_utils.py b/pym/cl_utils.py index b2ce3ce..d4d7ace 100644 --- a/pym/cl_utils.py +++ b/pym/cl_utils.py @@ -807,3 +807,21 @@ def getProgPath(progname): return progname else: return False + +reVerSplit = re.compile(r"^(.*?)-(([^-]+?)(?:-(r\d+))?)(?:.(tbz2))?$",re.S) +def reVerSplitToPV(x): + """Convert match from reVerSplit to PV hash""" + if x: + match = x.groups() + return {'PN':match[0], + 'PF':"%s-%s"%(match[0],match[1]), + 'P':"%s-%s"%(match[0],match[2]), + 'PV':match[2], + 'PR':match[3] or "r0", + 'PVR':match[1]} + return {'PN':"", + 'PF':"", + 'P':"", + 'PV':"", + 'PR':"", + 'PVR':""}.copy()