summaryrefslogtreecommitdiffstats
path: root/cnucnu/package_list.py
diff options
context:
space:
mode:
authorTill Maas <opensource@till.name>2010-09-07 21:03:39 +0200
committerTill Maas <opensource@till.name>2010-09-07 21:03:39 +0200
commitb8b928f8bbdf4f2b9f1482240e8f24642e20d2d4 (patch)
tree5a795166d7a5bc50967ae3f65861707980516df3 /cnucnu/package_list.py
parent4600a2279b413252bbdf5e41fe2881df623ad519 (diff)
downloadcnucnu-b8b928f8bbdf4f2b9f1482240e8f24642e20d2d4.tar.gz
cnucnu-b8b928f8bbdf4f2b9f1482240e8f24642e20d2d4.tar.xz
cnucnu-b8b928f8bbdf4f2b9f1482240e8f24642e20d2d4.zip
package_list: regex aliases: CPAN, PEAR, PECL
Add regex-aliases CPAN-DEFAULT, PEAR-DEFAULT and PECL-DEFAULT that use the default regex but strip the typical prefix from the name if it was not overriden.
Diffstat (limited to 'cnucnu/package_list.py')
-rwxr-xr-xcnucnu/package_list.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/cnucnu/package_list.py b/cnucnu/package_list.py
index 1615d3f..cdcd426 100755
--- a/cnucnu/package_list.py
+++ b/cnucnu/package_list.py
@@ -134,6 +134,25 @@ class Package(object):
if name_override:
regex = name_override.group(1)
name = name_override.group(2)
+
+ # use DEFAULT regex but alter the name
+ if regex == "CPAN-DEFAULT":
+ # strip "perl-" prefix only if name was not overridden
+ if not name_override and name.startswith("perl-"):
+ name = name[len("perl-"):]
+ regex = "DEFAULT"
+ elif regex == "PEAR-DEFAULT":
+ # strip "php-pear-" prefix only if name was not overridden
+ if not name_override and name.startswith("php-pear-"):
+ name = name[len("php-pear-"):].replace("-","_")
+ regex = "DEFAULT"
+ elif regex == "PECL-DEFAULT":
+ # strip "php-pecl-" prefix only if name was not overridden
+ if not name_override and name.startswith("php-pecl-"):
+ name = name[len("php-pecl-"):].replace("-","_")
+ regex = "DEFAULT"
+
+ # no elif here, because the previous regex aliases are only for name altering
if regex == "DEFAULT":
regex = \
r"\b%s[-_]" % re.escape(name) + \