Fix error in downloading hippomocks library.
[platform/upstream/iotivity.git] / extlibs / hippomocks.scons
1 ##
2 # 'hippomocks' script to check if Hippo Mocks Unit Test library is installed.
3 # If not, get it and install it
4 #
5 ##
6
7 import os, sys
8
9 Import('env')
10
11 target_os = env.get('TARGET_OS')
12 src_dir = env.get('SRC_DIR')
13
14 # Only verify/install on linux
15 if target_os == 'linux':
16         print '*** Checking for installation of hippomocks ***'
17
18         hippomocks_sha      = '2f40aa11e31499432283b67f9d3449a3cd7b9c4d'
19         hippomocks_dir_src  = src_dir + '/extlibs/hippomocks-' + hippomocks_sha
20         hippomocks_dir_dest = src_dir + '/extlibs/hippomocks-master'
21         hippomocks_zip_file = src_dir + '/extlibs/hippomocks-' + hippomocks_sha + '.zip'
22         hippomocks_url      = 'https://github.com/dascandy/hippomocks/archive/' + hippomocks_sha + '.zip'
23
24         if not os.path.exists(hippomocks_dir_dest):
25                 # If the hippomocks zip file is not already present, download it
26                 if not os.path.exists(hippomocks_zip_file):
27                         hippomocks_zip = env.Download(hippomocks_zip_file, hippomocks_url)
28                 else:
29                         hippomocks_zip = hippomocks_zip_file
30
31                 # Unzip hippomocks
32                 print 'Unzipping hippomocks'
33                 env.UnpackAll(hippomocks_dir_src, hippomocks_zip)
34                 print 'Renaming hippomocks directory'
35                 os.rename(hippomocks_dir_src, hippomocks_dir_dest)
36
37