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