File tree Expand file tree Collapse file tree 3 files changed +45
-3
lines changed Expand file tree Collapse file tree 3 files changed +45
-3
lines changed Original file line number Diff line number Diff line change @@ -60,13 +60,14 @@ test = [
60
60
variantlib = " variantlib.commands.main:main"
61
61
62
62
[project .entry-points ."variantlib .actions" ]
63
- analyze-wheel = " variantlib.commands.analyze_wheel:analyze_wheel"
64
63
analyze-platform = " variantlib.commands.analyze_platform:analyze_platform"
64
+ analyze-wheel = " variantlib.commands.analyze_wheel:analyze_wheel"
65
65
config = " variantlib.commands.config.main:main"
66
66
generate-index-json = " variantlib.commands.generate_index_json:generate_index_json"
67
+ get-variant-hash = " variantlib.commands.get_variant_hash:get_variant_hash"
67
68
make-variant = " variantlib.commands.make_variant:make_variant"
68
- unmake-variant = " variantlib.commands.unmake_variant:unmake_variant"
69
69
plugins = " variantlib.commands.plugins.main:main"
70
+ unmake-variant = " variantlib.commands.unmake_variant:unmake_variant"
70
71
update-pyproject-toml = " variantlib.commands.update_pyproject_toml:update_pyproject_toml"
71
72
72
73
[project .entry-points ."variantlib .actions .config" ]
Original file line number Diff line number Diff line change
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ import sys
5
+
6
+ from variantlib import __package_name__
7
+ from variantlib .api import VariantDescription
8
+ from variantlib .api import VariantProperty
9
+ from variantlib .constants import METADATA_VARIANT_HASH_HEADER
10
+
11
+
12
+ def get_variant_hash (args : list [str ]) -> None :
13
+ parser = argparse .ArgumentParser (
14
+ prog = f"{ __package_name__ } get-variant-hash" ,
15
+ description = "Compute the variant hash of a set of variant properties." ,
16
+ )
17
+
18
+ parser .add_argument (
19
+ "-p" ,
20
+ "--property" ,
21
+ dest = "properties" ,
22
+ type = VariantProperty .from_str ,
23
+ action = "extend" ,
24
+ nargs = "+" ,
25
+ help = (
26
+ "Variant Properties to add to the Wheel Variant, can be repeated as many "
27
+ "times as needed"
28
+ ),
29
+ default = [],
30
+ )
31
+
32
+ parsed_args = parser .parse_args (args )
33
+
34
+ _print_variant_hash (properties = parsed_args .properties )
35
+
36
+
37
+ def _print_variant_hash (properties : list [VariantProperty ]) -> None :
38
+ # Transform properties into a VariantDescription
39
+ vdesc = VariantDescription (properties = properties )
40
+
41
+ sys .stdout .write (f"{ METADATA_VARIANT_HASH_HEADER } : { vdesc .hexdigest } \n " )
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ def make_variant(args: list[str]) -> None:
55
55
group = parser .add_mutually_exclusive_group (required = True )
56
56
57
57
group .add_argument (
58
- "-P " ,
58
+ "-p " ,
59
59
"--property" ,
60
60
dest = "properties" ,
61
61
type = VariantProperty .from_str ,
You can’t perform that action at this time.
0 commit comments