Access project’s data and documentation files.
All access to data and documentation files MUST be made through the functions of this modules to ensure access accross different distribution schemes:
Installing from source or from wheel
Installing package as a zip (through the use of pkg_resources)
Linux packaging willing to install data files (and doc files) in alternative folders. In this case, this file must be patched.
Frozen fat binary application using silx (forzen with cx_Freeze or py2app). This needs special care for the resource files in the setup:
With cx_Freeze, add silx/resources to include_files:
import silx.resources
silx_include_files = (os.path.dirname(silx.resources.__file__),
os.path.join('silx', 'resources'))
setup(...
options={'build_exe': {'include_files': [silx_include_files]}}
)
With py2app, add silx in the packages list of the py2app options:
setup(...
options={'py2app': {'packages': ['silx']}}
)
Return filename corresponding to resource.
resource can be the name of either a file or a directory. The existence of the resource is not checked.
Parameters: | resource (str) – Resource path relative to resource directory using ‘/’ path separator. |
---|---|
Returns: | Absolute resource path in the file system |