This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: bdist_rpm fails if no rpm command and rpmbuild is not in /usr/bin or /bin
Type: enhancement Stage: resolved
Components: Distutils Versions: Python 3.8
Status: closed Resolution: duplicate
Dependencies: Superseder: bdist_rpm should use rpmbuild, not rpm
View: 11122
Assigned To: Nosy List: bhyde, dstufft, eric.araujo, ned.deily
Priority: normal Keywords: easy, patch

Created on 2017-12-11 23:26 by bhyde, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 10589 closed n0npax, 2018-11-18 11:23
Messages (4)
msg308080 - (view) Author: Ben Hyde (bhyde) Date: 2017-12-11 23:26
With the fix below is becomes possible to build rpms on the Mac.

The developer will need to install rpm tooling.  That's easy via "brew install rpm".

That, for example, installs /usr/local/bin/rpmbuild.

Sadly only supports rpmbuild in two places, see:

Which due to the Mac's fastidious security setup we are very strongly discouraged from working around.

So, yeah, let's add a third, like so maybe:

        if ((os.path.exists('/usr/bin/rpmbuild')
             or os.path.exists('/bin/rpmbuild')
             or os.path.exists('/usr/local/bin/rpmbuild'))):
            rpm_cmd = ['rpmbuild']

And now I can use build_rpm on my mac, oh joy.
msg329434 - (view) Author: Ben Hyde (bhyde) Date: 2018-11-07 19:58
msg329551 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-11-09 19:56
Rather than searching a few hard-coded paths, I would think this would be a good case for using distutils.spawn find_executable like does :)  If someone (@bhyde) were willing to create a PR with that change, this issue will have a much better chance of being resolved.
msg330060 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-11-18 19:25
Thanks, @n0npax, for producing a PR implementing what I suggested.  It looks good.  However, while testing it, I ran across earlier open Issue11122 in which the same issue of building rpms on macOS is brought up. (Sorry I didn't see this earlier!)  The solution proposed there is to just unconditionally use rpmbuild as the use of rpm was for now obsolete versions.  I don't really have any experience with rpmbuild or stake in making the change.  But, rather than applying PR 10589, it looks like following through on Issue11122 would be the better approach.  Therefore, I'm going to close this issue (and PR) as a duplicate and suggest we move the discussion and perhaps generate a new PR there.
Date User Action Args
2022-04-11 14:58:55adminsetgithub: 76462
2018-11-18 19:25:44ned.deilysetstatus: open -> closed
superseder: bdist_rpm should use rpmbuild, not rpm
messages: + msg330060

resolution: duplicate
stage: patch review -> resolved
2018-11-18 11:23:41n0npaxsetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request9835
2018-11-09 20:00:30ned.deilysetkeywords: + easy
title: bdist_rpm v.s. the Macintosh -> bdist_rpm fails if no rpm command and rpmbuild is not in /usr/bin or /bin
stage: needs patch
versions: + Python 3.8, - Python 2.7
2018-11-09 19:56:37ned.deilysetnosy: + ned.deily
messages: + msg329551
2018-11-07 19:58:34bhydesetmessages: + msg329434
2017-12-11 23:26:49bhydecreate