Skip to content

Sample build breaks if LICENSE.txt file contains GPL2 license text (containing 0x0c) #209

@osamuaoki

Description

@osamuaoki

Hi,

Thank you for providing very useful resource.

NOTE: I am not raising issue of the license terms of this sampleproject like #17 since this is MIT licensed.

ISSUE

Issue is supportive technical information to adopt this example to the packaging of existing GPL programs.

If I simply replace LICENSE.txt content with the LICENSE file content of GPL license, the resulting wheel package failed to upload to testpypi.org.

 $ twine upload --verbose --repository testpypi dist/*
...
ERROR    HTTPError: 400 Bad Request from https://test.pypi.org/legacy/
         The description failed to render in the default format of reStructuredText. See https://test.pypi.org/help/#description-content-type for more information.

The local test result of such package goes:

 $ python3 -m build;twine check dist/*
 ...
Successfully built sampleproject_osamu_debian_org-3.2.0.tar.gz and sampleproject_osamu_debian_org-3.2.0-py3-none-any.whl
Checking dist/sampleproject_osamu_debian_org-3.2.0-py3-none-any.whl: FAILED
ERROR    `long_description` has syntax errors in markup and would not be rendered on PyPI.                                                                                   
         line 2: Warning: Block quote ends without a blank line; unexpected unindent.                                                                                        
WARNING  `long_description_content_type` missing. defaulting to `text/x-rst`.                                                                                                
Checking dist/sampleproject_osamu_debian_org-3.2.0.tar.gz: PASSED

WORKAROUND

In order to avoid this ERROR to successfully transition to the new pyproject.toml, I need to do the followings on LICENSE.txt file

  • Replace all back-tics with single-quote
  • Remove all leading whitespaces

and live with WARNING or use the last option of commenting out license = { file = "LICENSE.txt"} in pyproject.toml to stop including LICENSE.txt into METADATA file in the wheel package.

I am not sure what is the best solution here.

Desired situation

At least some pointer to the best solution for resolving this situation needs to be easily available to the prospectus users.

I think the build tool should be smart enough to wrap/escape problematic character sequence in the LICENSE.txt to avoid causing issues. But that is not the case now. Requiring to edit LICENSE.txt manually to avoid ERROR seems to be bad idea.

Dropping license = "LICENSE.txt" in pyproject.toml seems to be most practical solution for now. You still get to include unmodified LICENSE into wheel package.

Maybe, it may be a good idea to add link to the root cause bug until it is fixed.

Additional note

As I checked https://github.com/pypa/build , its pyproject.toml has license.file = "LICENSE" but the resulting METADATA doesn't contain it. This build is built by flint-core while the sampleproject uses requires = ["setuptools>=43.0.0", "wheel"] as the build backend.

FYI: I post my packaging experience around this at: https://osamuaoki.github.io/en/2024/02/03/python-pypi/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions