scripts: fix dl_cleanup.py argument handling
The -w|--whitelist and -D|--download-dir arguments pass an additional value, properly evaluate that. Also allow to pass the download directory without -D|--download-dir, just as the usage describes. Finally fix spitting out the wrong error messages about those args. Signed-off-by: Andre Heider <a.heider@gmail.com>
This commit is contained in:
parent
c984fc7624
commit
9a2d362bf7
@ -224,7 +224,7 @@ def main(argv):
|
|||||||
try:
|
try:
|
||||||
(opts, args) = getopt.getopt(
|
(opts, args) = getopt.getopt(
|
||||||
argv[1:],
|
argv[1:],
|
||||||
"hdBwDb:",
|
"hdBw:D:b:",
|
||||||
[
|
[
|
||||||
"help",
|
"help",
|
||||||
"dry-run",
|
"dry-run",
|
||||||
@ -268,12 +268,15 @@ def main(argv):
|
|||||||
if o in ("-b", "--build-dir"):
|
if o in ("-b", "--build-dir"):
|
||||||
builddir = v
|
builddir = v
|
||||||
|
|
||||||
|
if args:
|
||||||
|
directory = args[0]
|
||||||
|
|
||||||
if not os.path.exists(directory):
|
if not os.path.exists(directory):
|
||||||
print("Can't find dl path", directory)
|
print("Can't find download directory", directory)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
if not os.path.exists(builddir):
|
if not os.path.exists(builddir):
|
||||||
print("Can't find dl path", builddir)
|
print("Can't find build directory", builddir)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
# Create a directory listing and parse the file names.
|
# Create a directory listing and parse the file names.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user