FileSystem
File system utilities.
Initializers
import ros_cdk_core
ros_cdk_core.FileSystem()
Name | Type | Description |
---|---|---|
Static Functions
Name | Description |
---|---|
copy_directory |
Copies an entire directory structure. |
fingerprint |
Produces fingerprint based on the contents of a single file or an entire directory tree. |
is_empty |
Checks whether a directory is empty. |
mkdtemp |
Creates a unique temporary directory in the system temp directory. |
copy_directory
import ros_cdk_core
ros_cdk_core.FileSystem.copy_directory(
src_dir: str,
dest_dir: str,
exclude: typing.List[str] = None,
follow: SymlinkFollowMode = None,
ignore_mode: IgnoreMode = None,
root_dir: str = None
)
Copies an entire directory structure.
- Type: str
Source directory.
- Type: str
Destination directory.
- Type: typing.List[str]
- Default: nothing is excluded
File paths matching the patterns will be excluded.
See ignoreMode
to set the matching behavior.
Has no effect on Assets bundled using the bundling
property.
- Type: SymlinkFollowMode
- Default: SymlinkFollowMode.NEVER
A strategy for how to handle symlinks.
- Type: IgnoreMode
- Default: IgnoreMode.GLOB
The ignore behavior to use for exclude
patterns.
- Type: str
Root directory to calculate exclusions from.
fingerprint
import ros_cdk_core
ros_cdk_core.FileSystem.fingerprint(
file_or_directory: str,
exclude: typing.List[str] = None,
follow: SymlinkFollowMode = None,
ignore_mode: IgnoreMode = None,
extra_hash: str = None
)
Produces fingerprint based on the contents of a single file or an entire directory tree.
Line endings are converted from CRLF to LF.
The fingerprint will also include:
- An extra string if defined in
options.extra
. - The symlink follow mode value.
- Type: str
The directory or file to fingerprint.
- Type: typing.List[str]
- Default: nothing is excluded
File paths matching the patterns will be excluded.
See ignoreMode
to set the matching behavior.
Has no effect on Assets bundled using the bundling
property.
- Type: SymlinkFollowMode
- Default: SymlinkFollowMode.NEVER
A strategy for how to handle symlinks.
- Type: IgnoreMode
- Default: IgnoreMode.GLOB
The ignore behavior to use for exclude
patterns.
- Type: str
- Default: hash is only based on source content
Extra information to encode into the fingerprint (e.g. build instructions and other inputs).
is_empty
import ros_cdk_core
ros_cdk_core.FileSystem.is_empty(
dir: str
)
Checks whether a directory is empty.
- Type: str
The directory to check.
mkdtemp
import ros_cdk_core
ros_cdk_core.FileSystem.mkdtemp(
prefix: str
)
Creates a unique temporary directory in the system temp directory.
- Type: str
A prefix for the directory name.
Six random characters will be generated and appended behind this prefix.
Properties
Name | Type | Description |
---|---|---|
tmpdir |
str |
The real path of the system temp directory. |
tmpdir
Required
tmpdir: str
- Type: str
The real path of the system temp directory.