rez.serialise#
Read and write data from file. File caching via a memcached server is supported.
- class rez.serialise.FileFormat#
- rez.serialise.open_file_for_write(filepath, mode=None)#
Writes both to given filepath, and tmpdir location.
This is to get around the problem with some NFS’s where immediately reading a file that has just been written is problematic. Instead, any files that we write, we also write to /tmp, and reads of these files are redirected there.
- rez.serialise.load_from_file(filepath, format_=<FileFormat.py: ('py', )>, update_data_callback=None, disable_memcache=False)#
Load data from a file.
Note
Any functions from a .py file will be converted to SourceCode objects.
- rez.serialise.get_objects()#
Get currently bound variables for evaluation of early-bound attribs.
- Returns:
dict.
- rez.serialise.set_objects(objects)#
Set the objects made visible to early-bound attributes.
For example, objects might be used to set a ‘build_variant_index’ var, so that an early-bound ‘private_build_requires’ can change depending on the currently-building variant.
- Parameters:
objects (dict) – Variables to set.
- rez.serialise.load_py(stream, filepath=None)#
Load python-formatted data from a stream.
- Parameters:
stream (file-like object) –
- Returns:
dict.
- class rez.serialise.EarlyThis#
The ‘this’ object for @early bound functions.
Just exposes raw package data as object attributes.
- __init__(data)#
- rez.serialise.process_python_objects(data, filepath=None)#
Replace certain values in the given package data dict.
Does things like: * evaluates @early decorated functions, and replaces with return value; * converts functions into SourceCode instances so they can be serialized
out to installed packages, and evaluated later;
strips some values (modules, __-leading variables) that are never to be part of installed packages.
- Returns:
Updated dict.
- Return type:
- rez.serialise.load_yaml(stream, **kwargs)#
Load yaml-formatted data from a stream.
- Parameters:
stream (file-like object) –
- Returns:
dict.
- rez.serialise.load_txt(stream, **kwargs)#
Load text data from a stream.
- Parameters:
stream (file-like object) –
- Returns:
string.
- rez.serialise.clear_file_caches()#
Clear any cached files.