Add itertools import and update file permissions

This commit is contained in:
Théophile Diot 2024-04-02 19:25:21 +01:00
parent 0755e0a673
commit 2a7936bfb8
No known key found for this signature in database
GPG key ID: 248FEA4BAE400D06
2 changed files with 4 additions and 2 deletions

View file

@ -1,6 +1,7 @@
#!/usr/bin/env python3
from io import BytesIO
from itertools import chain
from os import getenv, sep
from os.path import join
from pathlib import Path
@ -77,7 +78,7 @@ def install_plugin(plugin_path: Path, db) -> bool:
# Copy the plugin
copytree(plugin_path, new_plugin_path)
# Add u+x permissions to jobs files
for job_file in new_plugin_path.joinpath("jobs").glob("*"):
for job_file in chain(new_plugin_path.joinpath("jobs").glob("*"), new_plugin_path.joinpath("bwcli").glob("*")):
job_file.chmod(job_file.stat().st_mode | S_IEXEC)
LOGGER.info(f"Plugin {metadata['id']} installed")
return True

View file

@ -2,6 +2,7 @@
from datetime import datetime
from io import BytesIO
from itertools import chain
from os import getenv, sep
from os.path import join
from pathlib import Path
@ -86,7 +87,7 @@ def install_plugin(plugin_path: Path, db, preview: bool = True) -> bool:
# Copy the plugin
copytree(plugin_path, new_plugin_path)
# Add u+x permissions to jobs files
for job_file in new_plugin_path.joinpath("jobs").glob("*"):
for job_file in chain(new_plugin_path.joinpath("jobs").glob("*"), new_plugin_path.joinpath("bwcli").glob("*")):
job_file.chmod(job_file.stat().st_mode | S_IEXEC)
LOGGER.info(f"{'Preview version of ' if preview else ''}Pro plugin {metadata['id']} (version {metadata['version']}) installed successfully!")
return True