<commit_before>"""
This is a setup.py script partly generated by py2applet

Usage:
    python setup.py py2app
"""
from setuptools import setup
import periodictable.xsf
import DataLoader.readers 
from distutils.sysconfig import get_python_lib
import os
import string
import local_config

ICON = local_config.SetupIconFile_mac
DATA_FILES = []
RESOURCES_FILES = []
EXTENSIONS_LIST = []

#Periodictable data file
DATA_FILES = periodictable.data_files()
#add guiframe data file
import sans.guiframe as guiframe
DATA_FILES += guiframe.data_files()
#invariant and calculator help doc
import sans.perspectives.calculator as calculator
DATA_FILES += calculator.data_files()
import sans.perspectives.invariant as invariant
DATA_FILES += invariant.data_files()
import sans.models as models
DATA_FILES += models.data_files()

#CANSAxml reader data files
RESOURCES_FILES.append(os.path.join(DataLoader.readers.get_data_path(),
                                    'defaults.xml'))
# locate file extensions
def find_extension():
    """
    Describe the extensions that can be read by the current application
    """
    try:
        list = []
        EXCEPTION_LIST = ['*', '.', '']
        #(ext, type, name, flags)
        from DataLoader.loader import Loader
        wild_cards = Loader().get_wildcards()
        for item in wild_cards:
            #['All (*.*)|*.*']
            file_type, ext = string.split(item, "|*.", 1)
            if ext.strip() not in EXCEPTION_LIST and ext.strip() not in list:
                list.append((ext, 'string', file_type))
    except:
        raise
    try:
        file_type, ext = string.split(local_config.APPLICATION_WLIST, "|*.", 1)
        if ext.strip() not in EXCEPTION_LIST and ext.strip() not in list:
            list.append((ext, 'string', file_type))
    except:
        raise
    try:
        for item in local_config.PLUGINS_WLIST:
            file_type, ext = string.split(item, "|*.", 1)
            if ext.strip() not in EXCEPTION_LIST and ext.strip() not in list:
                list.append((ext, 'string', file_type)) 
    except:
        raise
    
    return list

EXTENSIONS_LIST = find_extension()
temp = []
for (ext, _, file_type) in EXTENSIONS_LIST:
    val= dict(CFBundleTypeTypeExtensions=[str(ext)],
         CFBundleTypeIconFile=ICON,
         #CFBundleTypeName=str(file_type),
         CFBundleTypeRole="Viewer")
    temp.append(val)
  
PLIST = dict(CFBundleDocumentTypes=temp, )
print temp
print PLIST    

# Locate libxml2 library
lib_locs = ['/usr/local/lib', '/usr/lib']
libxml_path = None
for item in lib_locs:
    libxml_path_test = '%s/libxml2.2.dylib' % item
    if os.path.isfile(libxml_path_test): 
        libxml_path = libxml_path_test
if libxml_path == None:
    raise RuntimeError, "Could not find libxml2 on the system"

APP = ['sansview.py']
DATA_FILES += ['images','test','plugins','media']
OPTIONS = {'argv_emulation': True,
           'packages': ['lxml','periodictable'],
           'iconfile': ICON,
           'frameworks':[libxml_path],
           'resources': RESOURCES_FILES,
           'plist':PLIST
           }

setup(
    app=APP,
    data_files=DATA_FILES,
    include_package_data= True,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
)
<commit_msg>allow  opening sansview .svs with double click<commit_after>"""
This is a setup.py script partly generated by py2applet

Usage:
    python setup.py py2app
"""
from setuptools import setup
import periodictable.xsf
import DataLoader.readers 
from distutils.sysconfig import get_python_lib
import os

DATA_FILES = []
RESOURCES_FILES = []

#Periodictable data file
DATA_FILES = periodictable.data_files()

#invariant and calculator help doc
import sans.perspectives.calculator as calculator
DATA_FILES += calculator.data_files()
import sans.perspectives.invariant as invariant
DATA_FILES += invariant.data_files()
import sans.models as models
DATA_FILES += models.data_files()
import sans.guiframe as guiframe
DATA_FILES += guiframe.data_files()

#CANSAxml reader data files
RESOURCES_FILES.append(os.path.join(DataLoader.readers.get_data_path(),'defaults.xml'))

# Locate libxml2 library
lib_locs = ['/usr/local/lib', '/usr/lib']
libxml_path = None
for item in lib_locs:
    libxml_path_test = '%s/libxml2.2.dylib' % item
    if os.path.isfile(libxml_path_test): 
        libxml_path = libxml_path_test
if libxml_path == None:
    raise RuntimeError, "Could not find libxml2 on the system"

APP = ['sansview.py']
DATA_FILES += ['images','test','plugins','media']
plist = dict(CFBundleDocumentTypes=[dict(CFBundleTypeExtensions=["svs"],
                                         CFBundleTypeIconFile='images/ball.icns',
                                   CFBundleTypeName="sansview file",
                                   CFBundleTypeRole="shell" )],)
                                         #)],)
APP = ['sansview.py']
DATA_FILES += ['images','test','plugins','media']
OPTIONS = {'argv_emulation': True,
           'packages': ['lxml','periodictable'],
           'iconfile': 'images/ball.icns',
           'frameworks':[libxml_path],
           'resources': RESOURCES_FILES,
           'plist':plist,
           }
setup(
    app=APP,
    data_files=DATA_FILES,
    include_package_data= True,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
)
{'fraction_non_alphanumeric': 0.11575381140598531, 'fraction_numerical': 0.0035761340109166195, 'mean_word_length': 3.1515625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 26}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 7, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3703778', 'n_tokens_mistral': 1714, 'n_tokens_neox': 1630, 'n_words': 393}