summaryrefslogtreecommitdiffstats
path: root/install.py
diff options
context:
space:
mode:
Diffstat (limited to 'install.py')
-rwxr-xr-xinstall.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/install.py b/install.py
index b06462c..af42b71 100755
--- a/install.py
+++ b/install.py
@@ -8,9 +8,8 @@
8# the unit_trace library can be imported with `import unit_trace` by a Python 8# the unit_trace library can be imported with `import unit_trace` by a Python
9# script, from anywhere on the system. 9# script, from anywhere on the system.
10 10
11# The installation merely consists of copying the unit_trace directory to 11# The installation merely copies the unit-trace script and the unit_trace
12# the default site_packages directory (which is the appropriate place to 12# folder to ~/bin. You can also do this manually if you want to.
13# install Python packages).
14 13
15# We do not use the Distutils system, provided by Python, because that 14# We do not use the Distutils system, provided by Python, because that
16# is less convenient :-) 15# is less convenient :-)
@@ -30,7 +29,8 @@ import os
30################################################################################ 29################################################################################
31 30
32# Determine destination directory for unit_trace module 31# Determine destination directory for unit_trace module
33dst = os.path.join(sys.prefix,'lib/python2.6/site-packages/unit_trace') 32dst = '~/bin/unit_trace'
33dst = os.path.expanduser(dst)
34 34
35try: 35try:
36 # If the destination exists 36 # If the destination exists
@@ -40,17 +40,18 @@ try:
40 # Copy source to destination 40 # Copy source to destination
41 shutil.copytree('unit_trace', dst) 41 shutil.copytree('unit_trace', dst)
42except: 42except:
43 print("Error occurred. Make sure you run the script as root/with sudo.") 43 print("Error occurred.")
44 exit() 44 exit()
45 45
46# Determine destination directory for unit-trace script 46# Determine destination directory for unit-trace script
47dst = '/usr/bin/unit-trace' 47dst = '~/bin/unit-trace'
48dst = os.path.expanduser(dst)
48try: 49try:
49 shutil.copyfile('unit-trace', dst) 50 shutil.copyfile('unit-trace', dst)
50 # Keep same permissions 51 # Keep same permissions
51 shutil.copystat('unit-trace', dst) 52 shutil.copystat('unit-trace', dst)
52except: 53except:
53 print("Error occurred. Make sure you run the script as root/with sudo.") 54 print("Error occurred.")
54 exit() 55 exit()
55 56
56 57