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