blob: 720a1abc7e021add4ce0ef1a5c713120f14d8102 (
plain) (
blame)
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
|
#!/usr/bin/env python
################################################################################
# Description
################################################################################
# This script installes (or re-installs) the unit_trace Python module, so that
# the unit_trace library can be imported with `import unit_trace` by a Python
# script, from anywhere on the system.
# The installation merely consists of copying the unit_trace directory to
# the default site_packages directory (which is the appropriate place to
# install Python packages).
# We do not use the Distutils system, provided by Python, because that
# is less convenient :-)
################################################################################
# Imports
################################################################################
import sys
import shutil
import os
################################################################################
# Do the install
################################################################################
# Determine destination directory for unit_trace module
dst = os.path.join(sys.prefix,'lib/python2.6/site-packages/unit_trace')
try:
# If the destination exists
if os.path.exists(dst):
# Delete it
shutil.rmtree(dst)
# Copy source to destination
shutil.copytree('unit_trace', dst)
except:
print("Error occurred. Make sure you run the script as root/with sudo.")
exit()
|