Skip to content

Commit

Permalink
FIX: handle packages that are defined with setup.cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Jan 9, 2024
1 parent a872d4f commit e1dddc8
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/repoma/utilities/project_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,18 @@ def get_project_info(pyproject: TOMLDocument | None = None) -> ProjectInfo:


def _load_project_info(pyproject: TOMLDocument | None = None) -> ProjectInfo | None:
if pyproject is not None or os.path.exists(CONFIG_PATH.pyproject):
if pyproject is None:
pyproject = load_pyproject()
if pyproject is not None:
return ProjectInfo.from_pyproject_toml(pyproject)
candidates: list[ProjectInfo] = []
if os.path.exists(CONFIG_PATH.pyproject):
pyproject = load_pyproject()
candidates.append(ProjectInfo.from_pyproject_toml(pyproject))
if os.path.exists(CONFIG_PATH.setup_cfg):
cfg = open_config(CONFIG_PATH.setup_cfg)
return ProjectInfo.from_setup_cfg(cfg)
candidates.append(ProjectInfo.from_setup_cfg(cfg))

Check warning on line 99 in src/repoma/utilities/project_info.py

View check run for this annotation

Codecov / codecov/patch

src/repoma/utilities/project_info.py#L99

Added line #L99 was not covered by tests
for project_info in candidates:
if not project_info.is_empty():
return project_info
return None


Expand Down

0 comments on commit e1dddc8

Please sign in to comment.