rez.serialise
Read and write data from file. File caching via a memcached server is supported.
- class rez.serialise.EarlyThis(data)[source]
Bases:
objectThe ‘this’ object for @early bound functions.
Just exposes raw package data as object attributes.
- class rez.serialise.FileFormat(value, names=None, module=None, type=None)[source]
Bases:
rez.vendor.enum.Enum
- rez.serialise.get_objects()[source]
Get currently bound variables for evaluation of early-bound attribs.
- Returns
dict.
- rez.serialise.load_from_file(filepath, format_=<FileFormat.py: ('py', )>, update_data_callback=None, disable_memcache=False)[source]
Load data from a file.
Note
Any functions from a .py file will be converted to SourceCode objects.
- rez.serialise.load_py(stream, filepath=None)[source]
Load python-formatted data from a stream.
- Parameters
stream (file-like object) –
- Returns
dict.
- rez.serialise.load_txt(stream, **kwargs)[source]
Load text data from a stream.
- Parameters
stream (file-like object) –
- Returns
string.
- rez.serialise.load_yaml(stream, **kwargs)[source]
Load yaml-formatted data from a stream.
- Parameters
stream (file-like object) –
- Returns
dict.
- rez.serialise.open_file_for_write(filepath, mode=None)[source]
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.process_python_objects(data, filepath=None)[source]
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.set_objects(objects)[source]
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.