Commit Graph

54 Commits

Author SHA1 Message Date
Miro Hrončok
99d952cd6c Tox dependency generator: Handle deps read in from a text file
Resolves https://bugzilla.redhat.com/show_bug.cgi?id=1808601

tox docs: https://tox.readthedocs.io/en/latest/example/basic.html#depending-on-requirements-txt-or-defining-constraints

Relevant tox-current-env issue: https://github.com/fedora-python/tox-current-env/issues/22
2020-03-05 13:44:54 +01:00
Miro Hrončok
9bb7de7385 Fedora CI: Update the mock config to support mock 2.0
See https://github.com/rpm-software-management/mock/wiki/Release-Notes-2.0
2020-02-12 15:29:11 +01:00
Miro Hrončok
dbb90f5dc1 Preserve existing flags in shebangs of Python files in /usr/bin
Use pathfix.py with -k and -a flags

Solves problems like https://bugzilla.redhat.com/show_bug.cgi?id=1335203
2020-02-07 18:35:06 +01:00
Miro Hrončok
6210f94e46 Handle backends with colon, fallback to setuptools.build_meta:__legacy__
Falling back to setuptools.build_meta:__legacy__ is the standard behavior,
not setuptools.build_meta. See PEP 517:

https://www.python.org/dev/peps/pep-0517/

> If the pyproject.toml file is absent, or the build-backend key is missing,
> the source tree is not using this specification, and tools should revert
> to the legacy behaviour of running setup.py (either directly, or by
> implicitly invoking the setuptools.build_meta:__legacy__ backend).

Falling back to setuptools.build_meta had very similar results so far.,
but the behavior might change in the feature.

While working on this, I have uncovered a problem in our code.
It was not able to handle backends with ":". Looking at PEP 517 again:

> build-backend is a string naming a Python object that will be used to
> perform the build. This is formatted following the same module:object syntax
> as a setuptools entry point. For instance, if the string is "flit.api:main",
> this object would be looked up by executing the equivalent of:
>
>    import flit.api
>    backend = flit.api.main
>
> It's also legal to leave out the :object part, e.g.
>
>    build-backend = "flit.api"
>
> which acts like:
>
>    import flit.api
>    backend = flit.api

We now handle such cases properly. Witch the change of the default backend,
we also test a backend with colon in our tests.
2020-02-05 13:31:45 +01:00
Fedora Release Engineering
52b92ea408 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-01-30 10:14:51 +00:00
Miro Hrončok
f50ab5f517 Tests: Simplify tldr.spec
- drop stuff that we don't need to test this
- use macros where possible
- use explicit test command when testing stuff
- make sure dist-info is a directory
2019-11-22 13:56:05 +01:00
Patrik Kopkan
49a323e46e create directory in $PWD for built wheel
It is little bit more explicit than installing wheels from $PWD.
2019-11-21 13:12:18 +01:00
Anna Khaitovich
f2dfb52b9f Add tldr.spec to the tests 2019-11-14 19:27:36 +01:00
Anna Khaitovich
8cce1fad47 Remove stray __pycache__ directory from /usr/bin when running %pyproject_install
Solves bz#1739848
2019-11-14 11:40:28 +01:00
Miro Hrončok
50464a4b19 Satisfy the flake8 linter, unify quotation marks 2019-10-25 17:07:29 +02:00
Miro Hrončok
d5c3fb3c5a When tox fails, print tox output before failing
Previously, it wasn't possible to see why tox failed:

...
Requirement satisfied: tox-current-env >= 0.0.2
   (installed: tox-current-env 0.0.2)
Traceback (most recent call last):
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 269, in main
    generate_requires(
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 221, in generate_requires
    generate_tox_requirements(toxenv, requirements)
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 184, in generate_tox_requirements
    r = subprocess.run(
  File "/usr/lib64/python3.8/subprocess.py", line 512, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['tox', '--print-deps-to-file', '/tmp/tmp96smu4rv', '-qre', 'py38']' returned non-zero exit status 1.

Now it is:

...
Requirement satisfied: tox-current-env >= 0.0.2
   (installed: tox-current-env 0.0.2)
ERROR: tox config file (either pyproject.toml, tox.ini, setup.cfg) not found
Traceback (most recent call last):
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 270, in main
    generate_requires(
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 222, in generate_requires
    generate_tox_requirements(toxenv, requirements)
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 193, in generate_tox_requirements
    r.check_returncode()
  File "/usr/lib64/python3.8/subprocess.py", line 444, in check_returncode
    raise CalledProcessError(self.returncode, self.args, self.stdout,
subprocess.CalledProcessError: Command '['tox', '--print-deps-to-file', '/tmp/tmpwp8sffv1', '-qre', 'py38']' returned non-zero exit status 1.

Inspired by https://src.fedoraproject.org/rpms/python-chaospy/pull-request/1#comment-32750
2019-10-25 16:57:01 +02:00
Miro Hrončok
2262ba2ff5 Fedra CI: Adapt to mock-core-configs >= 31.4 2019-10-08 13:40:26 +02:00
Miro Hrončok
102626373e Move a verbose line of %pyproject_buildrequires from stdout to stderr
The `rm -v` command prints the output to stderr, polluting the generated buildrequires

  $ rm -rfv pytest_harvest.dist-info/
  removed 'pytest_harvest.dist-info/METADATA'
  removed 'pytest_harvest.dist-info/LICENSE'
  removed 'pytest_harvest.dist-info/top_level.txt'
  removed 'pytest_harvest.dist-info/entry_points.txt'
  removed directory 'pytest_harvest.dist-info/'

This can lead to RPM errors:

  error: Dependency tokens must begin with alpha-numeric, '_' or '/': 'pytest_harvest.dist-info/METADATA'

Or bogus dependencies -- the SRPM requires "removed" and "directory".

See https://github.com/rpm-software-management/rpm/pull/889
2019-10-08 13:01:08 +02:00
Miro Hrončok
2a3b101709 Fedora CI: Run mock on the current Fedora version (or 31 if less than 31) 2019-09-23 15:34:26 +02:00
Petr Viktorin
137aa316c4 Bump release 2019-09-20 10:18:12 +02:00
Miro Hrončok
97d785b58d Don't use --strip-file-prefix with pip, the custom option is gone 2019-09-20 01:32:33 +02:00
Miro Hrončok
7e01f58f73 Fedora CI: Publish the mock logs even when it fails 2019-09-18 17:31:26 +02:00
Petr Viktorin
d262d909f5 Use importlib_metadata rather than pip freeze 2019-09-18 16:16:17 +02:00
Miro Hrončok
23901d999a Fedora CI: Update pluggy to avoid a missing dependency on importlib_metadata
Unfortunately, it no longer has custom toxenv
2019-09-12 12:58:17 +02:00
Miro Hrončok
f3157b5237 Add test that uses poetry 2019-09-03 18:16:57 +02:00
Miro Hrončok
11da7b793a Documentation typo 2019-08-27 14:54:28 +02:00
Miro Hrončok
31ef675ff5 Support spaces in %toxenv 2019-08-21 18:01:31 +02:00
Miro Hrončok
fda0a23075 -t means "use tox", -e means "use this toxenv", -e implies -t
Further fixes
2019-08-13 14:42:21 +02:00
Miro Hrončok
c975fbe6ec --toxenv implies --runtime 2019-08-13 14:05:50 +02:00
Miro Hrončok
7ba1a33967 Use tox with --print-deps-to-file instead of parsing stdout 2019-08-12 17:29:26 +02:00
Miro Hrončok
ec073171f3 Add %tox macro to invoke tests 2019-07-29 14:42:53 +02:00
Miro Hrončok
0124d2a76f Define and save %toxenv for further use 2019-07-26 17:26:11 +02:00
Miro Hrončok
8a60635881 Allow to fetch test dependencies from tox 2019-07-26 15:07:11 +02:00
Fedora Release Engineering
6cfe9d4b22 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-07-26 11:47:03 +00:00
Petr Viktorin
a1bd01ac86 Clean up python-entrypoints.spec 2019-07-18 11:54:04 +02:00
Petr Viktorin
03316d81e7 Document run-time deps 2019-07-18 11:24:18 +02:00
Petr Viktorin
aca2f6a0c4 Mark multiple extras as not supported yet 2019-07-18 11:00:23 +02:00
Petr Viktorin
d6e6bb7dfb Allow specifying extras for build dependencies 2019-07-18 10:50:13 +02:00
Petr Viktorin
3600e9832d Adjust help and error messages 2019-07-18 09:24:02 +02:00
Petr Viktorin
c7e7d1e003 Ignore extra requirements (rather than fail) 2019-07-18 09:10:09 +02:00
Petr Viktorin
bc156c4460 Generate run-time requirements for tests 2019-07-18 08:59:44 +02:00
Petr Viktorin
204b801da2 Add --without tests bcond 2019-07-18 08:38:42 +02:00
Petr Viktorin
5abd40fa6b Remove unused return value 2019-07-17 16:25:20 +02:00
Petr Viktorin
095970b345 Fix call to pip
Use sys.executable and decode the output
2019-07-17 16:21:42 +02:00
Petr Viktorin
0878a7a9a4 Remove unused CLI argument 2019-07-17 16:06:54 +02:00
Petr Viktorin
50645e10a3 Refactor and add tests 2019-07-17 15:57:02 +02:00
Petr Viktorin
e6c1981103 Clean up try blocks
- minimize code in try blocks
- remove "except Exception" (global error handling to be added later)
2019-07-17 12:29:05 +02:00
Miro Hrončok
dd5ff52621 Build packages on Fedora CI 2019-07-17 12:17:47 +02:00
Miro Hrončok
fdf511644e Add %pyproject_buildrequires 2019-07-05 11:28:55 +02:00
Miro Hrončok
d81f3dfe39 Add test spec file 2019-07-02 12:50:01 +00:00
Patrik Kopkan
ff932e5705 Merge #2 Use source names instead of numbers 2019-07-02 12:46:53 +00:00
Miro Hrončok
48b7c9c2bf Add changelog for 253976c and a94281a 2019-07-02 14:02:54 +02:00
Miro Hrončok
a94281a5df %pyproject_install: Add --no-warn-script-location
Otherwise you see:

    WARNING: The scripts py.test and pytest are installed in '/builddir/build/BUILDROOT/pytest-4.6.4-1.fc31.x86_64/usr/bin' which is not on PATH.
      Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

And that is not relevant for us.
2019-07-02 13:58:24 +02:00
Miro Hrončok
253976c0e7 Fix shell syntax in the install macro
This was the error:

    /var/tmp/rpm-tmp.UmO2Gv: line 45: syntax error near unexpected token `fi
2019-07-02 13:57:24 +02:00
Miro Hrončok
48b8e40baf README nitpick: The %pyproject_install macro installs from PWD 2019-07-02 13:56:49 +02:00