File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 1- import toml
2- import requests
1+ import json
32import subprocess
3+ import tomllib
4+ from urllib .request import urlopen
45
5- cargo_toml = toml .load ("Cargo.toml" )
6+ with open ("Cargo.toml" , "rb" ) as f :
7+ cargo_toml = tomllib .load (f )
68crate_version = cargo_toml ["package" ]["version" ]
79print ("Detected crate version " + crate_version )
810
911api_url = "https://crates.io/api/v1/crates/x86_64/" + crate_version
10- released_version = requests . get ( api_url ).json ( )
12+ version_data = json . loads ( urlopen ( api_url ).read () )
1113
12- if "version" in released_version :
13- version = released_version ["version" ]
14+ if "version" in version_data :
15+ version = version_data ["version" ]
1416 assert (version ["crate" ] == "x86_64" )
1517 assert (version ["num" ] == crate_version )
1618 print ("Version " + crate_version + " already exists on crates.io" )
You can’t perform that action at this time.
0 commit comments