Changeset c2c51a2 in sasmodels
- Timestamp:
- May 6, 2016 1:13:55 AM (9 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 306e354
- Parents:
- 948b8c1
- Location:
- sasmodels
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/__init__.py
r37a7252 rc2c51a2 14 14 defining new models. 15 15 """ 16 __version__ = "0.9" 16 17 17 __version__ = "0.9" 18 def data_files(): 19 """ 20 Return the data files to be installed with the package. 21 22 The format is a list of (directory, [files...]) pairs which can be 23 used directly in setup(...,data_files=...) for setup.py. 24 """ 25 from os.path import join as joinpath 26 from .generate import SIBLING_DIR, DATA_PATH 27 data_files = {} 28 def add_patterns(path, patterns): 29 data_files[joinpath(SIBLING_DIR, *path)] \ 30 = [joinpath(DATA_PATH, *(path+[p])) for p in patterns] 31 add_patterns([], ['*.c', '*.cl', 'convert.json']) 32 add_patterns(['models'], ['*.c']) 33 add_patterns(['models', 'lib'], ['*.c']) 34 35 return data_files 36 -
sasmodels/generate.py
rc4c426b rc2c51a2 210 210 import sys 211 211 from os.path import abspath, dirname, join as joinpath, exists, basename, \ 212 splitext 212 splitext, isdir 213 213 import re 214 214 import string … … 224 224 Parameter = namedtuple('Parameter', PARAMETER_FIELDS) 225 225 226 C_KERNEL_TEMPLATE_PATH = joinpath(dirname(__file__), 'kernel_template.c') 226 SIBLING_DIR = 'sasmodels-data' 227 PACKAGE_PATH = abspath(dirname(__file__)) 228 SIBLING_PATH = abspath(joinpath(PACKAGE_PATH, '..', 'sasmodels-data')) 229 DATA_PATH = SIBLING_PATH if isdir(SIBLING_PATH) else PACKAGE_PATH 230 MODEL_PATH = joinpath(DATA_PATH, 'models') 231 C_KERNEL_TEMPLATE_FILE = joinpath(DATA_PATH, 'kernel_template.c') 232 227 233 228 234 F16 = np.dtype('float16') … … 336 342 Return a list of the sources file paths for the module. 337 343 """ 338 search_path = [dirname(model_info['filename']), 339 abspath(joinpath(dirname(__file__), 'models'))] 344 search_path = [dirname(model_info['filename']), MODEL_PATH] 340 345 return [_search(search_path, f) for f in model_info['source']] 341 346 … … 457 462 global C_KERNEL_TEMPLATE 458 463 if C_KERNEL_TEMPLATE is None: 459 with open(C_KERNEL_TEMPLATE_ PATH) as fid:464 with open(C_KERNEL_TEMPLATE_FILE) as fid: 460 465 C_KERNEL_TEMPLATE = fid.read() 461 466 … … 466 471 for p in ('#line 1 "%s"'%f.replace('\\', '\\\\'), open(f).read()) 467 472 ] 468 source.append('#line 133 "%s"'%C_KERNEL_TEMPLATE_ PATH.replace('\\', '\\\\'))473 source.append('#line 133 "%s"'%C_KERNEL_TEMPLATE_FILE.replace('\\', '\\\\')) 469 474 470 475 # Prepare defines
Note: See TracChangeset
for help on using the changeset viewer.