source: sasview/sansview/setup_mac.py @ 8d57bdb

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 8d57bdb was 0986586, checked in by Jae Cho <jhjcho@…>, 13 years ago

mac fix for setup_mac

  • Property mode set to 100644
File size: 3.2 KB
RevLine 
[fa597990]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 sans.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
[0986586]23import sans.perspectives.fitting as fitting
24DATA_FILES += fitting.data_files()
[fa597990]25import sans.perspectives.calculator as calculator
26DATA_FILES += calculator.data_files()
27import sans.perspectives.invariant as invariant
28DATA_FILES += invariant.data_files()
29import sans.models as models
30DATA_FILES += models.data_files()
31import sans.guiframe as guiframe
32DATA_FILES += guiframe.data_files()
33
34#CANSAxml reader data files
35RESOURCES_FILES.append(os.path.join(sans.dataloader.readers.get_data_path(),'defaults.xml'))
36
37# Locate libxml2 library
38lib_locs = ['/usr/local/lib', '/usr/lib']
39libxml_path = None
40for item in lib_locs:
41    libxml_path_test = '%s/libxml2.2.dylib' % item
42    if os.path.isfile(libxml_path_test): 
43        libxml_path = libxml_path_test
44if libxml_path == None:
45    raise RuntimeError, "Could not find libxml2 on the system"
46
47APP = ['sansview.py']
[0986586]48DATA_FILES += ['images','test','plugins','media', 'custom_config.py', 'local_config.py']
[fa597990]49# locate file extensions
50def find_extension():
51    """
52    Describe the extensions that can be read by the current application
53    """
54    try:
55        list = []
56        EXCEPTION_LIST = ['*', '.', '']
57        from sans.dataloader.loader import Loader
58        wild_cards = Loader().get_wildcards()
59        for item in wild_cards:
60            #['All (*.*)|*.*']
61            file_type, ext = string.split(item, "|*.", 1)
62            if ext.strip() not in EXCEPTION_LIST and ext.strip() not in list:
63                list.append(ext)
64    except:
65        pass
66    try:
67        file_type, ext = string.split(local_config.APPLICATION_WLIST, "|*.", 1)
68        if ext.strip() not in EXCEPTION_LIST and ext.strip() not in list:
69            list.append(ext)
70    except:
71        pass
72    try:
73        for item in local_config.PLUGINS_WLIST:
74            file_type, ext = string.split(item, "|*.", 1)
75            if ext.strip() not in EXCEPTION_LIST and ext.strip() not in list:
76                list.append(ext) 
77    except:
78        pass
79   
80    return list
81
82EXTENSIONS_LIST = find_extension()
83
84 
85plist = dict(CFBundleDocumentTypes=[dict(CFBundleTypeExtensions=EXTENSIONS_LIST,
86                                         CFBundleTypeIconFile=ICON,
87                                   CFBundleTypeName="sansview file",
88                                   CFBundleTypeRole="Shell" )],)
89
90APP = ['sansview.py']
91DATA_FILES += ['images','test','plugins','media']
92OPTIONS = {'argv_emulation': True,
[0986586]93           'packages': ['lxml','numpy', 'scipy', 'periodictable'],
[fa597990]94           'iconfile': ICON,
95           'frameworks':[libxml_path],
96           'resources': RESOURCES_FILES,
97           'plist':plist,
98           }
99setup(
100    app=APP,
101    data_files=DATA_FILES,
102    include_package_data= True,
103    options={'py2app': OPTIONS},
104    setup_requires=['py2app'],
105)
Note: See TracBrowser for help on using the repository browser.