(re.compile(r"(.+)[-_](\d+)\.(\d+)\.(\d+)\.(\d+)"), parseVer_1234), # xxx-1.2.3.4
(re.compile(r"(.+)[-_](\d\d\d\d)-?(\d\d)-?(\d\d)"), parseVer_ymd), # xxx-YYYY-MM-DD
(re.compile(r"(.+)[-_](\d+)\.(\d+)\.(\d+)\.(\d+)"), parseVer_1234), # xxx-1.2.3.4
(re.compile(r"(.+)[-_](\d\d\d\d)-?(\d\d)-?(\d\d)"), parseVer_ymd), # xxx-YYYY-MM-DD
(re.compile(r"(.+)[-_](\d+)\.(\d+)\.(\d+)(\w?)"), parseVer_123), # xxx-1.2.3a
(re.compile(r"(.+)[-_](\d+)_(\d+)_(\d+)"), parseVer_123), # xxx-1_2_3
(re.compile(r"(.+)[-_](\d+)\.(\d+)(\w?)"), parseVer_12), # xxx-1.2a
(re.compile(r"(.+)[-_](\d+)\.(\d+)\.(\d+)(\w?)"), parseVer_123), # xxx-1.2.3a
(re.compile(r"(.+)[-_](\d+)_(\d+)_(\d+)"), parseVer_123), # xxx-1_2_3
(re.compile(r"(.+)[-_](\d+)\.(\d+)(\w?)"), parseVer_12), # xxx-1.2a
("gcc", re.compile(r"gcc-.*")),
("wl_apsta", re.compile(r"wl_apsta.*")),
(".fw", re.compile(r".*\.fw")),
("gcc", re.compile(r"gcc-.*")),
("wl_apsta", re.compile(r"wl_apsta.*")),
(".fw", re.compile(r".*\.fw")),
raise EntryParseError("ext")
for (regex, parseVersion) in versionRegex:
match = regex.match(filename)
raise EntryParseError("ext")
for (regex, parseVersion) in versionRegex:
match = regex.match(filename)
- print "OpenWRT download directory cleanup utility"
- print "Usage: " + sys.argv[0] + " [OPTIONS] <path/to/dl>"
- print ""
- print " -d|--dry-run Do a dry-run. Don't delete any files"
- print " -B|--show-blacklist Show the blacklist and exit"
- print " -w|--whitelist ITEM Remove ITEM from blacklist"
+ print("OpenWrt download directory cleanup utility")
+ print("Usage: " + sys.argv[0] + " [OPTIONS] <path/to/dl>")
+ print("")
+ print(" -d|--dry-run Do a dry-run. Don't delete any files")
+ print(" -B|--show-blacklist Show the blacklist and exit")
+ print(" -w|--whitelist ITEM Remove ITEM from blacklist")
return 1
if o in ("-B", "--show-blacklist"):
for (name, regex) in blacklist:
return 1
if o in ("-B", "--show-blacklist"):
for (name, regex) in blacklist:
for (name, regex) in blacklist:
if regex.match(filename):
if opt_dryrun:
for (name, regex) in blacklist:
if regex.match(filename):
if opt_dryrun: