aboutsummaryrefslogtreecommitdiffstats
path: root/host/utils
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2012-11-08 18:14:44 -0800
committerJosh Blum <josh@joshknows.com>2012-11-08 18:14:44 -0800
commitc7968a6b0e544236657946943610b9a147b7d569 (patch)
tree7128815030a34b46f5ce70163fe85f9fac115cd5 /host/utils
parent79a26e96676d7260f492728ba61b237a402df926 (diff)
parent61ea2e9142df524cf6d1dc32d2fde9f4ce477b36 (diff)
downloaduhd-c7968a6b0e544236657946943610b9a147b7d569.tar.gz
uhd-c7968a6b0e544236657946943610b9a147b7d569.tar.bz2
uhd-c7968a6b0e544236657946943610b9a147b7d569.zip
Merge branch 'maint'
Diffstat (limited to 'host/utils')
-rw-r--r--host/utils/uhd_images_downloader.py.in18
1 files changed, 13 insertions, 5 deletions
diff --git a/host/utils/uhd_images_downloader.py.in b/host/utils/uhd_images_downloader.py.in
index 6aa619660..59c0fbafe 100644
--- a/host/utils/uhd_images_downloader.py.in
+++ b/host/utils/uhd_images_downloader.py.in
@@ -16,11 +16,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
+import atexit
from optparse import OptionParser
import os
import os.path
import shutil
import sys
+import tempfile
import urllib2
import zipfile
@@ -28,18 +30,24 @@ if __name__ == "__main__":
#Command line options
parser = OptionParser()
- parser.add_option("--download-location", type="string", default="@CMAKE_INSTALL_PREFIX@/share/uhd/images", help="Set custom download location for images, [default=%default]")
+ parser.add_option("--install-location", type="string", default="@CMAKE_INSTALL_PREFIX@/share/uhd/images", help="Set custom install location for images, [default=%default]")
parser.add_option("--buffer-size", type="int", default=8192, help="Set download buffer size, [default=%default]",)
(options, args) = parser.parse_args()
#Configuring image download info
images_src = "@UHD_IMAGES_DOWNLOAD_SRC@"
filename = images_src.split("/")[-1]
-
+
+ #Create temporary directory
+ download_dir = tempfile.mkdtemp()
+ atexit.register(lambda: shutil.rmtree(download_dir))
+
+ #Make sure we download into the correct directory
+ os.chdir(download_dir)
+
#Configuring image destination
- cmake_install_prefix = "@CMAKE_INSTALL_PREFIX@"
- if options.download_location != "":
- images_dir = options.download_location
+ if options.install_location != "":
+ images_dir = options.install_location
else:
images_dir = "@CMAKE_INSTALL_PREFIX@/share/uhd/images"