Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 401651 - dev-lang/python 3.1.4-r3 and 2.7.2-r3 sys-libs/readline is conditional on ncurses?
Summary: dev-lang/python 3.1.4-r3 and 2.7.2-r3 sys-libs/readline is conditional on ncu...
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Dependencies (show other bugs)
Hardware: x86 Linux
: Normal normal (vote)
Assignee: Python Gentoo Team
Depends on:
Reported: 2012-01-31 16:07 UTC by Walter Dnes
Modified: 2018-04-20 21:41 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Walter Dnes 2012-01-31 16:07:11 UTC
My USE var begins with "-*". In /etc/portage/package.use. I have the line...
dev-lang/python readline ssl xml
When emerging or re-emerging python, sys-libs/readline is not pulled in, and python's "readline" module is not built. If I emerge "sys-libs/readline" manually before emerging python, then python's readline module is built, and works properly. However, "emerge --depclean readline" wants to remove readline, notwithstanding python's "readline" flag. In summary...
* python ebuild honours "readline" flag (builds readline module) when readline is installed before python
* even with readline flag, python ebuild does not pull in readline, nor protect it against depclean

Reproducible: Always

Steps to Reproduce:
Part 1 of the problem
1. USE starts with "-*"
2. /etc/portage/package.use contains line "dev-lang/python readline ssl xml"
3. readline has not been installed
4. emerge -1 =dev-lang/python-2.7.2-r3 =dev-lang/python-3.1.4-r3
5. python-updater

Part 2 of problem
Same as above, but change step 3 to...
3. emerge -1 readline
Add step 6
6. emerge -pv --depclean readline
Actual Results:  
In Part 1
emerge command does not pull in readline.

waltdnes@d530 ~ $ python
Python 2.7.2 (default, Dec 14 2011, 00:09:44)
[GCC 4.5.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import readline
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named readline

In Part 2
waltdnes@d530 ~ $ python
Python 2.7.2 (default, Jan 31 2012, 02:14:56) 
[GCC 4.5.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import readline

Up-arrow, down-arrow, left-arrow, right-arrow all work OK... *BUT*

waltdnes@d530 ~ $ emerge -pv --depclean readline

Calculating dependencies... done!
>>> Calculating removal order...

>>> These are the packages that would be unmerged:

    selected: 6.2_p1 
   protected: none 
     omitted: none 

All selected packages: sys-libs/readline-6.2_p1

Expected Results:  
In Part 1
emerge should have pulled in sys-libs/readline allowing python's readline module to be built

In Part 2
"emerge -pv --depclean readline" should not want to remove sys-libs/readline

waltdnes@d530 ~ $ emerge --info
Portage (default/linux/x86/10.0, gcc-4.5.3, glibc-2.13-r4, 3.1.10-gentoo-r1 i686)
System uname: Linux-3.1.10-gentoo-r1-i686-Genuine_Intel-R-_CPU_2140_@_1.60GHz-with-gentoo-2.0.3
Timestamp of tree: Wed, 25 Jan 2012 23:15:01 +0000
app-shells/bash:          4.1_p9
dev-lang/python:          2.7.2-r3, 3.1.4-r3
dev-util/cmake:           2.8.6-r4
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.0.3
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.11.1
sys-devel/binutils:       2.21.1-r1
sys-devel/gcc:            4.5.3-r1
sys-devel/gcc-config:     1.4.1-r1
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r1
sys-kernel/linux-headers: 3.1 (virtual/os-headers)
sys-libs/glibc:           2.13-r4
Repositories: gentoo x-portage
CFLAGS="-O2 -march=native -mmmx -msse -msse2 -msse3 -mssse3 -mfpmath=sse -fomit-frame-pointer -pipe"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=native -mmmx -msse -msse2 -msse3 -mssse3 -mfpmath=sse -fomit-frame-pointer -pipe"
FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixlafiles news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
USE="X a52 aac bzip2 cxx dga dri exif ffmpeg flac fortran gallium gif intel jpeg mmx mng mp3 mpeg nptl nptlonly nsplugin offensive ogg opengl png posix sse sse2 sse3 ssse3 theora threads tiff truetype vim-syntax vorbis win32codecs wmf x86 xcomposite xpm xv xvid zlib" ALSA_CARDS="hda-intel" ALSA_PCM_PLUGINS="adpcm alaw copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol asym" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LINGUAS="en" USERLAND="GNU" VIDEO_CARDS="intel"
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2012-01-31 19:52:34 UTC
RDEPEND appears to be correct, so could you try again after emerging:
Comment 2 Walter Dnes 2012-02-01 06:12:46 UTC
I keyworded and emerged sys-apps/portage- and went through the cycle again. No change from before. I did some more looking at the ebuild, and I think I've found the problem.  "readline" is mentioned in 2 places in the python-2.7.2-r3 ebuild, and presumably the other ebuilds. The 2 places are in IUSE and RDEPEND.  In RDEPEND it's...

ncurses? (
        readline? ( >=sys-libs/readline-4.1 )

IANAD (I Am Not A Developer) but I read that fragment as 2 nested IF's...

IF "ncurses" flag
  pull in sys-libs/ncurses
  IF "readline" flag
    pull in sys-libs/readline

In other words, portage won't even try to pull in sys-libs/readline unless the "ncurses" flag is set. This seems to over-ride the IUSE line. I changed the line in /etc/portage/package.use to...

dev-lang/python ncurses readline ssl xml

...and it pulls in sys-libs/readline. Problem found. I need to set both "ncurses" and "readline".  Readline gets pulled in, and is now protected against depclean. Question, did the developers really intend to allow readline only if ncurses was present, or was this an error?
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-04-20 21:32:46 UTC
This looks really suspicious, and still applies to newest ebuilds.  In any case, we should either move the dep, or update module conditional to match.
Comment 4 Larry the Git Cow gentoo-dev 2018-04-20 21:41:53 UTC
The bug has been closed via the following commit(s):

commit b6c4829483f69298a2cd83f02a44ef24680ebb2c
Author:     Michał Górny <>
AuthorDate: 2018-04-20 21:37:56 +0000
Commit:     Michał Górny <>
CommitDate: 2018-04-20 21:41:44 +0000

    dev-lang/python: Move readline dep outside 'ncurses?'
    Move the dependency on readline to be independent of ncurses.  Looking
    at the code, there is no apparent reason for putting it inside
    'ncurses?' block.  Furthermore, it is inconsistent with how the readline
    module build is controlled.

 dev-lang/python/python-2.7.14-r1.ebuild | 6 ++----
 dev-lang/python/python-3.4.6-r1.ebuild  | 6 ++----
 dev-lang/python/python-3.5.5.ebuild     | 6 ++----
 dev-lang/python/python-3.6.5.ebuild     | 6 ++----
 4 files changed, 8 insertions(+), 16 deletions(-)