@@ -30,18 +30,18 @@ def __init__(self, options):
30
30
self .enabled = False
31
31
32
32
@classmethod
33
- def distributions (cls ):
33
+ def distributions (cls ) -> dict [ str , Version ] :
34
34
return {
35
35
"pip" : Version .bundle ,
36
36
"setuptools" : Version .bundle ,
37
37
"wheel" : Version .bundle ,
38
38
}
39
39
40
- def distribution_to_versions (self ):
40
+ def distribution_to_versions (self ) -> dict [ str , str ] :
41
41
return {
42
42
distribution : getattr (self , f"{ distribution } _version" )
43
43
for distribution in self .distributions ()
44
- if getattr (self , f"no_{ distribution } " ) is False
44
+ if getattr (self , f"no_{ distribution } " ) is False and getattr ( self , f" { distribution } _version" ) != "none"
45
45
}
46
46
47
47
@classmethod
@@ -71,11 +71,13 @@ def add_parser_arguments(cls, parser, interpreter, app_data): # noqa: U100
71
71
default = [],
72
72
)
73
73
for distribution , default in cls .distributions ().items ():
74
+ if interpreter .version_info > (3 , 11 ) and distribution in {"wheel" , "setuptools" }:
75
+ default = "none"
74
76
parser .add_argument (
75
77
f"--{ distribution } " ,
76
78
dest = distribution ,
77
79
metavar = "version" ,
78
- help = f"version of { distribution } to install as seed: embed, bundle or exact version" ,
80
+ help = f"version of { distribution } to install as seed: embed, bundle, none or exact version" ,
79
81
default = default ,
80
82
)
81
83
for distribution in cls .distributions ():
@@ -84,10 +86,7 @@ def add_parser_arguments(cls, parser, interpreter, app_data): # noqa: U100
84
86
dest = f"no_{ distribution } " ,
85
87
action = "store_true" ,
86
88
help = f"do not install { distribution } " ,
87
- default = True
88
- if (float (interpreter .version .split (" " )[0 ].rsplit ("." , 1 )[0 ]) >= 12 )
89
- and (distribution in {"wheel" , "setuptools" })
90
- else False ,
89
+ default = False ,
91
90
)
92
91
parser .add_argument (
93
92
"--no-periodic-update" ,
@@ -97,7 +96,7 @@ def add_parser_arguments(cls, parser, interpreter, app_data): # noqa: U100
97
96
default = not PERIODIC_UPDATE_ON_BY_DEFAULT ,
98
97
)
99
98
100
- def __repr__ (self ):
99
+ def __repr__ (self ) -> str :
101
100
result = self .__class__ .__name__
102
101
result += "("
103
102
if self .extra_search_dir :
@@ -106,7 +105,10 @@ def __repr__(self):
106
105
for distribution in self .distributions ():
107
106
if getattr (self , f"no_{ distribution } " ):
108
107
continue
109
- ver = f"={ getattr (self , f'{ distribution } _version' , None ) or 'latest' } "
108
+ version = getattr (self , f"{ distribution } _version" , None )
109
+ if version == "none" :
110
+ continue
111
+ ver = f"={ version or 'latest' } "
110
112
result += f" { distribution } { ver } ,"
111
113
return result [:- 1 ] + ")"
112
114
0 commit comments