summaryrefslogtreecommitdiff
path: root/cerbero
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2024-02-06 23:19:18 +0530
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2024-02-09 02:40:49 +0000
commit942d0f61d4e6aa84f920578bc0932669b4879e39 (patch)
tree2b717b72550c56d7c9f4a16ea7e5cd3050387f32 /cerbero
parentacb3d637de0f70632d3c08931f6da3162c064006 (diff)
cerbero: Parse workspace Cargo.toml to extract version
Compatibility with https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1446 Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/1346>
Diffstat (limited to 'cerbero')
-rw-r--r--cerbero/build/build.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/cerbero/build/build.py b/cerbero/build/build.py
index 54756d3c..1bd2232c 100644
--- a/cerbero/build/build.py
+++ b/cerbero/build/build.py
@@ -1257,16 +1257,11 @@ class Cargo(Build, ModifyEnvBase):
tomllib = self.config.find_toml_module()
if not tomllib:
raise FatalError('toml module not found, try re-running bootstrap')
- cargo_toml_list = [os.path.join(self.config_src_dir, 'Cargo.toml')]
- cargo_toml_list += glob.glob(f'{self.config_src_dir}/**/Cargo.toml', recursive=True)
- for cargo_toml in cargo_toml_list:
- with open(cargo_toml, 'r', encoding='utf-8') as f:
- data = tomllib.loads(f.read())
- try:
- version = data['package']['version']
- except KeyError:
- continue
- return version
+ with open(os.path.join(self.config_src_dir, 'Cargo.toml'), 'r', encoding='utf-8') as f:
+ data = tomllib.loads(f.read())
+ if 'workspace' in data:
+ return data['workspace']['package']['version']
+ return data['package']['version']
async def configure(self):
if os.path.exists(self.cargo_dir):