This repository has been archived by the owner on Jun 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_vvtest
executable file
·83 lines (60 loc) · 1.94 KB
/
install_vvtest
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/env python
import sys
sys.dont_write_bytecode = True
sys.excepthook = sys.__excepthook__
import os
import getopt
import distutils
from distutils.dir_util import copy_tree
from distutils.file_util import copy_file
help_string = """
USAGE:
install_vvtest [OPTIONS] <install directory>
SYNOPSIS:
An installer for vvtest. The main vvtest executable will be installed
in <install directory>, and subdirectories will be batch, config, and
libvvtest.
OPTIONS:
-h, --help : this help page
"""
def main():
""
try:
optL,argL = getopt.getopt( sys.argv[1:], 'h', ['help'] )
except getopt.error as e:
print3( '*** error: '+str(e), file=sys.stderr )
sys.exit(1)
if ('-h','') in optL or ('--help','') in optL:
print3( help_string )
return
if len(argL) != 1:
print3( '*** error: installation directory required', file=sys.stderr )
sys.exit(1)
todir = os.path.normpath( os.path.abspath( argL[0] ) )
copy_path( 'vvt/vvtest', todir )
copy_path( 'vvt/results.py', todir )
copy_path( 'vvt/libvvtest', todir )
copy_path( 'vvt/config', todir )
copy_path( 'vvt/batch', todir )
copy_path( 'trig', todir )
#########################################################################
def copy_path( relpath, todir ):
""
frompath = os.path.join( mydir, relpath )
bn = os.path.basename( relpath )
topath = os.path.join( todir, bn )
if not os.path.exists( todir ):
os.makedirs( todir )
if os.path.isdir( frompath ):
copy_tree( frompath, topath, preserve_symlinks=1 )
else:
copy_file( frompath, topath )
def print3( *args, **kwargs ):
""
s = ' '.join( [ str(x) for x in args ] )
fileobj = kwargs.get( 'file', sys.stdout )
fileobj.write( s + '\n' )
fileobj.flush()
#########################################################################
mydir = os.path.dirname( os.path.abspath( __file__ ) )
main()