diff options
author | Nicholas Corgan <nick.corgan@ettus.com> | 2012-11-07 14:30:13 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2012-11-08 18:14:25 -0800 |
commit | 61ea2e9142df524cf6d1dc32d2fde9f4ce477b36 (patch) | |
tree | 92136268cc6f7fbcd4f0ca1312abfbe59a878761 | |
parent | 43955f18215fe582b786b9ac3d1b3b195d053ab3 (diff) | |
download | uhd-61ea2e9142df524cf6d1dc32d2fde9f4ce477b36.tar.gz uhd-61ea2e9142df524cf6d1dc32d2fde9f4ce477b36.tar.bz2 uhd-61ea2e9142df524cf6d1dc32d2fde9f4ce477b36.zip |
utils: fixed images downloader Mac incompatibility issue
-rw-r--r-- | host/utils/uhd_images_downloader.py.in | 18 |
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" |