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

0.9.24: create temporary directory before build trashes pep517 build #81

Closed
kloczek opened this issue Apr 10, 2024 · 7 comments
Closed

Comments

@kloczek
Copy link

kloczek commented Apr 10, 2024

Looks like some bits are missing in pyproject.toml and create temporary directory in source tree before start build trashes pep517 build.

+ /usr/bin/python3 -sBm build -w --no-isolation
* Getting build dependencies for wheel...
No `packages` or `py_modules` configuration, performing automatic discovery.
`flat-layout` detected -- analysing .
discovered packages -- ['json5', 'SPECPARTS']
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
    main()
  File "/usr/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
    json_out['return_val'] = hook(**hook_input['kwargs'])
  File "/usr/lib/python3.10/site-packages/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
    return hook(config_settings)
  File "/usr/lib/python3.10/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
    return self._get_build_requires(config_settings, requirements=['wheel'])
  File "/usr/lib/python3.10/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
    self.run_setup()
  File "/usr/lib/python3.10/site-packages/setuptools/build_meta.py", line 311, in run_setup
    exec(code, locals())
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.10/site-packages/setuptools/__init__.py", line 104, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 159, in setup
    dist.parse_config_files()
  File "/usr/lib/python3.10/site-packages/setuptools/dist.py", line 631, in parse_config_files
    pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
  File "/usr/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 68, in apply_configuration
    config = read_configuration(filepath, True, ignore_option_errors, dist)
  File "/usr/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 133, in read_configuration
    return expand_configuration(asdict, root_dir, ignore_option_errors, dist)
  File "/usr/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 158, in expand_configuration
    return _ConfigExpander(config, root_dir, ignore_option_errors, dist).expand()
  File "/usr/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 206, in expand
    self._expand_all_dynamic(dist, package_dir)
  File "/usr/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 251, in _expand_all_dynamic
    version=self._obtain_version(dist, package_dir),
  File "/usr/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 300, in _obtain_version
    return _expand.version(self._obtain(dist, "version", package_dir))
  File "/usr/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 289, in _obtain
    return self._expand_directive(
  File "/usr/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 283, in _expand_directive
    return _expand.read_attr(directive["attr"], package_dir, root_dir)
  File "/usr/lib/python3.10/site-packages/setuptools/config/expand.py", line 188, in read_attr
    _parent_path, path, module_name = _find_module(module_name, package_dir, root_dir)
  File "/usr/lib/python3.10/site-packages/setuptools/config/expand.py", line 229, in _find_module
    if package_dir:
  File "/usr/lib/python3.10/site-packages/setuptools/config/expand.py", line 459, in __len__
    return len(self._target())
  File "/usr/lib/python3.10/site-packages/setuptools/config/expand.py", line 452, in _target
    self._value = self._obtain()
  File "/usr/lib/python3.10/site-packages/setuptools/config/expand.py", line 422, in _get_package_dir
    self()
  File "/usr/lib/python3.10/site-packages/setuptools/config/expand.py", line 412, in __call__
    self._dist.set_defaults(name=False)  # Skip name, we can still be parsing
  File "/usr/lib/python3.10/site-packages/setuptools/discovery.py", line 352, in __call__
    self._analyse_package_layout(ignore_ext_modules)
  File "/usr/lib/python3.10/site-packages/setuptools/discovery.py", line 386, in _analyse_package_layout
    or self._analyse_flat_layout()
  File "/usr/lib/python3.10/site-packages/setuptools/discovery.py", line 443, in _analyse_flat_layout
    return self._analyse_flat_packages() or self._analyse_flat_modules()
  File "/usr/lib/python3.10/site-packages/setuptools/discovery.py", line 449, in _analyse_flat_packages
    self._ensure_no_accidental_inclusion(top_level, "packages")
  File "/usr/lib/python3.10/site-packages/setuptools/discovery.py", line 479, in _ensure_no_accidental_inclusion
    raise PackageDiscoveryError(cleandoc(msg))
setuptools.errors.PackageDiscoveryError: Multiple top-level packages discovered in a flat-layout: ['json5', 'SPECPARTS'].

To avoid accidental inclusion of unwanted files or directories,
setuptools will not proceed with this build.

If you are trying to create a single distribution with multiple packages
on purpose, you should not rely on automatic discovery.
Instead, consider the following options:

1. set up custom discovery (`find` directive with `include` or `exclude`)
2. use a `src-layout`
3. explicitly set `py_modules` or `packages` with a list of names

To find more information, look for "package discovery" on setuptools docs.

ERROR Backend subprocess exited when trying to invoke get_requires_for_build_wheel

In this case has been created SPECPARTS/ direcotry as part of the packaging process.

@dpranke
Copy link
Owner

dpranke commented Apr 11, 2024

Hi! Thanks for the bug report.

I'm not yet able to reproduce what you're seeing (trying with python3.10 and python3.12 on a Mac, haven't tried a linux machine, which is probably required).

Do you have any idea where the SPECPARTS directory is coming from? Is it maybe present before you try running python3 -sBm build?

I've never heard of this directory before, but it looks like it might come from rpm. If it is there, I can believe that you're getting the multiple top-level packages error.

Can you try adding

[tool.setuptools]
packages = ["json5"]

to the pyproject.toml file and see if that fixes the problem? I think it probably will, and while I don't think it should be needed (i.e., I'm guessing that rpm is messing things up), I wouldn't object to adding it.

@kloczek
Copy link
Author

kloczek commented Apr 11, 2024

I'm not yet able to reproduce what you're seeing (trying with python3.10 and python3.12 on a Mac, haven't tried a linux machine, which is probably required).

This issue has nothing to do wit OS platform.
Clone repository and than mkdir temp; python3 -sBm build -w --no-isolation.

@dpranke
Copy link
Owner

dpranke commented Apr 11, 2024

This issue has nothing to do wit OS platform. Clone repository and than mkdir temp; python3 -sBm build -w --no-isolation.

Okay. With that I can reproduce the problem. I suppose asking you to not create a top-level directory and then run this command is not helpful? :)

At any rate, can you try the fix I'm suggesting above (with the change to pyproject.toml)? It fixes the problem for me and I believe it is probably the right way to address this sort of thing.

@kloczek
Copy link
Author

kloczek commented Apr 12, 2024

FYI: many jaraco modules are suffering the same issue as they mowed recently to simplest possible pyprojest.toml.
In on of my tickets comment was that maybe it could be applied some change to setuptools and others to fix that centrally.
I have now kind of workaround for this issue in my build procedures and I'll keep record of this ticket so please for now keep opened this ticket and I'll let you know about th progres on that "central" fix.

@dpranke
Copy link
Owner

dpranke commented Apr 12, 2024

This is now fixed in version 0.9.25.

@kloczek
Copy link
Author

kloczek commented Apr 12, 2024

Tested and works now 👍
Thank you 😄

@dpranke
Copy link
Owner

dpranke commented Apr 13, 2024

You're welcome! Thanks again for reporting the bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants