source: sasview/sansview/setup_mac.py @ 376346e

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 376346e was 41c284a, checked in by Jae Cho <jhjcho@…>, 13 years ago

added custom datafile: MAC

  • Property mode set to 100644
File size: 3.1 KB
RevLine 
[8d143e8]1"""
[46e7e82]2This is a setup.py script partly generated by py2applet
[8d143e8]3
4Usage:
5    python setup.py py2app
6"""
7from setuptools import setup
[01255b5]8import periodictable.xsf
9import DataLoader.readers 
10from distutils.sysconfig import get_python_lib
11import os
[ce7fce5]12import string
13import local_config
[01255b5]14
[ce7fce5]15ICON = local_config.SetupIconFile_mac
16EXTENSIONS_LIST = []
[01255b5]17DATA_FILES = []
[81875d2]18RESOURCES_FILES = []
[01255b5]19
20#Periodictable data file
[81875d2]21DATA_FILES = periodictable.data_files()
[46e7e82]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()
[8ec6923]27import sans.models as models
28DATA_FILES += models.data_files()
[7d0d6c0]29import sans.guiframe as guiframe
30DATA_FILES += guiframe.data_files()
[46e7e82]31
[81875d2]32#CANSAxml reader data files
[7d0d6c0]33RESOURCES_FILES.append(os.path.join(DataLoader.readers.get_data_path(),'defaults.xml'))
[8d143e8]34
[67ffb10]35# Locate libxml2 library
36lib_locs = ['/usr/local/lib', '/usr/lib']
37libxml_path = None
38for 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]42if libxml_path == None:
43    raise RuntimeError, "Could not find libxml2 on the system"
44
[8d143e8]45APP = ['sansview.py']
[41c284a]46DATA_FILES += ['images','test','plugins','media', 'custom_config.py']
[ce7fce5]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,
[7d0d6c0]85                                   CFBundleTypeName="sansview file",
86                                   CFBundleTypeRole="shell" )],)
[ce7fce5]87                                       
[7d0d6c0]88APP = ['sansview.py']
89DATA_FILES += ['images','test','plugins','media']
[81875d2]90OPTIONS = {'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           }
97setup(
98    app=APP,
99    data_files=DATA_FILES,
[01255b5]100    include_package_data= True,
[8d143e8]101    options={'py2app': OPTIONS},
102    setup_requires=['py2app'],
103)
Note: See TracBrowser for help on using the repository browser.