Skip to content

Commit

Permalink
style: format code with Black and PHP CS Fixer
Browse files Browse the repository at this point in the history
This commit fixes the style issues introduced in 09c5b71 according to the output
from Black and PHP CS Fixer.

Details: None
  • Loading branch information
deepsource-autofix[bot] authored Nov 4, 2024
1 parent 09c5b71 commit bd0f46b
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions services/mmc/plugins/pkgs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,6 @@ def prepare_shared_folder():
os.mkdir(packages_input_dir_sharing_global, 0o755)



def create_directories_sharing(path):
"""
Create directories for the given path if they do not exist.
Expand All @@ -404,6 +403,7 @@ def create_directories_sharing(path):
except OSError as e:
logging.getLogger().error(f"Error creating directories: {e}")


def get_share_from_descriptor(package_descriptor):
"""
Prepare the system for the package server by creating the sharing folder if it does not exist.
Expand All @@ -415,21 +415,37 @@ def get_share_from_descriptor(package_descriptor):
Returns:
str: The path to the sharing folder.
"""
packages_input_dir_sharing = os.path.join("/", "var", "lib", "pulse2", "packages", "sharing")
packages_input_dir_sharing = os.path.join(
"/", "var", "lib", "pulse2", "packages", "sharing"
)

# Check if 'localisation_server' is in the package descriptor and is not empty
if "localisation_server" not in package_descriptor or not package_descriptor["localisation_server"]:
logging.getLogger().warning("keys localisation_server missing or not defined, using global sharing by default")
sharing = os.path.join(packages_input_dir_sharing, "global", package_descriptor["id"])
if (
"localisation_server" not in package_descriptor
or not package_descriptor["localisation_server"]
):
logging.getLogger().warning(
"keys localisation_server missing or not defined, using global sharing by default"
)
sharing = os.path.join(
packages_input_dir_sharing, "global", package_descriptor["id"]
)
else:
logging.getLogger().debug(f"local package {os.path.join(packages_input_dir_sharing, package_descriptor['localisation_server'], package_descriptor['id'])}")
sharing = os.path.join(packages_input_dir_sharing, package_descriptor["localisation_server"], package_descriptor["id"])
logging.getLogger().debug(
f"local package {os.path.join(packages_input_dir_sharing, package_descriptor['localisation_server'], package_descriptor['id'])}"
)
sharing = os.path.join(
packages_input_dir_sharing,
package_descriptor["localisation_server"],
package_descriptor["id"],
)

# Create the directories for the sharing path
create_directories_sharing(os.path.dirname(sharing))

return sharing


def test_ln(pathdirpackage):
"""
This function tests a path to know if this is a symlink or not.
Expand Down Expand Up @@ -1866,7 +1882,7 @@ def create_msg_xmpp_quick_deploy(folder, create=False):
def save_xmpp_json(folder, json_content):
logger = logging.getLogger()
logger.debug("JSON content: %s" % json_content)
json_content = json_content.replace('\\', '\\\\')
json_content = json_content.replace("\\", "\\\\")
structpackage = json.loads(json_content)
qdeploy_generate(folder)
keysupp = [
Expand Down

0 comments on commit bd0f46b

Please sign in to comment.