Skip to content

Commit

Permalink
Fix issue when the parent folder - in CI envs - doesn't exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
funilrys committed Dec 30, 2024
1 parent 06426c7 commit a2756c4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions PyFunceble/config/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ def install_missing_infrastructure_files(
if not self.is_already_loaded():
if not self.file_helper.set_path(self.path_to_config).exists():
self.file_helper.set_path(self.path_to_default_config).copy(
self.path_to_config
self.path_to_config, create_parent=True
)

return self
Expand Down Expand Up @@ -515,7 +515,7 @@ def download_remote_config(src: str, dest: str = None) -> None:
config = self.dict_helper.from_yaml_file(self.path_to_config)
except (MarkedYAMLError, FileNotFoundError):
self.file_helper.set_path(self.path_to_default_config).copy(
self.path_to_config
self.path_to_config, create_parent=True
)
config = self.dict_helper.from_yaml_file(self.path_to_config)

Expand Down
6 changes: 5 additions & 1 deletion PyFunceble/helpers/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,17 @@ def open(self, *args, **kwargs) -> "open":

return open(self.path, *args, **kwargs) # pylint: disable=unspecified-encoding

def copy(self, destination: str) -> "FileHelper":
def copy(self, destination: str, *, create_parent: bool = False) -> "FileHelper":
"""
Copy the globaly given file path to the given destination.
:param str destination: The destination of the copy.
:param bool create_parent: Tell us if we have to create the parent directory.
"""

if create_parent:
DirectoryHelper(os.path.dirname(destination)).create()

if self.exists():
shutil.copy(self.path, destination)

Expand Down
2 changes: 1 addition & 1 deletion PyFunceble/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
from PyFunceble.storage_facility import get_config_directory

PROJECT_NAME: str = "PyFunceble"
PROJECT_VERSION: str = "4.3.0a14.dev (Blue Duckling: Tulip)"
PROJECT_VERSION: str = "4.3.0a15.dev (Blue Duckling: Tulip)"

DISTRIBUTED_CONFIGURATION_FILENAME: str = ".PyFunceble_production.yaml"

Expand Down
2 changes: 1 addition & 1 deletion version.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
current_version: '4.3.0a14.dev (Blue Duckling: Tulip)'
current_version: '4.3.0a15.dev (Blue Duckling: Tulip)'
deprecated:
- 3.0.21
- 3.1.20
Expand Down

0 comments on commit a2756c4

Please sign in to comment.