aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAnsuel Smith <ansuelsmth@gmail.com>2021-07-06 03:25:06 +0200
committerChristian Marangi <ansuelsmth@gmail.com>2022-09-14 01:34:47 +0200
commit69760d415dddb0325bd0eb6bb607624747a2da6e (patch)
tree0675eabc146f331274e1fd5541d1b46e5d695ba4 /scripts
parent428c5bf3d1b8a245d1fc3e8be6e23058c59aba8c (diff)
downloadupstream-69760d415dddb0325bd0eb6bb607624747a2da6e.tar.gz
upstream-69760d415dddb0325bd0eb6bb607624747a2da6e.tar.bz2
upstream-69760d415dddb0325bd0eb6bb607624747a2da6e.zip
scripts: assume dl/ the default dir for dl_cleanup script
Assume dl/ the default dl dir and make it configurable if someone have that in a different place. Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/dl_cleanup.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/scripts/dl_cleanup.py b/scripts/dl_cleanup.py
index d22762136a..c3b427c436 100755
--- a/scripts/dl_cleanup.py
+++ b/scripts/dl_cleanup.py
@@ -185,6 +185,9 @@ def usage():
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(
+ " -D|--download-dir Provide path to dl dir to clean also the build directory"
+ )
def main(argv):
@@ -193,25 +196,20 @@ def main(argv):
try:
(opts, args) = getopt.getopt(
argv[1:],
- "hdBw:",
+ "hdBwD:",
[
"help",
"dry-run",
"show-blacklist",
"whitelist=",
+ "download-dir=",
],
)
- if len(args) != 1:
- usage()
- return 1
except getopt.GetoptError as e:
usage()
return 1
- directory = args[0]
- if not os.path.exists(directory):
- print("Can't find dl path", directory)
- return 1
+ directory = "dl/"
for (o, v) in opts:
if o in ("-h", "--help"):
@@ -235,6 +233,12 @@ def main(argv):
sep = "\t"
print("%s%s(%s)" % (name, sep, regex.pattern))
return 0
+ if o in ("-D", "--download-dir"):
+ directory = v
+
+ if not os.path.exists(directory):
+ print("Can't find dl path", directory)
+ return 1
# Create a directory listing and parse the file names.
entries = []