FileContent¶
- class starlark_tugger.FileContent¶
This type represents the content of a single file.
Instances essentially track the following:
The content of a file (either a reference to a filesystem path or in-memory data).
Whether the file is executable.
The filename associated with the content. This is just the file name: directory components are not allowed.
Unfortunately, since Starlark doesn’t expose a
bytestype, we are unable to expose the raw content tracked by instances of this type.- executable¶
(
bool)Whether a materialized file should be marked as executable.
- filename¶
(
str)The filename associated with this instance.
This is just the filename.
- __init__(path: Optional[str] = None, filename: Optional[str] = None, content: Optional[str] = None, executable: Optional[bool] = None) FileContent¶
Construct a new instance given an existing filesystem
pathor stringcontent.1 of
pathorcontentmust be provided to define the content tracked by this instance.If
contentis provided,filenamemust also be provided.filenamemust be just a file name: no directory components are allowed.If
pathis provided, it must refer to an existing filesystem path or an error will occur. Relative paths are interpreted as relative to the globalCWDvariable. Absolute paths are used as-is.If
pathis provided, by defaultfilenameandexecutablewill be resolved from the given path. However, if thefilenameorexecutablearguments are notNone, their values will be override those derived frompath.If
contentis provided andexecutableis not,executabledefaults toFalse.