Opened 14 months ago
Last modified 14 months ago
#72227 new defect
duplicity @2.1.4: python shebang set so duplicity only runs from inside /opt/local/bin/
| Reported by: | jbbythebch (jbbythebch) | Owned by: | |
|---|---|---|---|
| Priority: | Normal | Milestone: | |
| Component: | ports | Version: | 2.10.5 |
| Keywords: | Cc: | jmroot (Joshua Root) | |
| Port: | duplicity |
Description (last modified by ryandesign (Ryan Carsten Schmidt))
This port and version seemed to work fine, but after an upgrade from macOS 13.x to 15.3.2, and then running 'sudo port migrate', duplicity will only run if it is called from inside '/opt/local/bin/'.
I tried uninstalling and cleaning the port, and reinstalling it; still has the same issue.
The shebang for '/opt/local/bin/duplicity' (which links to '/opt/local/Library/Frameworks/Python.framework/Versions/3.11/bin/duplicity' is '#!python'.
The shebang for the 'duplicity' source file on Gitlab is '#!/usr/bin/env python3'.
I tested the reinplace command in duplicity's Portfile, by setting up a local port for duplicity, and changing the replacement text with junk text, to see if the reinplace command was working, and it worked fine, unless the replacement was an actual path to a valid python interpreter.
For example, I changed the reinplace command
from:
reinplace "s|^#!/usr/bin/env python3$|#!${python.bin}|" ${worksrcpath}/bin/${f}
to:
reinplace "s|^#!/usr/bin/env python3$|#!/opt/local/bin/pythonXXX|" ${worksrcpath}/bin/${f}
And the shebang became '#!/opt/local/bin/pythonXXX', which of course is useless, but it showed the reinplace command seemed to be working correctly.
I used a similar 'reinplace' command to replace some comment text with '${python.bin}', and it expanded the variable to:
'#!/opt/local/Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11'
which is the correct python interpreter as far as I can tell, so the variable is correct.
But, somewhere what the shebang is supposed to be, and what it seems like the Portfile sets it to,
'#!/opt/local/Library/Frameworks/Python.framework/Versions/3.11/bin/python3.11'
gets changed to '#!python'.
To get it working, I just manually edited the shebang in my installation, so it now runs from anywhere, but this issue should be addressed by someone who understands a lot more about MacPorts than I do.
[Edit 2025-03-22, minor clarification, and fix spelling on a word]
Change History (3)
comment:1 Changed 14 months ago by jbbythebch (jbbythebch)
| Description: | modified (diff) |
|---|
comment:2 Changed 14 months ago by ryandesign (Ryan Carsten Schmidt)
| Description: | modified (diff) |
|---|---|
| Summary: | duplicity @2.1.4: python shebang set so duplicity only runs from inside /opt/loca/bin/ → duplicity @2.1.4: python shebang set so duplicity only runs from inside /opt/local/bin/ |
comment:3 Changed 14 months ago by ryandesign (Ryan Carsten Schmidt)
| Cc: | jmroot added |
|---|
This is being done deliberately by setuptools 75.3.2 and later.
This was changed to fix this bug report.
MacPorts has been using an affected version of setuptools since November 2024.
Maybe lots of ports built with setuptools after we updated to that version would be affected by this problem and would need fixes.
Here is the bug report about the problems that this change causes, like what you reported. There it is explained why the change was made. It also sounds like the problem would only affect python ports that disable pep517, like duplicity does, so that's fortunately much fewer than all python ports.

Our precompiled binary of duplicity 2.1.4 for macOS 12 x86_64 (built December 20, 2023) does not have this problem, but if I rebuild from source then I do see the problem. Something has perhaps changed in one of its dependencies or in the python portgroup to cause this new problem.