From 0431c82c03666e4fbdd2cce9ce96a65ee94df517 Mon Sep 17 00:00:00 2001 From: Mac Mollison Date: Sat, 13 Mar 2010 12:54:44 -0500 Subject: Created installer --- install.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 install.py (limited to 'install.py') diff --git a/install.py b/install.py new file mode 100755 index 0000000..720a1ab --- /dev/null +++ b/install.py @@ -0,0 +1,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() + + + -- cgit v1.2.2