summaryrefslogtreecommitdiff
path: root/src/virtualenv/run/plugin
diff options
context:
space:
mode:
authorAshley Whetter <AWhetter@users.noreply.github.com>2021-04-20 01:55:07 -0700
committerGitHub <noreply@github.com>2021-04-20 09:55:07 +0100
commit625d5d8827cd64177300fab19cdce5f91e1fd41f (patch)
treebf82ab7c49ab29c5637ff8621e4cb0347fd68521 /src/virtualenv/run/plugin
parentf198a659192a76051cc8480124f1c50c45539416 (diff)
downloadvirtualenv-625d5d8827cd64177300fab19cdce5f91e1fd41f.tar.gz
Built in discovery class is always preferred over plugin supplied classes (#2088)
Diffstat (limited to 'src/virtualenv/run/plugin')
-rw-r--r--src/virtualenv/run/plugin/discovery.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/virtualenv/run/plugin/discovery.py b/src/virtualenv/run/plugin/discovery.py
index 3b6fc60..7cfee7c 100644
--- a/src/virtualenv/run/plugin/discovery.py
+++ b/src/virtualenv/run/plugin/discovery.py
@@ -13,10 +13,13 @@ def get_discover(parser, args):
title="discovery",
description="discover and provide a target interpreter",
)
+ choices = _get_default_discovery(discover_types)
+ # prefer the builtin if present, otherwise fallback to first defined type
+ choices = sorted(choices, key=lambda a: 0 if a == "builtin" else 1)
discovery_parser.add_argument(
"--discovery",
- choices=_get_default_discovery(discover_types),
- default=next(i for i in discover_types.keys()),
+ choices=choices,
+ default=next(iter(choices)),
required=False,
help="interpreter discovery method",
)