source: trunk/bin/install@ 1163

Last change on this file since 1163 was 1163, checked in by mar637, 18 years ago

install script for binary release

  • Property svn:executable set to *
File size: 2.1 KB
Line 
1#!/usr/bin/env python
2
3import distutils.sysconfig as dist
4import shutil
5import os
6import sys
7import getopt
8
9def usage():
10 pass
11
12try:
13 opts, args = getopt.getopt(sys.argv[1:], "p:m:h",
14 ["exec-prefix=", "module-dir=", "help"])
15
16except getopt.GetoptError:
17 print "error"
18 sys.exit(2)
19
20execprefix = dist.EXEC_PREFIX
21moduledir = dist.get_python_lib()
22for k, v in opts:
23 if k in ("-h", "--help"):
24 usage()
25 sys.exit()
26 if k in ("-p", "--exec-prefix"):
27 v = os.path.expanduser(v)
28 v = os.path.expandvars(v)
29 if not os.path.exists(v):
30 print "The specified exec directory %s doesn't exist" % v
31 sys.exit(1)
32 p = os.path.join(v,"bin")
33 if not os.path.exists(p):
34 print "The specified exec directory %s doesn't exist" % p
35 sys.exit(1)
36 execprefix = v
37 if k in ("-m", "--module-dir"):
38 v = os.path.expanduser(v)
39 v = os.path.expandvars(v)
40 if not os.path.exists(v):
41 print "The specified module directory %s doesn't exist" % v
42 sys.exit(1)
43 moduledir = v
44
45print 'Looking for dependent modules...'
46try:
47 import matplotlib
48except ImportError:
49 print "Matplotlib not found"
50 sys.exit(1)
51try:
52 import matplotlib.backends.backend_tkagg
53except ImportError:
54 print "Matplotlib doesn't have Tk support"
55 sys.exit(1)
56try:
57 import numpy
58except ImportError:
59 try:
60 import numarray
61 except ImportError:
62 print "You need to have either 'numpy' or 'numarray' installed."
63 sys.exit(1)
64print "Looks like everything is here"
65moddir = os.path.join(moduledir, "asap")
66bindir = os.path.join(execprefix, "bin")
67try:
68 if os.path.exists(moddir):
69 print "Found previous installation of ASAP. Removing..."
70 shutil.rmtree(moddir)
71 print "Installing asap module in %s" % moddir
72 shutil.copytree("asap", moddir)
73 print "Installing asap startup script in %s" % bindir
74 shutil.copy2("bin/asap", bindir)
75 shutil.copytree("data", os.path.join(moddir,"data"))
76 print "Installation completed."
77except OSError, oe:
78 print oe
Note: See TracBrowser for help on using the repository browser.