Skip to content

Commit a2756c4

Browse files
committed
Fix issue when the parent folder - in CI envs - doesn't exists.
1 parent 06426c7 commit a2756c4

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

PyFunceble/config/loader.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ def install_missing_infrastructure_files(
442442
if not self.is_already_loaded():
443443
if not self.file_helper.set_path(self.path_to_config).exists():
444444
self.file_helper.set_path(self.path_to_default_config).copy(
445-
self.path_to_config
445+
self.path_to_config, create_parent=True
446446
)
447447

448448
return self
@@ -515,7 +515,7 @@ def download_remote_config(src: str, dest: str = None) -> None:
515515
config = self.dict_helper.from_yaml_file(self.path_to_config)
516516
except (MarkedYAMLError, FileNotFoundError):
517517
self.file_helper.set_path(self.path_to_default_config).copy(
518-
self.path_to_config
518+
self.path_to_config, create_parent=True
519519
)
520520
config = self.dict_helper.from_yaml_file(self.path_to_config)
521521

PyFunceble/helpers/file.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,17 @@ def open(self, *args, **kwargs) -> "open":
201201

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

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

212+
if create_parent:
213+
DirectoryHelper(os.path.dirname(destination)).create()
214+
211215
if self.exists():
212216
shutil.copy(self.path, destination)
213217

PyFunceble/storage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
from PyFunceble.storage_facility import get_config_directory
6161

6262
PROJECT_NAME: str = "PyFunceble"
63-
PROJECT_VERSION: str = "4.3.0a14.dev (Blue Duckling: Tulip)"
63+
PROJECT_VERSION: str = "4.3.0a15.dev (Blue Duckling: Tulip)"
6464

6565
DISTRIBUTED_CONFIGURATION_FILENAME: str = ".PyFunceble_production.yaml"
6666

version.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
current_version: '4.3.0a14.dev (Blue Duckling: Tulip)'
1+
current_version: '4.3.0a15.dev (Blue Duckling: Tulip)'
22
deprecated:
33
- 3.0.21
44
- 3.1.20

0 commit comments

Comments
 (0)