Changeset e715e4f in sasview for sansmodels/src


Ignore:
Timestamp:
Feb 22, 2011 12:33:36 PM (14 years ago)
Author:
Jae Cho <jhjcho@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
18cdddb
Parents:
cf9b6950
Message:

moved model function help files

Location:
sansmodels/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sansmodels/src/sans/__init__.py

    rae3ce4e re715e4f  
     1#PLUGIN_ID = "models plug-in 0.4" 
     2from models import * 
     3 
     4import os 
     5from distutils.filelist import findall 
     6 
     7def get_data_path(media): 
     8    """ 
     9    """ 
     10    # Check for data path in the package 
     11    path = os.path.join(os.path.dirname(models.__file__), media) 
     12    if os.path.isdir(path): 
     13        return path 
     14 
     15    # Check for data path next to exe/zip file. 
     16    # If we are inside a py2exe zip file, we need to go up 
     17    # to get to the directory containing  
     18    # the media for this module 
     19    path = os.path.dirname(models.__file__) 
     20    #Look for maximum n_dir up of the current dir to find media 
     21    n_dir = 12 
     22    for i in range(n_dir): 
     23        path, _ = os.path.split(path) 
     24        media_path = os.path.join(path, media) 
     25        if os.path.isdir(media_path): 
     26            module_media_path = os.path.join(media_path, 'models_media') 
     27            if os.path.isdir(module_media_path): 
     28                return module_media_path 
     29            return media_path 
     30    
     31    raise RuntimeError('Could not find models media files') 
     32 
     33def data_files(): 
     34    """ 
     35    Return the data files associated with media. 
     36     
     37    The format is a list of (directory, [files...]) pairs which can be 
     38    used directly in setup(...,data_files=...) for setup.py. 
     39 
     40    """ 
     41    data_files = [] 
     42    path = get_data_path(media="media") 
     43    for f in findall(path): 
     44        data_files.append(('media/models_media', [f])) 
     45    return data_files 
  • sansmodels/src/setup.py

    r642b259 re715e4f  
    8989     
    9090    # Use the pure python modules 
    91     package_dir = {"sans_extension":"sans/models/c_extensions"}, 
    92      
     91    package_dir = {"sans_extension":"sans/models/c_extensions", 
     92                   "sans.models.media":"media"}, 
     93    package_data={'sans.models.media': ['*']}, 
    9394    packages = ["sans","sans.models","sans.models.test", 
    94                 "sans_extension","sans.models.pyre"], 
     95                "sans_extension","sans.models.pyre", 
     96                "sans.models.media"], 
    9597     
    9698    ext_modules = [ Extension("sans_extension.c_models", 
Note: See TracChangeset for help on using the changeset viewer.