forked from keyianpai/hft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
copy_header.py
39 lines (35 loc) · 1.22 KB
/
copy_header.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import shutil
import subprocess
import sys
import os
def GetUserPath():
user = os.getcwd().split('/')[1]
if user == 'root':
user_path = '/root/'
elif user == 'home':
user_path = '/home/' + os.getcwd().split('/')[2] + '/'
else:
print('unknown user!%s' %(os.getcwd()))
sys.exit(1)
return user_path
def Copy():
if not os.path.exists(GetUserPath()+'lib-hft'):
print("%s not existed!"%(GetUserPath()+'lib-hft'))
return
dir_list = ['struct', 'util', 'core']
header_path = GetUserPath() + 'lib-hft/include/'
target_path = GetUserPath() + 'hft/external/common/include/'
for dl in dir_list:
for f in os.listdir(header_path+dl):
if f.split('.')[-1] == 'h' or f.split('.')[-1] == 'hpp':
print('copying %s from %s to %s' % (f, header_path+dl, target_path+dl))
command = 'cp -rf %s %s' % (header_path+dl+"/"+f, target_path+dl)
os.system(command)
for f in os.listdir(header_path):
if f.split('.')[-1] != 'h' and f.split('.')[-1] != 'hpp':
continue
shutil.copy(header_path+f, target_path)
print('copying %s to %s' % (header_path+f, target_path))
shutil.copy("/root/lib-hft/lib/libnick.so", '/root/hft/external/common/lib')
if __name__ == '__main__':
Copy()