mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-14 10:19:02 +00:00
Revert "Config handling: autogenerate project.yml when path to project was entered manually"
This reverts commit c763ab1ffe.
This commit is contained in:
1 parent
7ba52e2d4d
commit
688e8c35b1
2 files changed
+2
-13
No files matched your search
+2
-11
@@ -327,19 +327,10 @@ class SerenaConfig(SerenaConfigBase):
|
||||
num_project_migrations = 0
|
||||
for path in loaded_commented_yaml["projects"]:
|
||||
path = Path(path).resolve()
|
||||
if not path.exists():
|
||||
log.warning(f"Project path {path} does not exist, skipping.")
|
||||
if not path.exists() or (path.is_dir() and not (path / ProjectConfig.rel_path_to_project_yml()).exists()):
|
||||
log.warning(f"Project path {path} does not exist or does not contain a project configuration file, skipping.")
|
||||
continue
|
||||
if path.is_dir():
|
||||
project_yml_path = path / ProjectConfig.rel_path_to_project_yml()
|
||||
if not project_yml_path.exists():
|
||||
log.info(f"Project path {path} does not contain a project configuration file, creating one.")
|
||||
ProjectConfig.autogenerate(path, save_to_disk=True)
|
||||
continue
|
||||
if path.is_file():
|
||||
log.info(
|
||||
f"Project path {path} is a file, migrating to in-project configuration. This is a legacy feature for backwards compatibility."
|
||||
)
|
||||
path = cls._migrate_out_of_project_config_file(path)
|
||||
if path is None:
|
||||
continue
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import os
|
||||
from typing import Literal, overload
|
||||
|
||||
from ruamel.yaml import YAML
|
||||
@@ -27,6 +26,5 @@ def load_yaml(path: str, preserve_comments: bool = False) -> dict | CommentedMap
|
||||
|
||||
def save_yaml(path: str, data: dict | CommentedMap, preserve_comments: bool = False) -> None:
|
||||
yaml = _create_YAML(preserve_comments)
|
||||
os.makedirs(os.path.dirname(path), exist_ok=True)
|
||||
with open(path, "w", encoding="utf-8") as f:
|
||||
yaml.dump(data, f)
|
||||
Reference in new issue
Block a user