diff options
author | Mac Mollison <mollison@cs.unc.edu> | 2010-03-27 17:29:35 -0400 |
---|---|---|
committer | Mac Mollison <mollison@cs.unc.edu> | 2010-03-27 17:29:35 -0400 |
commit | 24915c91a15906c50121656da17230123aee48d1 (patch) | |
tree | bd681b4d0b34b1294c21fc5ef3d56939f1622f58 /install.py | |
parent | 841902573bb00724b9ab3f2938a60a1b17298618 (diff) |
Update installer: Install in ~/bin
This provides two advantages:
(1) Don't need root to install unit-trace
(2) Someone messing with the unit-trace code on a shared machine
won't mess up anyone else who's also using unit-trace on
that machine
Diffstat (limited to 'install.py')
-rwxr-xr-x | install.py | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -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 |
33 | dst = os.path.join(sys.prefix,'lib/python2.6/site-packages/unit_trace') | 32 | dst = '~/bin/unit_trace' |
33 | dst = os.path.expanduser(dst) | ||
34 | 34 | ||
35 | try: | 35 | try: |
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) |
42 | except: | 42 | except: |
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 |
47 | dst = '/usr/bin/unit-trace' | 47 | dst = '~/bin/unit-trace' |
48 | dst = os.path.expanduser(dst) | ||
48 | try: | 49 | try: |
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) |
52 | except: | 53 | except: |
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 | ||