fix(pypi): return True for a satisfied partially evaluated marker

When a marker is evaluated without all of the variables, e.g. to get the
platform specific part of `sys_platform == "linux" or extra == "foo"`,
`True or <unknown>` returned an empty string instead of `True`. Inside
the parenthesis it became `()`, which the evaluation then had to accept
as a marker that is always true.

Because of this the dependencies that are needed on all platforms were
included through a `select` on an `env_marker_setting` with an empty
expression. Fix by returning `True`, so that the result is either a
`bool` or a valid marker.
diff --git a/news/pypi-partial-marker-evaluation.fixed.md b/news/pypi-partial-marker-evaluation.fixed.md
new file mode 100644
index 0000000..e360fe3
--- /dev/null
+++ b/news/pypi-partial-marker-evaluation.fixed.md
@@ -0,0 +1,4 @@
+(pypi) The dependencies that have markers which are satisfied by the
+requested extra irrespective of the platform, e.g.
+`sys_platform == "linux" or extra == "foo"`, are now included unconditionally
+instead of through a `select` that is always true.
diff --git a/python/private/pypi/pep508_evaluate.bzl b/python/private/pypi/pep508_evaluate.bzl
index 61e461a..fba7e1a 100644
--- a/python/private/pypi/pep508_evaluate.bzl
+++ b/python/private/pypi/pep508_evaluate.bzl
@@ -163,40 +163,32 @@
 def _and_fn(x, y):
     """Our custom `and` evaluation function.
 
-    Allow partial evaluation if one of the values is a string, return the
-    string value because that means that `marker_expr` was set to
-    `strict = False` and we are only evaluating what we can.
+    The values are either bools or strings, which are the expressions that
+    could not be evaluated because `marker_expr` was set to `strict = False`.
     """
-    if not (x and y):
+    if x == False or y == False:
         return False
-
-    x_is_str = type(x) == type("")
-    y_is_str = type(y) == type("")
-    if x_is_str and y_is_str:
-        return "{} and {}".format(x, y)
-    elif x_is_str:
+    elif x == True:
+        return y
+    elif y == True:
         return x
     else:
-        return y
+        return "{} and {}".format(x, y)
 
 def _or_fn(x, y):
     """Our custom `or` evaluation function.
 
-    Allow partial evaluation if one of the values is a string, return the
-    string value because that means that `marker_expr` was set to
-    `strict = False` and we are only evaluating what we can.
+    The values are either bools or strings, which are the expressions that
+    could not be evaluated because `marker_expr` was set to `strict = False`.
     """
-    x_is_str = type(x) == type("")
-    y_is_str = type(y) == type("")
-
-    if x_is_str and y_is_str:
-        return "{} or {}".format(x, y) if x and y else ""
-    elif x_is_str:
-        return "" if y else x
-    elif y_is_str:
-        return "" if x else y
+    if x == True or y == True:
+        return True
+    elif x == False:
+        return y
+    elif y == False:
+        return x
     else:
-        return x or y
+        return "{} or {}".format(x, y)
 
 def _not_fn(x):
     """Our custom `not` evaluation function.
diff --git a/tests/pypi/pep508/deps_tests.bzl b/tests/pypi/pep508/deps_tests.bzl
index 0d171d8..dd24cbf 100644
--- a/tests/pypi/pep508/deps_tests.bzl
+++ b/tests/pypi/pep508/deps_tests.bzl
@@ -268,6 +268,23 @@
 
 _tests.append(test_extra_with_conditional_and_unconditional_markers)
 
+def test_extra_or_platform_marker_is_unconditional(env):
+    got = deps(
+        "foo",
+        extras = ["client"],
+        requires_dist = [
+            'bar; sys_platform == "darwin" or extra == "client"',
+            'baz; (sys_platform == "darwin" or extra == "client") and os_name == "posix"',
+        ],
+    )
+
+    env.expect.that_collection(got.deps).contains_exactly(["bar"])
+    env.expect.that_dict(got.deps_select).contains_exactly({
+        "baz": 'os_name == "posix"',
+    })
+
+_tests.append(test_extra_or_platform_marker_is_unconditional)
+
 def test_span_all_python_versions(env):
     requires_dist = [
         "bar>=0.4.0; python_version >= \"3.13.0\"",
diff --git a/tests/pypi/pep508/evaluate_tests.bzl b/tests/pypi/pep508/evaluate_tests.bzl
index 53986e6..9145a9c 100644
--- a/tests/pypi/pep508/evaluate_tests.bzl
+++ b/tests/pypi/pep508/evaluate_tests.bzl
@@ -214,31 +214,21 @@
 _tests.append(_logical_expression_tests)
 
 def _evaluate_partial_only_extra(env):
-    # Given
-    extra = "foo"
-
-    # When
     for input, want in {
         "os_name == 'osx' and extra == 'bar'": False,
         "os_name == 'osx' and extra == 'foo'": "os_name == \"osx\"",
         "platform_system == 'aarch64' and os_name == 'osx' and extra == 'foo'": "platform_system == \"aarch64\" and os_name == \"osx\"",
         "platform_system == 'aarch64' and extra == 'foo' and os_name == 'osx'": "platform_system == \"aarch64\" and os_name == \"osx\"",
         "os_name == 'osx' or extra == 'bar'": "os_name == \"osx\"",
-        "os_name == 'osx' or extra == 'foo'": "",
+        "os_name == 'osx' or extra == 'foo'": True,
         "extra == 'bar' or os_name == 'osx'": "os_name == \"osx\"",
-        "extra == 'foo' or os_name == 'osx'": "",
+        "extra == 'foo' or os_name == 'osx'": True,
         "os_name == 'win' or extra == 'bar' or os_name == 'osx'": "os_name == \"win\" or os_name == \"osx\"",
-        "os_name == 'win' or extra == 'foo' or os_name == 'osx'": "",
+        "os_name == 'win' or extra == 'foo' or os_name == 'osx'": True,
+        "(os_name == 'win' or extra == 'foo') and os_name == 'osx'": "os_name == \"osx\"",
+        "(os_name == 'win' or extra == 'bar') and os_name == 'osx'": "(os_name == \"win\") and os_name == \"osx\"",
     }.items():  # buildifier: @unsorted-dict-items
-        got = evaluate(
-            input,
-            env = {
-                "extra": extra,
-            },
-            strict = False,
-        )
-        env.expect.that_bool(got).equals(want)
-        _check_evaluate(env, input, want, {"extra": extra}, strict = False)
+        _check_evaluate(env, input, want, {"extra": "foo"}, strict = False)
 
 _tests.append(_evaluate_partial_only_extra)