[8d143e8] | 1 | """ |
---|
[46e7e82] | 2 | This is a setup.py script partly generated by py2applet |
---|
[8d143e8] | 3 | |
---|
| 4 | Usage: |
---|
| 5 | python setup.py py2app |
---|
| 6 | """ |
---|
| 7 | from setuptools import setup |
---|
[01255b5] | 8 | import periodictable.xsf |
---|
| 9 | import DataLoader.readers |
---|
| 10 | from distutils.sysconfig import get_python_lib |
---|
| 11 | import os |
---|
[ce7fce5] | 12 | import string |
---|
| 13 | import local_config |
---|
[01255b5] | 14 | |
---|
[ce7fce5] | 15 | ICON = local_config.SetupIconFile_mac |
---|
| 16 | EXTENSIONS_LIST = [] |
---|
[01255b5] | 17 | DATA_FILES = [] |
---|
[81875d2] | 18 | RESOURCES_FILES = [] |
---|
[01255b5] | 19 | |
---|
| 20 | #Periodictable data file |
---|
[81875d2] | 21 | DATA_FILES = periodictable.data_files() |
---|
[46e7e82] | 22 | #invariant and calculator help doc |
---|
| 23 | import sans.perspectives.calculator as calculator |
---|
| 24 | DATA_FILES += calculator.data_files() |
---|
| 25 | import sans.perspectives.invariant as invariant |
---|
| 26 | DATA_FILES += invariant.data_files() |
---|
[8ec6923] | 27 | import sans.models as models |
---|
| 28 | DATA_FILES += models.data_files() |
---|
[7d0d6c0] | 29 | import sans.guiframe as guiframe |
---|
| 30 | DATA_FILES += guiframe.data_files() |
---|
[46e7e82] | 31 | |
---|
[81875d2] | 32 | #CANSAxml reader data files |
---|
[7d0d6c0] | 33 | RESOURCES_FILES.append(os.path.join(DataLoader.readers.get_data_path(),'defaults.xml')) |
---|
[8d143e8] | 34 | |
---|
[67ffb10] | 35 | # Locate libxml2 library |
---|
| 36 | lib_locs = ['/usr/local/lib', '/usr/lib'] |
---|
| 37 | libxml_path = None |
---|
| 38 | for item in lib_locs: |
---|
[e6093db] | 39 | libxml_path_test = '%s/libxml2.2.dylib' % item |
---|
[2eb3a682] | 40 | if os.path.isfile(libxml_path_test): |
---|
| 41 | libxml_path = libxml_path_test |
---|
[67ffb10] | 42 | if libxml_path == None: |
---|
| 43 | raise RuntimeError, "Could not find libxml2 on the system" |
---|
| 44 | |
---|
[8d143e8] | 45 | APP = ['sansview.py'] |
---|
[46e7e82] | 46 | DATA_FILES += ['images','test','plugins','media'] |
---|
[ce7fce5] | 47 | # locate file extensions |
---|
| 48 | def find_extension(): |
---|
| 49 | """ |
---|
| 50 | Describe the extensions that can be read by the current application |
---|
| 51 | """ |
---|
| 52 | try: |
---|
| 53 | list = [] |
---|
| 54 | EXCEPTION_LIST = ['*', '.', ''] |
---|
| 55 | from DataLoader.loader import Loader |
---|
| 56 | wild_cards = Loader().get_wildcards() |
---|
| 57 | for item in wild_cards: |
---|
| 58 | #['All (*.*)|*.*'] |
---|
| 59 | file_type, ext = string.split(item, "|*.", 1) |
---|
| 60 | if ext.strip() not in EXCEPTION_LIST and ext.strip() not in list: |
---|
| 61 | list.append(ext) |
---|
| 62 | except: |
---|
| 63 | pass |
---|
| 64 | try: |
---|
| 65 | file_type, ext = string.split(local_config.APPLICATION_WLIST, "|*.", 1) |
---|
| 66 | if ext.strip() not in EXCEPTION_LIST and ext.strip() not in list: |
---|
| 67 | list.append(ext) |
---|
| 68 | except: |
---|
| 69 | pass |
---|
| 70 | try: |
---|
| 71 | for item in local_config.PLUGINS_WLIST: |
---|
| 72 | file_type, ext = string.split(item, "|*.", 1) |
---|
| 73 | if ext.strip() not in EXCEPTION_LIST and ext.strip() not in list: |
---|
| 74 | list.append(ext) |
---|
| 75 | except: |
---|
| 76 | pass |
---|
| 77 | |
---|
| 78 | return list |
---|
| 79 | |
---|
| 80 | EXTENSIONS_LIST = find_extension() |
---|
| 81 | |
---|
| 82 | |
---|
| 83 | plist = dict(CFBundleDocumentTypes=[dict(CFBundleTypeExtensions=EXTENSIONS_LIST, |
---|
| 84 | CFBundleTypeIconFile=ICON, |
---|
[7d0d6c0] | 85 | CFBundleTypeName="sansview file", |
---|
| 86 | CFBundleTypeRole="shell" )],) |
---|
[ce7fce5] | 87 | |
---|
[7d0d6c0] | 88 | APP = ['sansview.py'] |
---|
| 89 | DATA_FILES += ['images','test','plugins','media'] |
---|
[81875d2] | 90 | OPTIONS = {'argv_emulation': True, |
---|
| 91 | 'packages': ['lxml','periodictable'], |
---|
[ce7fce5] | 92 | 'iconfile': ICON, |
---|
[67ffb10] | 93 | 'frameworks':[libxml_path], |
---|
[e52010a] | 94 | 'resources': RESOURCES_FILES, |
---|
[7d0d6c0] | 95 | 'plist':plist, |
---|
[8d143e8] | 96 | } |
---|
| 97 | setup( |
---|
| 98 | app=APP, |
---|
| 99 | data_files=DATA_FILES, |
---|
[01255b5] | 100 | include_package_data= True, |
---|
[8d143e8] | 101 | options={'py2app': OPTIONS}, |
---|
| 102 | setup_requires=['py2app'], |
---|
| 103 | ) |
---|