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