Write data to ``chroot/dst`` with optional label. Has similar exceptional cases as ``Chroot.copy``
(
self,
data, # type: Union[str, bytes]
dst, # type: str
label=None, # type: Optional[str]
mode="wb", # type: str
executable=False, # type: bool
compress=True, # type: bool
)
| 790 | safe_relative_symlink(abs_src, abs_dst) |
| 791 | |
| 792 | def write( |
| 793 | self, |
| 794 | data, # type: Union[str, bytes] |
| 795 | dst, # type: str |
| 796 | label=None, # type: Optional[str] |
| 797 | mode="wb", # type: str |
| 798 | executable=False, # type: bool |
| 799 | compress=True, # type: bool |
| 800 | ): |
| 801 | # type: (...) -> None |
| 802 | """Write data to ``chroot/dst`` with optional label. |
| 803 | |
| 804 | Has similar exceptional cases as ``Chroot.copy`` |
| 805 | """ |
| 806 | dst = self._normalize(dst) |
| 807 | self._tag(dst, label, compress) |
| 808 | self._ensure_parent(dst) |
| 809 | with open(os.path.join(self.chroot, dst), mode) as wp: |
| 810 | wp.write(data) |
| 811 | if executable: |
| 812 | chmod_plus_x(wp.name) |
| 813 | |
| 814 | def touch( |
| 815 | self, |