From 3a80670491f84504ee502bdbdef4960979081365 Mon Sep 17 00:00:00 2001 From: Azalea Gui <22280294+hykilpikonna@users.noreply.github.com> Date: Sun, 22 Dec 2024 06:23:17 -0500 Subject: [PATCH] [F] Fix version detection --- Cargo.toml | 2 +- setup.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 179cb3ce..a733ba34 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "2" members = ["crates/*"] [workspace.package] -version = "2.0.0" +version = "2.0.0-rc1" authors = ["Azalea Gui "] edition = "2021" rust-version = "1.75.0" diff --git a/setup.py b/setup.py index 4f16eac7..0cb8d53b 100755 --- a/setup.py +++ b/setup.py @@ -6,9 +6,10 @@ from setuptools import setup, find_namespace_packages HERE = Path(__file__).parent # Load version without importing it (see issue #192 if you are confused) -VERSION = "" -for l in (HERE / 'hyfetch' / '__version__.py').read_text().strip().splitlines(): - exec(l) +VERSION = [l for l in (HERE / "Cargo.toml").read_text('utf-8').splitlines() if l.startswith("version = ")] +if len(VERSION) != 1: + raise ValueError(f"Cannot determine version from Cargo.toml: {VERSION}") +VERSION = VERSION[0].split('"')[1] # The text of the README file README = (HERE / "README.md").read_text('utf-8')