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 61f32d2b was
fd5ac0d,
checked in by krzywon, 10 years ago
|
I have completed the removal of all SANS references.
I will build, run, and run all unit tests before pushing.
|
-
Property mode set to
100644
|
File size:
1.7 KB
|
Rev | Line | |
---|
[ae3ce4e] | 1 | """ |
---|
[fd5ac0d] | 2 | 1D Modeling for SAS |
---|
[ae3ce4e] | 3 | """ |
---|
[79492222] | 4 | #from sas.models import * |
---|
[ae3ce4e] | 5 | |
---|
[b1a65b6] | 6 | import os |
---|
| 7 | from distutils.filelist import findall |
---|
| 8 | |
---|
[3726004] | 9 | __version__ = "2.1.0" |
---|
[592cb156] | 10 | |
---|
[b1a65b6] | 11 | def get_data_path(media): |
---|
| 12 | """ |
---|
| 13 | """ |
---|
| 14 | # Check for data path in the package |
---|
| 15 | path = os.path.join(os.path.dirname(__file__), media) |
---|
| 16 | if os.path.isdir(path): |
---|
| 17 | return path |
---|
| 18 | |
---|
| 19 | # Check for data path next to exe/zip file. |
---|
| 20 | # If we are inside a py2exe zip file, we need to go up |
---|
| 21 | # to get to the directory containing |
---|
| 22 | # the media for this module |
---|
| 23 | path = os.path.dirname(__file__) |
---|
| 24 | #Look for maximum n_dir up of the current dir to find media |
---|
| 25 | n_dir = 12 |
---|
| 26 | for i in range(n_dir): |
---|
| 27 | path, _ = os.path.split(path) |
---|
| 28 | media_path = os.path.join(path, media) |
---|
| 29 | if os.path.isdir(media_path): |
---|
| 30 | module_media_path = os.path.join(media_path, 'models_media') |
---|
| 31 | if os.path.isdir(module_media_path): |
---|
| 32 | return module_media_path |
---|
| 33 | return media_path |
---|
| 34 | |
---|
| 35 | raise RuntimeError('Could not find models media files') |
---|
| 36 | |
---|
| 37 | def data_files(): |
---|
| 38 | """ |
---|
| 39 | Return the data files associated with media. |
---|
| 40 | |
---|
| 41 | The format is a list of (directory, [files...]) pairs which can be |
---|
| 42 | used directly in setup(...,data_files=...) for setup.py. |
---|
| 43 | |
---|
| 44 | """ |
---|
| 45 | data_files = [] |
---|
| 46 | path = get_data_path(media="media") |
---|
[25e4dda] | 47 | path_img = get_data_path(media=os.path.join("media","img")) |
---|
| 48 | im_list = findall(path_img) |
---|
[b1a65b6] | 49 | for f in findall(path): |
---|
[25e4dda] | 50 | if os.path.isfile(f) and f not in im_list: |
---|
[5a313a3] | 51 | data_files.append(('media/models_media', [f])) |
---|
[25e4dda] | 52 | |
---|
| 53 | for f in im_list: |
---|
[5a313a3] | 54 | data_files.append(('media/models_media/img', [f])) |
---|
[b1a65b6] | 55 | return data_files |
---|
Note: See
TracBrowser
for help on using the repository browser.