source: sasview/sansview/setup_mac.py @ c958e30

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since c958e30 was 37290c4, checked in by Jae Cho <jhjcho@…>, 14 years ago

fixed minor bug

  • Property mode set to 100644
File size: 3.1 KB
Line 
1"""
2This is a setup.py script partly generated by py2applet
3
4Usage:
5    python setup.py py2app
6"""
7from setuptools import setup
8import periodictable.xsf
9import DataLoader.readers 
10from distutils.sysconfig import get_python_lib
11import os
12import string
13import local_config
14
15ICON = local_config.SetupIconFile_mac
16EXTENSIONS_LIST = []
17DATA_FILES = []
18RESOURCES_FILES = []
19
20#Periodictable data file
21DATA_FILES = periodictable.data_files()
22#invariant and calculator help doc
23import sans.perspectives.calculator as calculator
24DATA_FILES += calculator.data_files()
25import sans.perspectives.invariant as invariant
26DATA_FILES += invariant.data_files()
27import sans.models as models
28DATA_FILES += models.data_files()
29import sans.guiframe as guiframe
30DATA_FILES += guiframe.data_files()
31
32#CANSAxml reader data files
33RESOURCES_FILES.append(os.path.join(DataLoader.readers.get_data_path(),'defaults.xml'))
34
35# Locate libxml2 library
36lib_locs = ['/usr/local/lib', '/usr/lib']
37libxml_path = None
38for item in lib_locs:
39    libxml_path_test = '%s/libxml2.2.dylib' % item
40    if os.path.isfile(libxml_path_test): 
41        libxml_path = libxml_path_test
42if libxml_path == None:
43    raise RuntimeError, "Could not find libxml2 on the system"
44
45APP = ['sansview.py']
46DATA_FILES += ['images','test','plugins','media', 'custom_config.py']
47# locate file extensions
48def 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
80EXTENSIONS_LIST = find_extension()
81
82 
83plist = dict(CFBundleDocumentTypes=[dict(CFBundleTypeExtensions=EXTENSIONS_LIST,
84                                         CFBundleTypeIconFile=ICON,
85                                   CFBundleTypeName="sansview file",
86                                   CFBundleTypeRole="Shell" )],)
87
88APP = ['sansview.py']
89DATA_FILES += ['images','test','plugins','media']
90OPTIONS = {'argv_emulation': True,
91           'packages': ['lxml','periodictable'],
92           'iconfile': ICON,
93           'frameworks':[libxml_path],
94           'resources': RESOURCES_FILES,
95           'plist':plist,
96           }
97setup(
98    app=APP,
99    data_files=DATA_FILES,
100    include_package_data= True,
101    options={'py2app': OPTIONS},
102    setup_requires=['py2app'],
103)
Note: See TracBrowser for help on using the repository browser.