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