From c7d55f59a460fadc7a49af9aa689b473dda2b782 Mon Sep 17 00:00:00 2001 From: Sean Marlow Date: Fri, 24 May 2024 14:57:09 -0400 Subject: [PATCH 1/2] Update python versions for ci --- .github/workflows/ci-workflow.yml | 28 +--------------------------- setup.py | 9 +++++---- 2 files changed, 6 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index 78c4653..c7a50b7 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -3,38 +3,12 @@ name: Continuous testing & Linting on: [push] jobs: - test36: - - runs-on: ubuntu-20.04 - strategy: - matrix: - python-version: [3.6] - - steps: - - uses: actions/checkout@v2 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install --upgrade pytest - pip install -e .[dev] - - name: Lint with flake8 - run: | - flake8 obs_img_utils - flake8 tests --exclude=data - - name: Test with pytest - run: | - pytest --no-cov-on-fail --cov=obs_img_utils - test: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.8, 3.9] + python-version: [3.8, 3.9, "3.10", 3.11] steps: - uses: actions/checkout@v2 diff --git a/setup.py b/setup.py index a57232c..47e2c3d 100644 --- a/setup.py +++ b/setup.py @@ -55,7 +55,7 @@ ] }, include_package_data=True, - python_requires='>=3.5', + python_requires='>=3.8', install_requires=requirements, extras_require={ 'dev': dev_requirements, @@ -73,8 +73,9 @@ 'GNU General Public License v3 or later (GPLv3+)', 'Natural Language :: English', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', ], ) From 88ad430673b003bb2c9e6749c1f8a57b58fad63c Mon Sep 17 00:00:00 2001 From: Sean Marlow Date: Fri, 24 May 2024 15:26:46 -0400 Subject: [PATCH 2/2] Update spec for python 3.11 build --- ...g-utils.spec => python-obs-img-utils.spec} | 81 +++++++++++++------ setup.cfg | 2 +- 2 files changed, 58 insertions(+), 25 deletions(-) rename package/{python3-obs-img-utils.spec => python-obs-img-utils.spec} (51%) diff --git a/package/python3-obs-img-utils.spec b/package/python-obs-img-utils.spec similarity index 51% rename from package/python3-obs-img-utils.spec rename to package/python-obs-img-utils.spec index 69af684..1815320 100644 --- a/package/python3-obs-img-utils.spec +++ b/package/python-obs-img-utils.spec @@ -1,5 +1,5 @@ # -# spec file for package python3-obs-img-utils +# spec file for package python-obs-img-utils # # Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # @@ -15,9 +15,18 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # - +%define upstream_name obs-img-utils +%define python python +%{?sle15_python_module_pythons} %bcond_without test -Name: python3-obs-img-utils + +%if 0%{?suse_version} > 1500 +%bcond_without libalternatives +%else +%bcond_with libalternatives +%endif + +Name: python-obs-img-utils Version: 1.3.0 Release: 0 Summary: API and CLI utilities for images in OBS @@ -26,23 +35,36 @@ Group: Development/Languages/Python Url: https://github.com/SUSE-Enceladus/obs-img-utils Source: https://files.pythonhosted.org/packages/source/o/obs-img-utils/obs-img-utils-%{version}.tar.gz BuildRequires: python-rpm-macros -BuildRequires: python3-devel -BuildRequires: python3-setuptools -BuildRequires: python3-click-man -BuildRequires: python3-click -BuildRequires: python3-PyYAML -BuildRequires: python3-lxml -BuildRequires: python3-xmltodict +BuildRequires: fdupes +BuildRequires: %{python_module devel} +BuildRequires: %{python_module pip} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} +BuildRequires: %{python_module click-man} +BuildRequires: %{python_module click} +BuildRequires: %{python_module PyYAML} +BuildRequires: %{python_module lxml} +BuildRequires: %{python_module xmltodict} %if %{with test} -BuildRequires: python3-coverage -BuildRequires: python3-pytest -BuildRequires: python3-pytest-cov +BuildRequires: %{python_module pytest} +%endif +Requires: python-PyYAML +Requires: python-click +Requires: python-lxml +Requires: python-xmltodict + +%if %{with libalternatives} +BuildRequires: alts +Requires: alts +%else +Requires(post): update-alternatives +Requires(postun): update-alternatives %endif -Requires: python3-PyYAML -Requires: python3-click -Requires: python3-lxml -Requires: python3-xmltodict + BuildArch: noarch +Provides: python3-obs-img-utils = %{version} +Obsoletes: python3-obs-img-utils < %{version} +%python_subpackages %description API and CLI utilities for images in OBS. @@ -54,23 +76,34 @@ Provides the following commands: - Get version info for a specific package %prep -%setup -q -n obs-img-utils-%{version} +%autosetup -n obs-img-utils-%{version} %build -python3 setup.py build +%pyproject_wheel mkdir -p man/man1 -python3 setup.py --command-packages=click_man.commands man_pages --target man/man1 +%python_exec setup.py --command-packages=click_man.commands man_pages --target man/man1 %install -python3 setup.py install --prefix=%{_prefix} --root=%{buildroot} +%pyproject_install install -d -m 755 %{buildroot}/%{_mandir}/man1 install -m 644 man/man1/*.1 %{buildroot}/%{_mandir}/man1 +%python_clone -a %{buildroot}%{_bindir}/obs-img-utils +%{python_expand %fdupes %{buildroot}%{$python_sitelib}} + +%pre +%python_libalternatives_reset_alternative obs-img-utils + +%post +%{python_install_alternative obs-img-utils} + +%postun +%{python_uninstall_alternative obs-img-utils} %check %if %{with test} export LC_ALL=en_US.utf-8 export LANG=en_US.utf-8 -python3 -m pytest --cov=obs_img_utils +%pytest %endif %files @@ -78,7 +111,7 @@ python3 -m pytest --cov=obs_img_utils %license LICENSE %doc CHANGES.md CONTRIBUTING.md README.md %{_mandir}/man1/* -%{_bindir}/obs-img-utils -%{python3_sitelib}/* +%python_alternative %{_bindir}/obs-img-utils +%{python_sitelib}/* %changelog diff --git a/setup.cfg b/setup.cfg index 14a284d..1f81853 100644 --- a/setup.cfg +++ b/setup.cfg @@ -9,7 +9,7 @@ tag = True [bumpversion:file:docs/source/conf.py] -[bumpversion:file:package/python3-obs-img-utils.spec] +[bumpversion:file:package/python-obs-img-utils.spec] [coverage:report] fail_under = 90