diff options
author | Michal Minar <miminar@redhat.com> | 2013-03-21 16:41:18 +0100 |
---|---|---|
committer | Michal Minar <miminar@redhat.com> | 2013-03-21 18:07:08 +0100 |
commit | 1c9627272440844c726052dc53900ecfe544d598 (patch) | |
tree | 23c1d9fe487998cc06e47cb4314cba87b186ff69 /src/software/openlmi/software/util/__init__.py | |
parent | c110c6309306b3208eb1c3dabfb0d9d860d06b9a (diff) | |
download | openlmi-providers-1c9627272440844c726052dc53900ecfe544d598.tar.gz openlmi-providers-1c9627272440844c726052dc53900ecfe544d598.tar.xz openlmi-providers-1c9627272440844c726052dc53900ecfe544d598.zip |
various enhancements
consistent access to Package's version and release attributes
- all 'ver' and 'rel' replaced to full names
added tracing decorators to some functions
providers having Values class under core subpackage now reference it
with self.values property
Identity.pkg2model now accepts also nevra as string
removed tabs in source code
Diffstat (limited to 'src/software/openlmi/software/util/__init__.py')
-rw-r--r-- | src/software/openlmi/software/util/__init__.py | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/software/openlmi/software/util/__init__.py b/src/software/openlmi/software/util/__init__.py index f42f25a..9b0ab01 100644 --- a/src/software/openlmi/software/util/__init__.py +++ b/src/software/openlmi/software/util/__init__.py @@ -28,16 +28,16 @@ import re import signal RE_EVRA = re.compile( - r'^(?P<epoch>\d+):(?P<ver>[^-]+)-(?P<rel>.+)\.(?P<arch>[^.]+)$') + r'^(?P<epoch>\d+):(?P<version>[^-]+)-(?P<release>.+)\.(?P<arch>[^.]+)$') RE_NEVRA = re.compile( - r'^(?P<name>.+)-(?P<evra>(?P<epoch>\d+):(?P<ver>[^-]+)' - r'-(?P<rel>.+)\.(?P<arch>[^.]+))$') + r'^(?P<name>.+)-(?P<evra>(?P<epoch>\d+):(?P<version>[^-]+)' + r'-(?P<release>.+)\.(?P<arch>[^.]+))$') RE_NEVRA_OPT_EPOCH = re.compile( - r'^(?P<name>.+)-(?P<evra>((?P<epoch>\d+):)?(?P<ver>[^-]+)' - r'-(?P<rel>.+)\.(?P<arch>[^.]+))$') + r'^(?P<name>.+)-(?P<evra>((?P<epoch>\d+):)?(?P<version>[^-]+)' + r'-(?P<release>.+)\.(?P<arch>[^.]+))$') RE_ENVRA = re.compile( - r'^(?P<epoch>\d+):(?P<name>.+)-(?P<evra>(?P<ver>[^-]+)' - r'-(?P<rel>.+)\.(?P<arch>[^.]+))$') + r'^(?P<epoch>\d+):(?P<name>.+)-(?P<evra>(?P<version>[^-]+)' + r'-(?P<release>.+)\.(?P<arch>[^.]+))$') def _get_distname(): """ @@ -121,16 +121,16 @@ def nevra2filter(nevra): else: raise TypeError("nevra must be either string or regexp match object") epoch = match.group("epoch") - if not epoch or match.group("epoch") == "(none)": + if not epoch or match.group("epoch").lower() == "(none)": epoch = "0" - return { "name" : match.group("name") - , "epoch" : epoch - , "version" : match.group("ver") - , "release" : match.group("rel") - , "arch" : match.group("arch") + return { "name" : match.group("name") + , "epoch" : epoch + , "version" : match.group("version") + , "release" : match.group("release") + , "arch" : match.group("arch") } -def make_nevra(name, epoch, ver, rel, arch, with_epoch='NOT_ZERO'): +def make_nevra(name, epoch, version, release, arch, with_epoch='NOT_ZERO'): """ @param with_epoch may be one of: "NOT_ZERO" - include epoch only if it's not zero @@ -145,7 +145,7 @@ def make_nevra(name, epoch, ver, rel, arch, with_epoch='NOT_ZERO'): estr = epoch if len(estr): estr += ":" - return "%s-%s%s-%s.%s" % (name, estr, ver, rel, arch) + return "%s-%s%s-%s.%s" % (name, estr, version, release, arch) def pkg2nevra(pkg, with_epoch='NOT_ZERO'): """ |