Miro Hrončok 2020-03-02 11:56:15 +01:00
parent 9bb7de7385
commit 99d952cd6c
4 changed files with 77 additions and 2 deletions

View File

@ -6,7 +6,7 @@ License: MIT
# Keep the version at zero and increment only release
Version: 0
Release: 12%{?dist}
Release: 13%{?dist}
Source0: macros.pyproject
Source1: pyproject_buildrequires.py
@ -87,6 +87,9 @@ install -m 644 pyproject_buildrequires.py %{buildroot}%{_rpmconfigdir}/redhat/
%license LICENSE
%changelog
* Mon Mar 02 2020 Miro Hrončok <mhroncok@redhat.com> - 0-13
- Tox dependency generator: Handle deps read in from a text file (#1808601)
* Wed Feb 05 2020 Miro Hrončok <mhroncok@redhat.com> - 0-12
- Fallback to setuptools.build_meta:__legacy__ backend instead of setuptools.build_meta
- Properly handle backends with colon

View File

@ -189,6 +189,24 @@ def generate_run_requirements(backend, requirements):
requirements.extend(requires, source=f'wheel metadata: {key}')
def parse_tox_requires_lines(lines):
packages = []
for line in lines:
line = line.strip()
if line.startswith('-r'):
path = line[2:]
with open(path) as f:
packages.extend(parse_tox_requires_lines(f.read().splitlines()))
elif line.startswith('-'):
print_err(
f'WARNING: Skipping dependency line: {line}\n'
+ f' tox deps options other than -r are not supported (yet).',
)
else:
packages.append(line)
return packages
def generate_tox_requirements(toxenv, requirements):
requirements.add('tox-current-env >= 0.0.2', source='tox itself')
requirements.check(source='tox itself')
@ -203,7 +221,10 @@ def generate_tox_requirements(toxenv, requirements):
if r.stdout:
print_err(r.stdout, end='')
r.check_returncode()
requirements.extend(depfile.read().splitlines(),
deplines = depfile.read().splitlines()
packages = parse_tox_requires_lines(deplines)
requirements.extend(packages,
source=f'tox --print-deps-only: {toxenv}')

View File

@ -0,0 +1,48 @@
%global pypi_name openqa_client
Name: python-%{pypi_name}
Version: 4.0.0
Release: 1%{?dist}
Summary: Python client library for openQA API
License: GPLv2+
URL: https://github.com/os-autoinst/openQA-python-client
Source0: %{pypi_source}
BuildArch: noarch
BuildRequires: pyproject-rpm-macros
%description
This package uses tox.ini file with recursive deps (via the -r option).
%package -n python3-%{pypi_name}
Summary: %{summary}
%{?python_provide:%python_provide python3-%{pypi_name}}
%description -n python3-%{pypi_name}
%{summary}.
%prep
%autosetup -p1 -n %{pypi_name}-%{version}
# setuptools-git is needed to build the source distribution, but not
# for packaging, which *starts* from the source distribution
sed -i -e 's., "setuptools-git"..g' pyproject.toml
%generate_buildrequires
%pyproject_buildrequires -t
%build
%pyproject_wheel
%install
%pyproject_install
%check
%tox
%files -n python3-%{pypi_name}
%doc README.*
%license COPYING
%{python3_sitelib}/%{pypi_name}/
%{python3_sitelib}/%{pypi_name}-%{version}.dist-info/

View File

@ -28,6 +28,9 @@
- tldr:
dir: .
run: ./mocktest.sh tldr
- openqa_client:
dir: .
run: ./mocktest.sh python-openqa_client
required_packages:
- mock
- rpmdevtools