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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wheel missing files generated at build #6197

Closed
3 tasks done
egorchakov opened this issue Aug 19, 2022 · 5 comments · Fixed by python-poetry/poetry-core#634
Closed
3 tasks done

Wheel missing files generated at build #6197

egorchakov opened this issue Aug 19, 2022 · 5 comments · Fixed by python-poetry/poetry-core#634
Labels
area/build-system Related to PEP 517 packaging (see poetry-core) kind/bug Something isn't working as expected

Comments

@egorchakov
Copy link

egorchakov commented Aug 19, 2022

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: macOS 12.3k
  • Poetry version: 1.2.0b3
  • Link of a Gist with the contents of your pyproject.toml file:

Issue

Python files generated during a build step (protobufs in my original case) don't make it into the wheel built with poetry build.

I do realize based on previous discussions around here that this particular combo is perhaps somewhat non-standard:

[tool.poetry.build]
generate-setup-file = true
script = "build.py"

I've put together a minimal project to demonstrate the issue at https://github.com/egorchakov/poetry-build-issue. To reproduce:

  1. clone the repo:
git clone https://github.com/egorchakov/poetry-build-issue
cd poetry-build-issue
  1. build:
make cleanbuild
  1. unzip the resulting wheel:
unzip dist/*.whl -d dist/wheel
  1. observe that the wheel is missing a file generated during a build step:
 ls dist/wheel/poetry_build_issue/generated
@egorchakov egorchakov added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Aug 19, 2022
@robtaylor
Copy link

robtaylor commented Nov 27, 2022

I'm also hitting this issue with a project that generates scripts to be installed. The problem seems to be that poetry-core only sources its list of scripts from local_config (in poetry.core.masonry.Builder.convert_script_files). It's not immediately obvious what a sensible fix would be.

I'm probably going to do some script stubs to get around the issue.

@robtaylor
Copy link

oh actually, maybe it is relatively simple to fix - in WheelBuilder._build look for scripts-${PYVER} in self._path / "build" and then add them appropriately .

I could probably throw a patch together tomorrow if there is interest

@egorchakov
Copy link
Author

FWIW I ended up with a hacky workaround: renaming the lib dir to lib.blah in order to match the "lib." glob from https://github.com/python-poetry/poetry-core/blob/main/src/poetry/core/masonry/builders/wheel.py#L184:

# build.py
from setuptools.command.build_py import build_py

class BuildPyCommand(build_py):
    def finalize_options(self):
        super().finalize_options()
        self.build_lib = f"{self.build_lib}.blah"

    def run(self):
        ...


def build(setup_kwargs):
    setup_kwargs.update(
        {
            "cmdclass": {
                "build_py": BuildPyCommand,
            },
        }
    )

@dimbleby
Copy link
Contributor

FWIW I ended up with a hacky workaround: renaming the lib dir to lib.blah in order to match the "lib." glob from https://github.com/python-poetry/poetry-core/blob/main/src/poetry/core/masonry/builders/wheel.py#L184:

the needed fix is probably as simple as changing that glob, then

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/build-system Related to PEP 517 packaging (see poetry-core) kind/bug Something isn't working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants