File tree Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change 11from __future__ import annotations
22
33import io
4+ import json
45import os
56import os .path
67import tempfile
1011import yaml
1112from hatchling .builders .hooks .plugin .interface import BuildHookInterface
1213from hatchling .metadata .plugin .interface import MetadataHookInterface
13- from versioningit import get_version
14+ from versioningit import errors , get_version
1415
1516
1617class MetadataHook (MetadataHookInterface ):
1718 def update (self , metadata : dict [str , Any ]) -> None :
18- v = get_version (
19- os .path .join (self .root , "uap-core" ),
20- config = {
21- "format" : {
22- "distance" : "{next_version}.dev{distance}" ,
23- }
24- },
25- )
19+ try :
20+ v = get_version (
21+ os .path .join (self .root , "uap-core" ),
22+ config = {
23+ "format" : {
24+ "distance" : "{next_version}.dev{distance}" ,
25+ }
26+ },
27+ )
28+ except errors .NotSdistError :
29+ with open (os .path .join (self .root , "uap-core" , "package.json" )) as ufile :
30+ ujson = json .load (ufile )
31+ v = ujson ["version" ]
2632 if v in ("0.15.0" , "0.16.0" , "0.18.0" ):
2733 v = f"{ v } .post1"
2834
You can’t perform that action at this time.
0 commit comments