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