#!/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()