[MacPorts] #67055: python portgroup overwrites PYTHONPATH in test.env

MacPorts noreply at macports.org
Mon Mar 13 01:47:20 UTC 2023

#67055: python portgroup overwrites PYTHONPATH in test.env
  Reporter:  dgilman  |      Owner:  reneeotten
      Type:  defect   |     Status:  assigned
  Priority:  Normal   |  Milestone:
 Component:  ports    |    Version:
Resolution:           |   Keywords:
      Port:           |

Comment (by reneeotten):

 Replying to [comment:6 jmroot]:
 > Replying to [comment:4 dgilman]:
 > > A portfile with only `python.test_framework pytest` and `test.run yes`
 also emits an empty PYTHONPATH
 > That at least is expected, since it gets the value by globbing in
 $worksrcpath, so if that's empty, so will be the glob result. At minimum
 it probably makes sense to not set the environment variable if the glob
 doesn't match anything.

 It appears that when using {{{setuptools}}} as the backend for
 {{{python.pep517}}} you always get something in
 {{{${worksrcpath}/build/lib*}}}, whereas at least in this case with
 {{{flit}}} as backend you don't (not sure if that's always true).
 However, if the globbing is empty and thus as a result {{{PYTHONPATH}}} is
 so as well; this is set as {{{test.env-append}}} in the {{{pre-test}}}
 phase, which then overriden in the Portfile with
 test.env        FOO=bar PYTHONPATH=${worksrcpath}/src

 so I fail to see how this empty variable can be originating from the

 I can try and figure out how to not set this if the glob-result is empty
 but don't understand how/if this is the actual underlying reason for the
 reported error.

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

More information about the macports-tickets mailing list