Skip to content

Commit 4d2a214

Browse files
committed
feat: Get versions from a file
1 parent 84bb43a commit 4d2a214

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
rust = "1.91.1"
2+
rustup = "1.28.2"

x.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,18 @@
55
import os
66
import subprocess
77
import sys
8+
import tomllib
89

9-
rustup_version = "1.28.2"
10+
def load_versions():
11+
with open("versions.toml", "rb") as f:
12+
versions = tomllib.load(f)
13+
rust_version = versions['rust']
14+
rustup_version = versions['rustup']
15+
return rust_version, rustup_version
1016

17+
rust_version, rustup_version = load_versions()
1118
Channel = namedtuple("Channel", ["name", "rust_version"])
12-
stable = Channel("stable", "1.91.1")
19+
stable = Channel("stable", rust_version)
1320
nightly = Channel("nightly", "nightly")
1421
supported_channels = [
1522
stable,

0 commit comments

Comments
 (0)