ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalcmagnetic_scattrelease-4.2.2ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change
on this file since b4cd56e was
12d3e0e,
checked in by Paul Kienzle <pkienzle@…>, 7 years ago
|
reinstate empty plugin models directory
|
-
Property mode set to
100644
|
File size:
1.5 KB
|
Rev | Line | |
---|
[959eb01] | 1 | PLUGIN_ID = "Fitting plug-in 1.0" |
---|
| 2 | import os |
---|
| 3 | from fitting import * |
---|
| 4 | from distutils.filelist import findall |
---|
| 5 | def get_data_path(media): |
---|
| 6 | """ |
---|
| 7 | """ |
---|
| 8 | # Check for data path in the package |
---|
| 9 | path = os.path.join(os.path.dirname(__file__), media) |
---|
| 10 | if os.path.isdir(path): |
---|
| 11 | return path |
---|
| 12 | |
---|
| 13 | # Check for data path next to exe/zip file. |
---|
| 14 | # If we are inside a py2exe zip file, we need to go up |
---|
[5a405bd] | 15 | # to get to the directory containing |
---|
[959eb01] | 16 | # the media for this module |
---|
| 17 | path = os.path.dirname(__file__) |
---|
| 18 | #Look for maximum n_dir up of the current dir to find media |
---|
| 19 | n_dir = 12 |
---|
| 20 | for i in range(n_dir): |
---|
| 21 | path, _ = os.path.split(path) |
---|
| 22 | media_path = os.path.join(path, media) |
---|
| 23 | if os.path.isdir(media_path): |
---|
| 24 | module_media_path = os.path.join(media_path, 'fitting_media') |
---|
| 25 | if os.path.isdir(module_media_path): |
---|
| 26 | return module_media_path |
---|
| 27 | return media_path |
---|
[5a405bd] | 28 | |
---|
[959eb01] | 29 | raise RuntimeError('Could not find models media files') |
---|
| 30 | |
---|
| 31 | def data_files(): |
---|
| 32 | """ |
---|
| 33 | Return the data files associated with media. |
---|
[5a405bd] | 34 | |
---|
[959eb01] | 35 | The format is a list of (directory, [files...]) pairs which can be |
---|
| 36 | used directly in setup(...,data_files=...) for setup.py. |
---|
| 37 | |
---|
| 38 | """ |
---|
| 39 | data_files = [] |
---|
[12d3e0e] | 40 | # Note: windows installer requires the plugin_models directory |
---|
| 41 | plugin_models = os.path.join(os.path.dirname(__file__), "plugin_models") |
---|
| 42 | data_files.append(('plugin_models', findall(plugin_models))) |
---|
[5a405bd] | 43 | data_files.append(('media/fitting_media', findall(get_data_path("media")))) |
---|
| 44 | |
---|
[959eb01] | 45 | return data_files |
---|
Note: See
TracBrowser
for help on using the repository browser.