Recently, Python 3.3 got stabilized in Portage tree and added another slot to Python packages:

$ eix -I ^python$ -c
[I] dev-lang/python (2.7.5-r3(2.7)@10/26/2013 3.2.5-r3(3.2)@10/26/2013 3.3.2-r2(3.3)@12/02/2013): An interpreted, interactive, object-oriented programming language

After emerged Python 3.3, I set 3.3 as the active Python 3 version, system active version still is Python 2.7, don’t dare to try setting to Python 3 yet. At the time, I wanted to remove 3.2, but it was still pulled by some packages:

$ emerge -p --depclean --verbose =dev-lang/python-3.2.5-r3

Calculating dependencies... done!
  dev-lang/python-3.2.5-r3 pulled in by:
    dev-libs/libxml2-2.9.1-r1 requires >=dev-lang/python-3.2.5-r2:3.2[xml]
    dev-python/cython-0.19.1 requires >=dev-lang/python-3.2.5-r2:3.2
    dev-python/docutils-0.10 requires >=dev-lang/python-3.2.5-r2:3.2
    dev-python/jinja-2.6-r1 requires >=dev-lang/python-3.2.5-r2:3.2
    dev-python/lxml-3.0.1 requires >=dev-lang/python-3.2.5-r2:3.2
    dev-python/markdown-2.2.1-r1 requires >=dev-lang/python-3.2.5-r2:3.2
    dev-python/markupsafe-0.15-r1 requires >=dev-lang/python-3.2.5-r2:3.2
    dev-python/matplotlib-1.2.1 requires >=dev-lang/python-3.2.5-r2:3.2
    dev-python/numpy-1.6.2-r2 requires >=dev-lang/python-3.2.5-r2:3.2
    dev-python/pep8-1.4.5 requires >=dev-lang/python-3.2.5-r2:3.2
    dev-python/pycairo-1.10.0-r4 requires >=dev-lang/python-3.2.5-r2:3.2, dev-lang/python
    dev-python/pycurl-7.19.0-r3 requires >=dev-lang/python-3.2.5-r2:3.2
    dev-python/pygments-1.6 requires >=dev-lang/python-3.2.5-r2:3.2
    dev-python/pygobject-3.2.2-r1 requires >=dev-lang/python-3.2.5-r2:3.2
    dev-python/python-dateutil-2.1-r1 requires >=dev-lang/python-3.2.5-r2:3.2
    dev-python/pytz-2013b requires >=dev-lang/python-3.2.5-r2:3.2
    dev-python/pyxattr-0.5.2 requires >=dev-lang/python-3.2.5-r2:3.2
    dev-python/sip-4.14.3 requires >=dev-lang/python-3.2.5-r2:3.2
    dev-python/six-1.3.0 requires >=dev-lang/python-3.2.5-r2:3.2
    dev-python/sphinx-1.1.3-r6 requires >=dev-lang/python-3.2.5-r2:3.2
    dev-python/virtualenv-1.9.1-r1 requires >=dev-lang/python-3.2.5-r2:3.2
    virtual/python-argparse-1 requires >=dev-lang/python-3.2.5-r2:3.2
    x11-proto/xcb-proto-1.8-r3 requires >=dev-lang/python-3.2.5-r2:3.2

>>> No packages selected for removal by depclean
Packages installed:   845
Packages in world:    68
Packages in system:   44
Required packages:    845
Number to remove:     0

When you need to remove a package from Portage, --depclean is a safe way to check and do so. If Portage checks and finds out some packages depend on the package that you want to remove, then it will not be added to the removal list. If you want to find out what packages require it, use --verbose to get the detail.

These packages needs to be re-emerge against Python 3.3 instead of 3.2. I could manually put those packages and re-emerge them, but I decided to use python-updater:

$ python-updater -p
 * Starting Python Updater...
 * Main active version of Python:    2.7
 * Active version of Python 2:       2.7
 * Active version of Python 3:       3.3
 * Globally supported Python ABIs in installed repositories:
 *   gentoo:                         2.4 2.5 2.6 2.7 3.1 3.2 3.3 2.5-jython 2.7-jython 2.7-pypy-1.7 2.7-pypy-1.8 2.7-pypy-1.9 2.7-pypy-2.0
 *   Adding to list: app-portage/gentoolkit:0
 *   Adding to list: dev-python/bsddb3:0
 *   Adding to list: dev-python/chardet:0
 *   Adding to list: dev-python/elementtree:0
 *   Adding to list: dev-python/httplib2:0
 *   Adding to list: dev-python/imaging:0
 *   Adding to list: dev-python/oauth2:0
 *   Adding to list: dev-python/pyaudio:0
 *   Adding to list: dev-python/pycrypto:0
 *   Adding to list: dev-python/pycxx:0
 *   Adding to list: dev-python/pyopenssl:0
 *   Adding to list: dev-python/pyorbit:0
 *   Adding to list: dev-python/pyparsing:0
 *   Adding to list: dev-python/pyrex:0
 *   Adding to list: dev-python/pyxml:0
 *   Adding to list: dev-python/pyyaml:0
 *   Adding to list: sci-libs/scipy:0
 *   Adding to list: sys-apps/file:0
 *   Adding to list: sys-libs/cracklib:0
 *   Adding to list: sys-libs/libcap-ng:0
<Ctrl-C>

It compiled a different list and it ran really long time with default checks, after ten minutes or longer, disk non-stoppable accessing, I interrupted and decided to just just the list emerge gave me using simple shell command to compile the list:

$ emerge -quDN1 $(emerge -p --depclean --verbose =dev-lang/python-3.2.5-r3 | sed -n 's/^    \([^ ]\+\?\).*/>=\1/p')

Note that -N or --newuse is important to solve slot conflict because PYTHON_TARGETS changes to "python2_7 python3_3" from "python2_7 python3_2". I took the chance to also update those packages.

After it’s done,

# emerge --depclean --verbose =dev-lang/python-3.2.5-r3
[snip]
!!! existing preserved libs:
>>> package: dev-lang/python-3.2.5-r3
 *  - /usr/lib64/libpython3.2.so.1.0
 *      used by /usr/lib64/python3.2/site-packages/OpenSSL/SSL.cpython-32.so (dev-python/pyopenssl-0.12)
 *      used by /usr/lib64/python3.2/site-packages/OpenSSL/crypto.cpython-32.so (dev-python/pyopenssl-0.12)
 *      used by /usr/lib64/python3.2/site-packages/OpenSSL/rand.cpython-32.so (dev-python/pyopenssl-0.12)
 *      used by 61 other files
Use emerge @preserved-rebuild to rebuild packages using these libraries
# emerge -q @preserved-rebuild

Done.

Goodbye, Python 3.2, one I never really used much.