Update Snapshot(2018-12-12)
[platform/upstream/iotivity.git] / extlibs / hippomocks.scons
1 #******************************************************************
2 #
3 # Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
4 #
5 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #      http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 ##
22 # 'hippomocks' script to check if Hippo Mocks Unit Test library is installed.
23 # If not, get it and install it
24 #
25 ##
26
27 import os, sys
28
29 Import('env')
30
31 target_os = env.get('TARGET_OS')
32 src_dir = env.get('SRC_DIR')
33
34 # Only verify/install on linux
35 if target_os in ['linux']:
36         print '*** Checking for installation of hippomocks ***'
37
38         hippomocks_sha      = '8e210c5808d490b26fff69151c801fa28d291fcb'
39         hippomocks_dir_src  = src_dir + '/extlibs/hippomocks-' + hippomocks_sha
40         hippomocks_dir_dest = src_dir + '/extlibs/hippomocks-master'
41         hippomocks_zip_file = src_dir + '/extlibs/hippomocks-' + hippomocks_sha + '.zip'
42         hippomocks_url      = 'https://github.com/dascandy/hippomocks/archive/' + hippomocks_sha + '.zip'
43
44         if not os.path.exists(hippomocks_dir_dest):
45                 # If the hippomocks zip file is not already present, download it
46                 if not os.path.exists(hippomocks_zip_file):
47                         hippomocks_zip = env.Download(hippomocks_zip_file, hippomocks_url)
48                 else:
49                         hippomocks_zip = hippomocks_zip_file
50
51                 # Unzip hippomocks
52                 print 'Unzipping hippomocks'
53                 env.UnpackAll(hippomocks_dir_src, hippomocks_zip)
54                 print 'Renaming hippomocks directory'
55                 os.rename(hippomocks_dir_src, hippomocks_dir_dest)
56
57
58