Opened 9 years ago

Last modified 7 years ago

#46568 assigned defect

`port select --set <group>` does not symlink the correct Python utilities

Reported by: meitarm+macports@… Owned by: larryv (Lawrence Velázquez)
Priority: Normal Milestone:
Component: ports Version: 2.3.3
Keywords: Cc:
Port: python27

Description

As described in this Stack Overflow question (https://apple.stackexchange.com/q/167081/85015), the port select --set command does not activate the appropriate supporting utilities that are installed with the Python ports. For instance, switching the default system python from Apple's version to MacPort's version with port select --set python27 does not also create a symlink so that invoking easy_install invokes MacPort's /opt/local/bin/easy_install-2.7. This means that despite switching to MacPort's python, Apple's own easy_install will be invoked, which can lead to confusion when different Python versions are used to easy_install eggs.

This may be an issue with other ports, too, but I ran into this recently with Python and did not find an easy to way to instruct MacPorts to make the appropriate symlinks. (If there is such a way, I would be very grateful to be pointed at whatever documentation exists for doing that.)

Attachments (1)

python-select-support-easy_install.diff (10.6 KB) - added by neverpanic (Clemens Lang) 9 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 9 years ago by larryv (Lawrence Velázquez)

Other than easy_install, what executables aren’t being symlinked?

comment:2 in reply to:  1 ; Changed 9 years ago by meitarm+macports@…

Replying to larryv@…:

Other than easy_install, what executables aren’t being symlinked?

Well, the problem is bidirectional, which is to say, once I switch from Apple's Python to MacPort's, switching *back* to Apple's leaves numerous of the MacPorts Python executables symlinked. That is, for instance, /opt/local/bin/pydoc is still symlinked after port select --set python27-apple, which I would not expect given the presence of /usr/bin/pydoc provided by Apple.

These include:

  • pydoc
  • pythonw
  • python-config

I had at first thought the same thing was happening with virtualenv but my Mac doesn't seem to have an Apple-shipped copy of that. *shrug*

That said, the only executable that *never* gets symlinked appropriately I've noticed so far is easy_install. The others do get symlinked but never get touched again, which is unexpected behavior and also leads to a lot of confusing version checking.

comment:3 in reply to:  2 Changed 9 years ago by ryandesign (Ryan Carsten Schmidt)

I agree, easy_install does not get symlinked. That should probably be fixed.

As to the other problem you mentioned, I have never heard of that before and cannot reproduce it:

$ sudo port select --set python python27
Selecting 'python27' for 'python' succeeded. 'python27' is now active.
$ ls -l /opt/local/bin/py{doc,thon,thon-config,thonw}
lrwxr-xr-x  1 root  wheel  23 Jan 15 14:17 /opt/local/bin/pydoc -> /opt/local/bin/pydoc2.7
lrwxr-xr-x  1 root  wheel  24 Jan 15 14:17 /opt/local/bin/python -> /opt/local/bin/python2.7
lrwxr-xr-x  1 root  wheel  31 Jan 15 14:17 /opt/local/bin/python-config -> /opt/local/bin/python2.7-config
lrwxr-xr-x  1 root  wheel  25 Jan 15 14:17 /opt/local/bin/pythonw -> /opt/local/bin/pythonw2.7
$ sudo port select --set python python27-apple
Selecting 'python27-apple' for 'python' succeeded. 'python27-apple' is now active.
$ ls -l /opt/local/bin/py{doc,thon,thon-config,thonw}
lrwxr-xr-x  1 root  wheel  17 Jan 15 14:18 /opt/local/bin/pydoc -> /usr/bin/pydoc2.7
lrwxr-xr-x  1 root  wheel  18 Jan 15 14:18 /opt/local/bin/python -> /usr/bin/python2.7
lrwxr-xr-x  1 root  wheel  25 Jan 15 14:18 /opt/local/bin/python-config -> /usr/bin/python2.7-config
lrwxr-xr-x  1 root  wheel  19 Jan 15 14:18 /opt/local/bin/pythonw -> /usr/bin/pythonw2.7
$ sudo port select --set python none
Selecting 'none' for 'python' succeeded. 'none' is now active.
$ ls -l /opt/local/bin/py{doc,thon,thon-config,thonw}
ls: /opt/local/bin/pydoc: No such file or directory
ls: /opt/local/bin/python: No such file or directory
ls: /opt/local/bin/python-config: No such file or directory
ls: /opt/local/bin/pythonw: No such file or directory
$ 

comment:4 Changed 9 years ago by meitarm+macports@…

Huh, I didn't even realize there was a "none" option. :) And you're right, none works for me, too. I think I simply misunderstood the intended behavior when python27-apple was selected. So that being said, it's only easy_install that doesn't work as intended. Thanks for clarifying. :)

comment:5 Changed 9 years ago by larryv (Lawrence Velázquez)

Owner: changed from macports-tickets@… to larryv@…
Status: newassigned

Assigning this to myself as a reminder, but other committers should feel free to fix this if they wish.

Changed 9 years ago by neverpanic (Clemens Lang)

comment:6 Changed 9 years ago by neverpanic (Clemens Lang)

Untested patch attached. Does anybody have the capability to test the old OS X versions for easy_install and whether its version suffix had a dash or not?

comment:7 Changed 9 years ago by ned-deily (Ned Deily)

10.4:

$ ls -l /usr/bin/easy_install*
ls: /usr/bin/easy_install*: No such file or directory

10.5:

-rwxr-xr-x  1 root  wheel  364 Sep 23  2007 /usr/bin/easy_install
-rwxr-xr-x  1 root  wheel  372 Sep 23  2007 /usr/bin/easy_install-2.5

10.6:

-rwxr-xr-x  2 root  wheel  925 Jun 30  2009 /usr/bin/easy_install
-rwxr-xr-x  1 root  wheel  421 Jun 30  2009 /usr/bin/easy_install-2.5
-rwxr-xr-x  1 root  wheel  421 Jun 30  2009 /usr/bin/easy_install-2.6

comment:8 Changed 7 years ago by johan718 (Johan)

Has this ticket been closed yet?

Note: See TracTickets for help on using tickets.