Skip to content

Commit

Permalink
Check if readme config is a str instead of a list
Browse files Browse the repository at this point in the history
  • Loading branch information
wagnerluis1982 committed Nov 15, 2021
1 parent ce15451 commit af9f391
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions poetry/core/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ def configure_package(
package.classifiers = config.get("classifiers", [])

if "readme" in config:
if isinstance(config["readme"], list):
package.readmes = tuple(root / readme for readme in config["readme"])
else:
if isinstance(config["readme"], str):
package.readmes = (root / config["readme"],)
else:
package.readmes = tuple(root / readme for readme in config["readme"])

package.description_type = cls._readme_content_type(package.readmes[0])

Expand Down Expand Up @@ -424,8 +424,8 @@ def validate(cls, config: dict, strict: bool = False) -> Dict[str, List[str]]:
)
)

# Checking readme file types (must match)
if "readme" in config and isinstance(config["readme"], list):
# Checking types of all readme files (must match)
if "readme" in config and not isinstance(config["readme"], str):
readme_types = [cls._readme_content_type(r) for r in config["readme"]]
if len(set(readme_types)) > 1:
result["errors"].append(
Expand Down

0 comments on commit af9f391

Please sign in to comment.