[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 |
---|
[febcd79] | 11 | |
---|
[ae83ad3] | 12 | if len(sys.argv) == 1: |
---|
| 13 | sys.argv.append('install') |
---|
[8db3904] | 14 | |
---|
| 15 | path = os.path.join(os.getcwd(), 'local_perspectives') |
---|
[b90decd] | 16 | package_dir = { "sans.guiframe":".", |
---|
[ba924ed] | 17 | "sans.guiframe.local_perspectives":"local_perspectives", |
---|
| 18 | "sans.guiframe.widgets":"widgets"} |
---|
[b90decd] | 19 | packages = ["sans.guiframe", |
---|
[ba924ed] | 20 | "sans.guiframe.local_perspectives", |
---|
| 21 | "sans.guiframe.widgets"] |
---|
[8db3904] | 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 | |
---|
[b90decd] | 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 | |
---|
[41d466f] | 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 | |
---|
[b90decd] | 52 | package_dir = package_dir, |
---|
| 53 | |
---|
| 54 | packages = packages, |
---|
[41d466f] | 55 | |
---|
| 56 | package_data={"sans.guiframe": ['images/*']}, |
---|
| 57 | ) |
---|
| 58 | |
---|