Make pyproject.toml PEP 621 compliant

- converted tool.poetry to PEP 621 (default behavior for poetry)
- converted setup.py to PEP 621 (recommended by setuptools)
- use pyproject.toml instead of version.txt
- use importlib instead of version.txt
- use PEP 621 dependency format in flatpak build scripts
- added tomli as a dev dependency (used in build scripts)
- removed version.txt (no longer used)
- cleaned up dependencies

- version is still in desktop/setup.py (unclear on how snapcraft uses it)
- poetry lockfiles need to be rebuilt
This commit is contained in:
Timothy Cyrus 2025-03-13 18:38:11 -04:00
parent 2cee0508d1
commit 5e89cdcbc4
12 changed files with 197 additions and 175 deletions

View file

@ -1,5 +1,6 @@
#!/usr/bin/env python3
import os
import sys
import inspect
import click
import platform
@ -8,6 +9,11 @@ import shutil
import glob
import itertools
if sys.version_info >= (3, 11):
import tomllib
else:
import tomli as tomllib
from common import get_binary_arches
root = os.path.dirname(
@ -270,9 +276,10 @@ def package(app_path):
return
print("> Create DMG")
version_filename = f"{root}/cli/onionshare_cli/resources/version.txt"
with open(version_filename) as f:
version = f.read().strip()
pyproject_filename = f"{root}/cli/pyproject.toml"
with open(pyproject_filename, "rb") as f:
pyproject = tomllib.load(f)
version = pyproject['project']['version']
os.makedirs(f"{desktop_dir}/dist", exist_ok=True)
dmg_path = f"{desktop_dir}/dist/OnionShare-{version}.dmg"