1 | """ |
---|
2 | Installs the guiframe package |
---|
3 | """ |
---|
4 | import sys |
---|
5 | if len(sys.argv) == 1: |
---|
6 | sys.argv.append('install') |
---|
7 | from distutils.core import setup, Extension |
---|
8 | |
---|
9 | from distutils.sysconfig import get_python_lib |
---|
10 | import os, sys |
---|
11 | |
---|
12 | package_dir = { "sans.guiframe":".", |
---|
13 | "sans.guiframe.local_perspectives":"local_perspectives", |
---|
14 | "sans.guiframe.local_perspectives.plotting":"local_perspectives/plotting"} |
---|
15 | |
---|
16 | packages = ["sans.guiframe", |
---|
17 | "sans.guiframe.local_perspectives", |
---|
18 | "sans.guiframe.local_perspectives.plotting"] |
---|
19 | |
---|
20 | # Check whether the sans module exists, |
---|
21 | # if not, make sure a default __init__ is created |
---|
22 | if 'install' in sys.argv: |
---|
23 | try: |
---|
24 | lib_dir = get_python_lib() |
---|
25 | danse_init = os.path.join(lib_dir, 'sans', '__init__.py') |
---|
26 | if not os.path.isfile(danse_init): |
---|
27 | if not os.path.isdir("tmp_sans"): |
---|
28 | os.mkdir("tmp_sans") |
---|
29 | f = open("tmp_sans/__init__.py",'w') |
---|
30 | f.close() |
---|
31 | package_dir['sans'] = "tmp_sans" |
---|
32 | packages.append("sans") |
---|
33 | except: |
---|
34 | print "Couldn't create sans/__init__.py\n %s" % sys.exc_value |
---|
35 | |
---|
36 | setup( |
---|
37 | name="guiframe", |
---|
38 | version = "0.1", |
---|
39 | description = "Python module for SANS gui framework", |
---|
40 | author = "University of Tennessee", |
---|
41 | url = "http://danse.chem.utk.edu", |
---|
42 | |
---|
43 | package_dir = package_dir, |
---|
44 | |
---|
45 | packages = packages, |
---|
46 | |
---|
47 | package_data={"sans.guiframe": ['images/*']}, |
---|
48 | ) |
---|
49 | |
---|