Nixpkgs: Python distutils needs patching for `bdist_rpm` to work

Created on 14 Apr 2020  路  6Comments  路  Source: NixOS/nixpkgs

Describe the bug
When trying to create an RPM package from a python package using:

python setup.py bdist_rpm

the command fails with:

rpm -bb --define __python python3 --define _topdir python-project/build/bdist.linux-x86_64/rpm --clean build/bdist.linux-x86_64/rpm/SPECS/python-project.spec
rpm: -bb: unknown option
error: command 'rpm' failed with exit status 1

While I'm aware that building RPMs is not exactly a normal use-case for nixpkgs, I'd still like to know if we can fix this. It seems that we would need to patch distutils so it will find the rpmbuild command, which it tries to locate in /usr/bin. See also: https://stackoverflow.com/a/61089631/3139711

To Reproduce
Steps to reproduce the behavior:

  1. Clone any python-project
  2. Try to run python setup.py bdist_rpm in the project

Expected behavior
The command should produce an RPM.

Notify maintainers
@FRidh

Metadata

  • system: "x86_64-linux"
  • host os: Linux 5.5.15, NixOS, 20.03beta1155.29eddfc36d7 (Markhor)
bug python

All 6 comments

I suppose it's trivial to just remove the prefix so it would search $PATH so you could make it work when having rpm available`.

@FRidh Do you maybe have a hint on why my try on fixing this via: https://github.com/knedlsepp/nixpkgs/commit/c4211db43fb6352f7184693ca47fb42c7eb05357
fails during evaluation with:

$ nix-build -A python37
error: anonymous function at /home/josef.kemetmueller/Code/nixpkgs/pkgs/build-support/fetchurl/boot.nix:5:1 called with unexpected argument 'meta', at /home/josef.kemetmueller/Code/nixpkgs/pkgs/build-support/fetchpatch/default.nix:18:1
(use '--show-trace' to show detailed location information)

Off-topic: Whatever is wrong with that is currently also affecting py39 when "hasDistutilsCxxPatch" is false: https://github.com/NixOS/nixpkgs/blob/e50c67ad7eefa8e77436fbd0366b69638b1c8713/pkgs/development/interpreters/python/cpython/default.nix#L119-L124
Which also fails to evaluate.

Python 3 is nowadays used for bootstrapping, however, at that point fetchpatch is not available yet. Thus, for bootstrapping (see python3Minimal) that hasDistutilsCxxPatch needs to be disabled.

Thus, for bootstrapping (see python3Minimal) that hasDistutilsCxxPatch needs to be disabled.

Looks like this is not set by any explicit condition:
https://github.com/NixOS/nixpkgs/blob/e50c67ad7eefa8e77436fbd0366b69638b1c8713/pkgs/development/interpreters/python/cpython/default.nix#L67
Should we add a function argument like isMinimal to communicate this?

Do you maybe have a hint on why my try on fixing this via: knedlsepp@c4211db
fails during evaluation with

@knedlsepp You may need to either check for whether you are in bootstrap or just put the patch in git.

Thank you for the help. I opened #85268 to fix this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

spacekitteh picture spacekitteh  路  3Comments

tomberek picture tomberek  路  3Comments

yawnt picture yawnt  路  3Comments

copumpkin picture copumpkin  路  3Comments

teto picture teto  路  3Comments