17 lines
461 B
Python
17 lines
461 B
Python
from pathlib import Path
|
|
|
|
|
|
def save(destination: Path, file_content: bytes):
|
|
destination.parent.mkdir(parents=True, exist_ok=True)
|
|
destination.write_bytes(file_content)
|
|
|
|
|
|
def set_execution_rights(file: Path):
|
|
file_rights = file.stat().st_mode
|
|
rights_to_set = file_rights | 0o111
|
|
file.chmod(rights_to_set)
|
|
|
|
|
|
def save_and_make_executable(destination: Path, content: bytes):
|
|
save(destination, content)
|
|
set_execution_rights(destination)
|