]> git.alsa-project.org Git - alsa.git/commitdiff
hda-analyzer: improve run.py script
authorJaroslav Kysela <perex@perex.cz>
Mon, 1 Feb 2010 12:34:07 +0000 (13:34 +0100)
committerJaroslav Kysela <perex@perex.cz>
Mon, 1 Feb 2010 12:34:07 +0000 (13:34 +0100)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
hda-analyzer/run.py

index 4d4a1a7544a0591563cc8fc860e451a38158b466..0fd48e4bd0d77f15564a156ec4d9a45397b7cbe9 100755 (executable)
@@ -11,6 +11,7 @@ except:
   print "Please, install pygtk2 or python-gtk package"
 
 import os
+import sys
 from urllib import splithost
 from httplib import HTTP
 
@@ -19,10 +20,16 @@ if os.path.exists("/dev/shm"):
 else:
   TMPDIR="/tmp"
 TMPDIR += "/hda-analyzer"
-print "Creating temporary directory: %s" % TMPDIR
+print "Using temporary directory: %s" % TMPDIR
+print "You may remove this directory when finished or if you like to"
+print "download the most recent copy of hda-analyzer tool."
 if not os.path.exists(TMPDIR):
   os.mkdir(TMPDIR)
 for f in FILES:
+  dest = TMPDIR + '/' + f
+  if os.path.exists(dest):
+    print "File cached " + dest
+    continue
   print "Downloading file %s" % f
   host, selector = splithost(URL[5:])
   h = HTTP(host)
@@ -31,6 +38,6 @@ for f in FILES:
   h.getreply()
   contents = h.getfile().read(2*1024*1024)
   h.close()
-  open(TMPDIR + '/' + f, "w+").write(contents)
+  open(dest, "w+").write(contents)
 print "Downloaded all files, executing %s" % FILES[0]
-os.system("python %s" % TMPDIR + '/' + FILES[0])
+os.system("python %s" % TMPDIR + '/' + FILES[0] + ' ' + ' '.join(sys.argv[1:]))