Skip to content

Commit

Permalink
FIX: handle packages that are defined with setup.cfg (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer authored Jan 9, 2024
1 parent a872d4f commit f2a0906
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))
for project_info in candidates:
if not project_info.is_empty():
return project_info
return None


Expand Down

0 comments on commit f2a0906

Please sign in to comment.