File tree 4 files changed +53
-7
lines changed
4 files changed +53
-7
lines changed Original file line number Diff line number Diff line change
1
+ from variantlib .base import PluginBase
2
+ from variantlib .config import ProviderConfig
3
+ from variantlib .meta import VariantDescription
4
+
5
+
6
+ class BlasPlugin (PluginBase ):
7
+ namespace = "blas"
8
+
9
+ def get_supported_configs (self ) -> ProviderConfig :
10
+ return None
11
+
12
+ def get_variant_labels (self , variant_desc : VariantDescription ) -> list [str ]:
13
+ for meta in variant_desc :
14
+ if meta .namespace == "blas" and meta .key == "variant" :
15
+ return [meta .value ]
16
+ return []
17
+
18
+
19
+ class X8664Plugin (PluginBase ):
20
+ namespace = "x86_64"
21
+
22
+ def get_supported_configs (self ) -> ProviderConfig :
23
+ return None
24
+
25
+ def get_variant_labels (self , variant_desc : VariantDescription ) -> list [str ]:
26
+ for meta in variant_desc :
27
+ if meta .namespace == "x86_64" and meta .key == "baseline" :
28
+ return [f"x86_64_{ meta .value } " ]
29
+ return []
Original file line number Diff line number Diff line change
1
+ [build-system ]
2
+ requires = [" flit_core>=3.2,<4" ]
3
+ build-backend = " flit_core.buildapi"
4
+
5
+ [project ]
6
+ name = " demo-plugins"
7
+ version = " 0"
8
+ description = " Demo plugins for meson-python/numpy variants"
9
+ dependencies = [" variantlib" ]
10
+
11
+ [project .entry-points ."variantlib .plugins" ]
12
+ blas = " demo_plugins:BlasPlugin"
13
+ x86_64 = " demo_plugins:X8664Plugin"
Original file line number Diff line number Diff line change @@ -353,16 +353,20 @@ def tag(self) -> mesonpy._tags.Tag:
353
353
return mesonpy ._tags .Tag ('py3' , 'none' , None )
354
354
return mesonpy ._tags .Tag (None , self ._stable_abi , None )
355
355
356
- @property
357
- def _variant_suffix (self ) -> str :
358
- if self ._variant is not None :
359
- return f"-{ self ._variant .hexdigest } "
360
- return ""
361
-
362
356
@property
363
357
def name (self ) -> str :
364
358
"""Wheel name, this includes the basename and tag."""
365
- return f'{ self ._metadata .distribution_name } -{ self ._metadata .version } -{ self .tag } { self ._variant_suffix } '
359
+ name = f'{ self ._metadata .distribution_name } -{ self ._metadata .version } -{ self .tag } '
360
+ if self ._variant is not None :
361
+ name += f'-{ self ._variant .hexdigest } '
362
+ labels = PluginLoader ().get_variant_labels (self ._variant )
363
+ for numlabels in range (len (labels ), 0 , - 1 ):
364
+ long_name = "+" .join ((name , * labels [:numlabels ]))
365
+ # if labels would give us filename that's longer than 128
366
+ # characters (124 + .whl), strip them
367
+ if len (long_name ) < 124 :
368
+ return long_name
369
+ return name
366
370
367
371
@property
368
372
def _distinfo_dir (self ) -> str :
You can’t perform that action at this time.
0 commit comments