File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 13
13
import sys
14
14
15
15
import pyperf
16
+ from packaging .specifiers import SpecifierSet
16
17
17
18
from . import _utils , _benchmark_metadata
18
19
@@ -164,9 +165,13 @@ def runscript(self):
164
165
def extra_opts (self ):
165
166
return self ._get_metadata_value ('extra_opts' , ())
166
167
168
+ @property
169
+ def python (self ):
170
+ req = self ._get_metadata_value ("python" , None )
171
+ return None if req is None else SpecifierSet (req )
172
+
167
173
# Other metadata keys:
168
174
# * base
169
- # * python
170
175
# * dependencies
171
176
# * requirements
172
177
Original file line number Diff line number Diff line change @@ -241,11 +241,15 @@ def parse_entry(o, s):
241
241
242
242
# Get the selections.
243
243
selected = []
244
+ this_python_version = "." .join (map (str , sys .version_info [:3 ]))
244
245
for bench in _benchmark_selections .iter_selections (manifest , parsed_infos ):
245
246
if isinstance (bench , str ):
246
247
logging .warning (f"no benchmark named { bench !r} " )
247
248
continue
248
- selected .append (bench )
249
+ # Filter out any benchmarks that can't be run on the Python version we're running
250
+ if bench .python is not None and this_python_version in bench .python :
251
+ selected .append (bench )
252
+
249
253
return selected
250
254
251
255
You can’t perform that action at this time.
0 commit comments