From 403f5f73b78f45b0f0e24f66dd6f5f68d052e835 Mon Sep 17 00:00:00 2001 From: Adrian Moennich Date: Fri, 16 Aug 2024 17:59:51 +0200 Subject: [PATCH] Remove setuptools-related CI utils --- .github/utils/check_manifests.py | 52 -------------------------------- .github/utils/check_version.py | 8 ++--- .github/workflows/ci.yml | 3 -- 3 files changed, 4 insertions(+), 59 deletions(-) delete mode 100644 .github/utils/check_manifests.py diff --git a/.github/utils/check_manifests.py b/.github/utils/check_manifests.py deleted file mode 100644 index 29df0e6..0000000 --- a/.github/utils/check_manifests.py +++ /dev/null @@ -1,52 +0,0 @@ -# This file is part of the Indico plugins. -# Copyright (C) 2002 - 2024 CERN -# -# The Indico plugins are free software; you can redistribute -# them and/or modify them under the terms of the MIT License; -# see the LICENSE file for more details. - -import sys -from pathlib import Path - - -def _validate_manifest(plugin_dir: Path): - pkg_dir = plugin_dir / f'indico_{plugin_dir.name}' - pkg_file = plugin_dir / f'indico_{plugin_dir.name}.py' - if not pkg_dir.exists() and pkg_file.exists(): - return True - data_dirs = [ - sub.name - for sub in pkg_dir.iterdir() - if sub.name not in {'__pycache__', 'client'} and sub.is_dir() and not any(sub.glob('*.py')) - ] - if not data_dirs: - return True - expected_manifest = {f'graft {pkg_dir.name}/{plugin_dir}' for plugin_dir in data_dirs} - manifest_file = plugin_dir / 'MANIFEST.in' - if not manifest_file.exists(): - print(f'::error::{plugin_dir.name} has no manifest') - for line in expected_manifest: - print(f'::error::manifest entry missing: {line}') - return False - manifest_lines = set(manifest_file.read_text().splitlines()) - if missing := (expected_manifest - manifest_lines): - print(f'::error::{plugin_dir.name} has incomplete manifest') - for line in missing: - print(f'::error::manifest entry missing: {line}') - return False - return True - - -def main(): - errors = False - for plugin_dir in Path().iterdir(): - if not plugin_dir.is_dir() or plugin_dir.name == '_meta' or not (plugin_dir / 'setup.cfg').exists(): - continue - if not _validate_manifest(plugin_dir): - errors = True - - return 1 if errors else 0 - - -if __name__ == '__main__': - sys.exit(main()) diff --git a/.github/utils/check_version.py b/.github/utils/check_version.py index 4a3cd5c..5a676b7 100644 --- a/.github/utils/check_version.py +++ b/.github/utils/check_version.py @@ -6,12 +6,12 @@ # see the LICENSE file for more details. import sys -from configparser import ConfigParser +import tomllib +from pathlib import Path -cp = ConfigParser() -cp.read('_meta/setup.cfg') -version = cp['metadata']['version'] +data = tomllib.loads(Path('_meta/pyproject.toml').read_text()) +version = data['project']['version'] tag_version = sys.argv[1] if tag_version != version: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d6c6cd..ea8723f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -126,9 +126,6 @@ jobs: echo "VIRTUAL_ENV=$(pwd)/.venv" >> $GITHUB_ENV echo "$(pwd)/.venv/bin" >> $GITHUB_PATH - - name: Check manifests - run: python .github/utils/check_manifests.py - - name: Check import sorting if: success() || failure() run: isort --diff --check-only .