Opened 2 years ago

Last modified 2 years ago

#65643 new defect

python1.0 portgroup and selecting default python version.

Reported by: Lord-Kamina (Gregorio Litenstein) Owned by:
Priority: Normal Milestone:
Component: ports Version:
Keywords: python python_select portgroup Cc: reneeotten (Renee Otten)
Port: python310 python39 python38 python37 python36

Description

Ok so...

A while ago I made a local portfile (not sure why I never committed it, there must have been some mess or another in it) for an updated mesa.

At the time, I think python37 was what most ports were using, so I added a build dependency on python37 (and of course other modules it might need to build). I just upgraded to Monterey yesterday and was rebuilding all my ports, and this one failed to build. Why? Obviously, because the default python has moved on from 3.7, so the required submodules weren't installed.

I added a python39 variant, installed the appropriate deps and everything built and everyone was happy, but this got me thinking... isn't there a better way to deal with default python versions?

Then I got an idea I wanted to discuss, which is the purpose of this ticket. I'm not sure if there's anything preventing it, or if you intentionally don't want to handle it this way, but... couldn't the python portgroup determine the default version (and variant) based on the output of port select?

It would be as simple as doing port select --list python3 | grep -E '([a-zA-Z0-9]+)\s?\(active\)$' | sed 's|(active)||' (there is probably a better or more concise way to do it from macports itself, without resorting to bash and external processes, but you get the idea)

Is there any particular reason such behavior would be undesirable?

Change History (4)

comment:1 Changed 2 years ago by ryandesign (Ryan Carsten Schmidt)

port select is for the user to use. Ports shall not depend on it. (Just think about what would happen if a port were to be installed on one system (like our buildbot system for example) and that binary were then distributed to a user who might have a different version of Python selected.)

The default Python today, per the python 1.0 portgroup, is python310. Per email from Josh on the list, the default version of Python shall be updated every January.

comment:2 Changed 2 years ago by mascguy (Christopher Nielsen)

Cc: reneeotten added

comment:3 Changed 2 years ago by Lord-Kamina (Gregorio Litenstein)

I understand that ports should not depend on port select, but it would probably be pretty easy to check whether the port is installed and being used, and if it's not, the default would be the current behavior.

comment:4 Changed 2 years ago by reneeotten (Renee Otten)

Ryan already explained why the proposal in this ticket isn’t a good idea. I also don’t see a good use-case for this; the variable one should use is “python.defaul_version”. This ticket should just be closed IMHO.

Note: See TracTickets for help on using tickets.