File tree 1 file changed +15
-9
lines changed
1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change 1
1
from __future__ import annotations
2
2
3
3
import io
4
+ import json
4
5
import os
5
6
import os .path
6
7
import tempfile
10
11
import yaml
11
12
from hatchling .builders .hooks .plugin .interface import BuildHookInterface
12
13
from hatchling .metadata .plugin .interface import MetadataHookInterface
13
- from versioningit import get_version
14
+ from versioningit import errors , get_version
14
15
15
16
16
17
class MetadataHook (MetadataHookInterface ):
17
18
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" ]
26
32
if v in ("0.15.0" , "0.16.0" , "0.18.0" ):
27
33
v = f"{ v } .post1"
28
34
You can’t perform that action at this time.
0 commit comments