-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInstall
executable file
·77 lines (69 loc) · 1.44 KB
/
Install
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
#!/bin/sh
#
# Install
###########################################################################
#
# Purpose: This script compiles all *.py files and copies both the *.py
# and the *.pyc files to the given directory.
#
# Usage: Install <library_directory>
#
# where
#
# library_directory is the full path of the directory where
# the *.py and *.pyc files are copied.
#
###########################################################################
cd `dirname $0`
#
# Source the configuration file.
#
. ./Configuration
#
# Verify the arguments to the script.
#
if [ $# -ne 1 ]
then
echo "Usage: $0 <library_directory>"
exit 1
fi
LIBRARY_DIRECTORY=$1
#
# If the library directory does not exist, create it.
#
if [ ! -d ${LIBRARY_DIRECTORY} ]
then
mkdir -p ${LIBRARY_DIRECTORY}
if [ $? -ne 0 ]
then
echo "Cannot create directory: ${LIBRARY_DIRECTORY}"
exit 1
fi
fi
#
# Compile all Python scripts.
#
${PYTHON} -m compileall -l -f .
if [ $? -ne 0 ]
then
echo "Error compiling Python source"
exit 1
fi
#
# Set the proper permissions on the Python files.
#
chmod 775 *.py
#
# Copy the Python files to the given library directory.
#
for FILE in `ls *.py`
do
rm -f ${LIBRARY_DIRECTORY}/${FILE}
cp -p ${FILE} ${LIBRARY_DIRECTORY}
if [ $? -ne 0 ]
then
echo "Cannot copy ${FILE} to ${LIBRARY_DIRECTORY}"
exit 1
fi
done
exit 0