Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

build.py causes FTBFS from alternative build tool #640

Closed
grawlinson opened this issue Jan 2, 2023 · 9 comments
Closed

build.py causes FTBFS from alternative build tool #640

grawlinson opened this issue Jan 2, 2023 · 9 comments
Labels
bug Something isn't working

Comments

@grawlinson
Copy link
Contributor

Hey, package maintainer from Arch Linux here. 馃憢

Just picking up our conversation from #600.

I can't seem to get reuse to build from source when using the build module to generate Python wheels.

Why do we use build? Well ... Because there are ~5 (at last count) different ways to build a Python project that is PEP-517 compatible, hence us trying to only use the `build` module to build wheels rather than remembering the various CLI invocations for each individual tool. `build` is smart enough to hook into these other PEP-517 compatible builders and use their own build systems to generate a wheel/sdist archive.

The only hint I have of something breaking is running the following:

[root@chroot reuse]# python -m build --help
po/gl.po: warning: Charset "CHARSET" is not a portable encoding name.
                   Message conversion to user's charset might not work.

The command fails successfully, resulting in no wheel archive in dist/.

Any subsequent invocations of python -m build --help result in no output and no wheel archive in dist/:

[root@chroot reuse]# python -m build --help
[root@chroot reuse]#
For reference, this is the normal output:
$ python -m build --help
usage: python -m build [-h] [--version] [--sdist] [--wheel] [--outdir OUTDIR] [--skip-dependency-check] [--no-isolation] [--config-setting CONFIG_SETTING] [srcdir]

    A simple, correct PEP 517 build frontend.

    By default, a source distribution (sdist) is built from {srcdir}
    and a binary distribution (wheel) is built from the sdist.
    This is recommended as it will ensure the sdist can be used
    to build wheels.

    Pass -s/--sdist and/or -w/--wheel to build a specific distribution.
    If you do this, the default behavior will be disabled, and all
    artifacts will be built from {srcdir} (even if you combine
    -w/--wheel with -s/--sdist, the wheel will be built from {srcdir}).

positional arguments:
  srcdir                source directory (defaults to current directory)

options:
  -h, --help            show this help message and exit
  --version, -V         show program's version number and exit
  --sdist, -s           build a source distribution (disables the default behavior)
  --wheel, -w           build a wheel (disables the default behavior)
  --outdir OUTDIR, -o OUTDIR
                        output directory (defaults to {srcdir}/dist)
  --skip-dependency-check, -x
                        do not check that build dependencies are installed
  --no-isolation, -n    do not isolate the build in a virtual environment
  --config-setting CONFIG_SETTING, -C CONFIG_SETTING
                        pass options to the backend.  options which begin with a hyphen must be in the form of "--config-setting=--opt(=value)" or "-C--opt(=value)"

After flailing around, I've managed to find a horrible horrible hacky workaround that I most definitely am not proud of. Here be dragons.

@stephanlachnit
Copy link

Just wanted to say that we have the exact same issue on Debian. Your patch fixes building, but I still get super odd behavior. E.g.

E: reuse: unknown-file-in-python-module-directory [usr/lib/python3/dist-packages/AUTHORS.rst]
E: reuse: unknown-file-in-python-module-directory [usr/lib/python3/dist-packages/CHANGELOG.md]
E: reuse: unknown-file-in-python-module-directory [usr/lib/python3/dist-packages/README.md]

These are files clearly installed in the wrong directory.

Also, I'm not sure if installing the Licenses to usr/lib/python3/dist-packages/reuse-1.1.0.dist-info/LICENSES/ is a good idea either, since distribution have their own way to handle installation of licenses. But maybe that's too specific, and it can be easily patched.

priv-kweihmann added a commit to priv-kweihmann/meta-sca that referenced this issue Jan 14, 2023
revert back to use picobuild instead of python build for reuse.
See fsfe/reuse-tool#640 for more
details

Signed-off-by: Konrad Weihmann <kweihmann@outlook.com>
@carmenbianca
Copy link
Member

@stephanlachnit Your bug is fixed in #657 and has been released as a patch in v1.1.1.

@carmenbianca carmenbianca added the bug Something isn't working label Feb 5, 2023
@stephanlachnit
Copy link

@carmenbianca the licenses are still installed:

I: reuse: package-contains-documentation-outside-usr-share-doc [usr/lib/python3/dist-packages/reuse-1.1.1.dist-info/LICENSES/Apache-2.0.txt]
I: reuse: package-contains-documentation-outside-usr-share-doc [usr/lib/python3/dist-packages/reuse-1.1.1.dist-info/LICENSES/CC-BY-SA-4.0.txt]
I: reuse: package-contains-documentation-outside-usr-share-doc [usr/lib/python3/dist-packages/reuse-1.1.1.dist-info/LICENSES/CC0-1.0.txt]
I: reuse: package-contains-documentation-outside-usr-share-doc [usr/lib/python3/dist-packages/reuse-1.1.1.dist-info/LICENSES/GPL-3.0-or-later.txt]

The other files (README etc) are gone though.

@grawlinson
Copy link
Contributor Author

It might be easier to switch away from Poetry to something with a proven track record.

@stephanlachnit
Copy link

It might be easier to switch away from Poetry to something with a proven track record.

I'm sure you can achieve good results with poetry, but I agree that I think there is not a lot of experience in terms of distribution yet (at least on the end user side).

@carmenbianca
Copy link
Member

Regarding the licences: This is deliberate Poetry behaviour. See python-poetry/poetry-core#57.

I did nothing to configure this. By mere virtue of the LICENSES/ directory existing, the licence files are put in the dist-info directory. I don't know whether this is good or bad. In any case, it should affect all Poetry projects.

@carmenbianca
Copy link
Member

carmenbianca commented Feb 9, 2023

@grawlinson @stephanlachnit #674 should fix the bug listed in the original comment. It turned out to be surprisingly easy. I aim to have a patch release (v1.1.2) out really soon that contains exclusively this fix (+ the fix from v1.1.1, obviously). Thank you for being awesome maintainers!

@carmenbianca
Copy link
Member

Closed by #675.

v1.1.2 is released on PyPI. Thanks again @ maintainers!

@stephanlachnit
Copy link

Can confirm it works, thanks @carmenbianca!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants