%pyproject_buildrequires -x now implies -r

The usage without -r errored anyway, this way instead of forcing the user to add it,
we do it ourselves.

Machines stealing human's labor, yet again.
This commit is contained in:
Miro Hrončok 2020-07-16 13:35:02 +02:00
parent 37216e779e
commit 262f6d3bc3
3 changed files with 13 additions and 9 deletions

View File

@ -55,7 +55,7 @@ For example, if upstream suggests installing test dependencies with
`pip install mypackage[testing]`, the test deps would be generated by:
%generate_buildrequires
%pyproject_buildrequires -r -x testing
%pyproject_buildrequires -x testing
For projects that specify test requirements in their [tox] configuration,
these can be added using the `-t` flag (default tox environment)
@ -79,11 +79,11 @@ Or specify more environments if needed:
The `-e` option redefines `%{toxenv}` for further reuse.
Use `%{default_toxenv}` to get the default value.
Note that `-t` implies `-r`, because tox normally assumes the package is installed
including all the runtime dependencies.
The `-t`/`-e` option uses [tox-current-env]'s `--print-deps-to-file` behind the scenes.
Note that both `-x` and `-t` imply `-r`,
because runtime dependencies are always required for testing.
[tox]: https://tox.readthedocs.io/
[tox-current-env]: https://github.com/fedora-python/tox-current-env/

View File

@ -6,7 +6,7 @@ License: MIT
# Keep the version at zero and increment only release
Version: 0
Release: 17%{?dist}
Release: 18%{?dist}
# Macro files
Source001: macros.pyproject
@ -101,6 +101,10 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856
%license LICENSE
%changelog
* Thu Jul 16 2020 Miro Hrončok <mhroncok@redhat.com> - 0-18
- %%pyproject_buildrequires -x (extras requires for tests) now implies -r
(runtime requires) instead of erroring without it for better UX.
* Wed Jul 15 2020 Miro Hrončok <mhroncok@redhat.com> - 0-17
- Set HOSTNAME to prevent tox 3.17+ from a DNS query
- Fixes rhbz#1856356

View File

@ -279,7 +279,8 @@ def main(argv):
)
parser.add_argument(
'-x', '--extras', metavar='EXTRAS', default='',
help='extra for runtime requirements (e.g. -x testing)',
help='extra for runtime requirements (e.g. -x testing) '
'(implies --runtime)',
# XXX: a comma-separated list should be possible here
# help='comma separated list of "extras" for runtime requirements '
# + '(e.g. -x testing,feature-x)',
@ -295,9 +296,8 @@ def main(argv):
args.toxenv = (args.toxenv or os.getenv('RPM_TOXENV') or
f'py{sys.version_info.major}{sys.version_info.minor}')
if args.extras and not args.runtime:
print_err('-x (--extras) are only useful with -r (--runtime)')
exit(1)
if args.extras:
args.runtime = True
try:
generate_requires(