diff --git a/src/ape/api/projects.py b/src/ape/api/projects.py index 8c738c5d32..70eeec11c6 100644 --- a/src/ape/api/projects.py +++ b/src/ape/api/projects.py @@ -416,26 +416,25 @@ def _extract_local_manifest( except ValueError as err: if project_path.parent.is_dir(): - logger.warning( - "Was given a file-path to a non-manifest file. Using parent directory." - ) project_path = project_path.parent else: - raise ProjectError(f"Invalid local project '{project_path}'.") from err + raise ProjectError(f"Invalid manifest file: '{project_path}'.") from err else: # Was given a path to a manifest JSON. self._write_manifest_to_cache(manifest) return manifest + elif (project_path.parent / project_path.name.replace("-", "_")).is_dir(): + project_path = project_path.parent / project_path.name.replace("-", "_") + + elif (project_path.parent / project_path.name.replace("_", "-")).is_dir(): + project_path = project_path.parent / project_path.name.replace("_", "-") + elif project_path.parent.is_dir(): - logger.warning("Was given a file-path to a non-manifest file. Using parent directory.") project_path = project_path.parent - else: - raise ProjectError(f"Invalid local project '{project_path}'.") - # NOTE: Dependencies are not compiled here. Instead, the sources are packaged # for later usage via imports. For legacy reasons, many dependency-esque projects # are not meant to compile on their own.