From 836c54b3d270652295c5775ea8e37f13ecdadfdb Mon Sep 17 00:00:00 2001 From: Jeremy Gonzalez Date: Thu, 15 Aug 2024 16:11:30 -0600 Subject: [PATCH] field is optional --- src/Strategy/Python/Poetry/Common.hs | 2 +- src/Strategy/Python/Poetry/PyProject.hs | 4 ++-- test/Python/Poetry/CommonSpec.hs | 2 +- test/Python/Poetry/PyProjectSpec.hs | 4 ++-- test/Python/PoetrySpec.hs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Strategy/Python/Poetry/Common.hs b/src/Strategy/Python/Poetry/Common.hs index 0e38ed8d5b..7aa23ad55d 100644 --- a/src/Strategy/Python/Poetry/Common.hs +++ b/src/Strategy/Python/Poetry/Common.hs @@ -44,7 +44,7 @@ import Strategy.Python.Poetry.PyProject ( -- | Gets build backend of pyproject. getPoetryBuildBackend :: PyProject -> Maybe Text -getPoetryBuildBackend project = buildBackend <$> pyprojectBuildSystem project +getPoetryBuildBackend project = buildBackend =<< pyprojectBuildSystem project -- | Supported pyproject dependencies. supportedPyProjectDep :: PoetryDependency -> Bool diff --git a/src/Strategy/Python/Poetry/PyProject.hs b/src/Strategy/Python/Poetry/PyProject.hs index 0ee0714c80..29bb2e5aff 100644 --- a/src/Strategy/Python/Poetry/PyProject.hs +++ b/src/Strategy/Python/Poetry/PyProject.hs @@ -126,7 +126,7 @@ data PyProjectMetadata = PyProjectMetadata deriving (Show, Eq, Ord) newtype PyProjectBuildSystem = PyProjectBuildSystem - { buildBackend :: Text + { buildBackend :: Maybe Text } deriving (Show, Eq, Ord) @@ -134,7 +134,7 @@ instance Toml.Schema.FromValue PyProjectBuildSystem where fromValue = Toml.Schema.parseTableFromValue $ PyProjectBuildSystem - <$> Toml.Schema.reqKey "build-backend" + <$> Toml.Schema.optKey "build-backend" data PyProjectPoetry = PyProjectPoetry { name :: Maybe Text diff --git a/test/Python/Poetry/CommonSpec.hs b/test/Python/Poetry/CommonSpec.hs index 27c89a8168..01d80a330a 100644 --- a/test/Python/Poetry/CommonSpec.hs +++ b/test/Python/Poetry/CommonSpec.hs @@ -40,7 +40,7 @@ import Toml.Schema qualified expectedPyProject :: PyProject expectedPyProject = PyProject - { pyprojectBuildSystem = Just $ PyProjectBuildSystem{buildBackend = "poetry.core.masonry.api"} + { pyprojectBuildSystem = Just $ PyProjectBuildSystem{buildBackend = Just "poetry.core.masonry.api"} , pyprojectProject = Nothing , pyprojectTool = Just $ diff --git a/test/Python/Poetry/PyProjectSpec.hs b/test/Python/Poetry/PyProjectSpec.hs index 600f7894aa..cd7479c09c 100644 --- a/test/Python/Poetry/PyProjectSpec.hs +++ b/test/Python/Poetry/PyProjectSpec.hs @@ -54,7 +54,7 @@ shouldParseInto = parseMatch parseConstraintExpr expectedPyProject :: PyProject expectedPyProject = PyProject - { pyprojectBuildSystem = Just $ PyProjectBuildSystem{buildBackend = "poetry.core.masonry.api"} + { pyprojectBuildSystem = Just $ PyProjectBuildSystem{buildBackend = Just "poetry.core.masonry.api"} , pyprojectProject = Nothing , pyprojectTool = Just $ @@ -90,7 +90,7 @@ expectedPyProject = expectedPyProject3 :: PyProject expectedPyProject3 = PyProject - { pyprojectBuildSystem = Just $ PyProjectBuildSystem{buildBackend = "poetry.core.masonry.api"} + { pyprojectBuildSystem = Just $ PyProjectBuildSystem{buildBackend = Just "poetry.core.masonry.api"} , pyprojectProject = Nothing , pyprojectTool = Just $ diff --git a/test/Python/PoetrySpec.hs b/test/Python/PoetrySpec.hs index 7633ed63de..78ea41a853 100644 --- a/test/Python/PoetrySpec.hs +++ b/test/Python/PoetrySpec.hs @@ -39,7 +39,7 @@ newPoetryLock pkgs = PoetryLock pkgs $ PoetryMetadata "some-version" "some-hash" candidatePyProject :: PyProject candidatePyProject = PyProject - { pyprojectBuildSystem = Just $ PyProjectBuildSystem "poetry.core.masonry.api" + { pyprojectBuildSystem = Just $ PyProjectBuildSystem{buildBackend = Just "poetry.core.masonry.api"} , pyprojectProject = Nothing , pyprojectTool = Just $