[MacPorts] #72227: duplicity @2.1.4: python shebang set so duplicity only runs from inside /opt/loca/bin/

MacPorts noreply at macports.org
Sun Mar 23 01:26:34 UTC 2025


#72227: duplicity @2.1.4: python shebang set so duplicity only runs from inside
/opt/loca/bin/
-------------------------+--------------------
  Reporter:  jbbythebch  |      Owner:  (none)
      Type:  defect      |     Status:  new
  Priority:  Normal      |  Milestone:
 Component:  ports       |    Version:  2.10.5
Resolution:              |   Keywords:
      Port:  duplicity   |
-------------------------+--------------------
Description changed by jbbythebch:

Old description:

> 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 replacing the above 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
> `'${pyhon.bin}'`, and it expaned 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.

New description:

 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
 `'${pyhon.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]

--

-- 
Ticket URL: <https://trac.macports.org/ticket/72227#comment:1>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list