Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 462304

Summary: app-eselect/eselect-python should maintain pkgconfig symlinks
Product: Gentoo Linux Reporter: David E. Narváez <david.narvaez>
Component: Current packagesAssignee: Python Gentoo Team <python>
Status: RESOLVED WONTFIX    
Severity: enhancement CC: gentoo, jkt, mgorny
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description David E. Narváez 2013-03-19 12:36:29 UTC
I'd like to propose some symlinks to help other scripts find python through PkgConfig:

/usr/lib64/pkgconfig/python.pc
/usr/lib64/pkgconfig/python2.pc
/usr/lib64/pkgconfig/python3.pc

what they would point to is very much self explaining.

Reproducible: Always

Steps to Reproduce:
1. Try to find python configuration with pkg-config python --libs
Actual Results:  
 # pkg-config python --libs
Package python was not found in the pkg-config search path.
Perhaps you should add the directory containing `python.pc'
to the PKG_CONFIG_PATH environment variable
No package 'python' found

Expected Results:  
The configuration for the default Python version should be displayed

The bug report in the URL would benefit from this enhancement.

# emerge --info
Portage 2.1.11.55 (default/linux/amd64/13.0/desktop/kde, gcc-4.7.2, glibc-2.16.0, 3.6.6-gentoo-gnu x86_64)
=================================================================
System uname: Linux-3.6.6-gentoo-gnu-x86_64-AMD_Athlon-tm-_64_X2_Dual_Core_Processor_6400+-with-gentoo-2.2
KiB Mem:     3794320 total,    126356 free
KiB Swap:          0 total,         0 free
Timestamp of tree: Mon, 11 Mar 2013 12:15:01 +0000
ld GNU ld (GNU Binutils) 2.23.1
app-shells/bash:          4.2_p42
dev-java/java-config:     2.2.0::java-overlay
dev-lang/python:          2.6.8-r1, 2.7.3-r3, 3.1.5-r1, 3.2.3-r2
dev-util/cmake:           2.8.10.2-r2::kde
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.11.8
sys-apps/sandbox:         2.6
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.7.9-r2, 1.8.5-r3, 1.9.6-r2, 1.10.3, 1.11.6, 1.12.6, 1.13.1
sys-devel/binutils:       2.23.1
sys-devel/gcc:            4.5.3-r1, 4.6.3, 4.7.2, 4.8.0_pre9999::toolchain
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r5::gnome
sys-kernel/linux-headers: 3.8 (virtual/os-headers)
sys-libs/glibc:           2.16.0
Repositories: gentoo science kde dMaggot sabayon gnome java-overlay qt toolchain
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA dlj-1.1 AdobeFlash-10.1 Oracle-BCLA-JavaSE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=athlon64 -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt /usr/share/polkit-1/actions /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/apache2-php5.4/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=athlon64 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://www.gtlib.gatech.edu/pub/gentoo "
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/science /var/lib/layman/kde /var/lib/layman/dMaggot /var/lib/layman/sabayon /var/lib/layman/gnome /var/lib/layman/java-overlay /var/lib/layman/qt /var/lib/layman/toolchain"
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="X a52 aac acl acpi alsa amd64 bash-completion berkdb bluetooth branding bzip2 c++0x cairo cdda cdr cli consolekit cracklib crypt cups cxx dbus declarative doc dri dts dvd dvdr emacs emboss encode examples exif fam firefox flac fortran gdbm gif gpm gstreamer iconv ipv6 java java6 jpeg kde kipi kpathsea latex lcms ldap mad mmx mng modules mp3 mp4 mpeg mudflap multilib ncurses nls nptl ogg opengl openmp pam pango pcre pdf phonon plasma png policykit posix ppds python qt3support qt4 readline sdl semantic-desktop session spell sse sse2 ssl startup-notification svg tcpd theora tiff truetype udev udisks unicode upower usb vorbis wifi wxwidgets x264 xcb xcomposite xinerama xml xscreensaver xv xvid zlib" ABI_X86="64" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en es" PHP_TARGETS="php-5-3 php-5-4" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" QEMU_SOFTMMU_TARGETS="i386 x86_64" QEMU_USER_TARGETS="i386 x86_64" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-03-20 19:25:08 UTC
First of all, there's no relevance between your proposal and the one you try to refer to. The functions there need to access specific Python implementation, not a random eselected one.

Secondly, pkg-config files are not a playground. You want a new pkg-config file, take it to upstream. We won't invent something like that or in a few months people will have random packages failing on other distros because a few lazy folks started to rely on this.
Comment 2 David E. Narváez 2013-03-22 12:18:37 UTC
(In reply to comment #1)
> Secondly, pkg-config files are not a playground. You want a new pkg-config
> file, take it to upstream. We won't invent something like that or in a few
> months people will have random packages failing on other distros because a
> few lazy folks started to rely on this.

Upstream's relevant installation part is as follows:

# Install the interpreter by creating a symlink chain:
#  $(PYTHON) -> python2 -> python$(VERSION))
# Also create equivalent chains for other installed files
bininstall:	altbininstall
	[...]
	-test -d $(DESTDIR)$(LIBPC) || $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(LIBPC)
	-rm -f $(DESTDIR)$(LIBPC)/python2.pc
	(cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION).pc python2.pc)
	-rm -f $(DESTDIR)$(LIBPC)/python.pc
	(cd $(DESTDIR)$(LIBPC); $(LN) -s python2.pc python.pc)

So your argument is the other way around: packages that work in other distros fail in Gentoo because it is missing the default layout. In fact, unless you use Gentoo-specific tools you are unable to answer the basic question of "what's the python configuration?" which is the whole point of this enhancement.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-03-22 13:05:20 UTC
If that is so, let's re-consider this. As a side note, arch doesn't do 'python.pc' either.
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-03-22 21:55:58 UTC
One potential issue I see here is that we're introducing one additional point of failure -- since packages are not allowed to rely upon non-specific pkg-config files in Gentoo.

We can wrap executables and even python-config to respect EPYTHON -- but I don't see how we could really wrap pkg-config files without doing something quite ugly. And since I don't think we can/should do something like that by default, we're likely to end up with packages which query the wrong Python version and nobody notices for a while since it's the default one.
Comment 5 David E. Narváez 2013-03-22 22:27:38 UTC
(In reply to comment #4)
> One potential issue I see here is that we're introducing one additional
> point of failure -- since packages are not allowed to rely upon non-specific
> pkg-config files in Gentoo.
> 
> We can wrap executables and even python-config to respect EPYTHON -- but I
> don't see how we could really wrap pkg-config files without doing something
> quite ugly. And since I don't think we can/should do something like that by
> default, we're likely to end up with packages which query the wrong Python
> version and nobody notices for a while since it's the default one.

Are you referring to the case when, e.g., a user switches to Python 3.x as the default Python and builds a package that only works in Python 2.x? Or the case when a user builds packages with the correct version and later switches Python versions and things stop working?
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2013-03-22 22:34:12 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > One potential issue I see here is that we're introducing one additional
> > point of failure -- since packages are not allowed to rely upon non-specific
> > pkg-config files in Gentoo.
> > 
> > We can wrap executables and even python-config to respect EPYTHON -- but I
> > don't see how we could really wrap pkg-config files without doing something
> > quite ugly. And since I don't think we can/should do something like that by
> > default, we're likely to end up with packages which query the wrong Python
> > version and nobody notices for a while since it's the default one.
> 
> Are you referring to the case when, e.g., a user switches to Python 3.x as
> the default Python and builds a package that only works in Python 2.x?

This one but in a more general version.

Let's suppose user has 2.7+3.2 enabled -- the default values. Package foo supports both so should be built against both. But the build system just queries 'pkg-config python', so it gets whatever Python version was eselected. We end up having to work hard to work-around this.
Comment 7 David E. Narváez 2013-03-23 05:02:28 UTC
(In reply to comment #6)
> Let's suppose user has 2.7+3.2 enabled -- the default values. Package foo
> supports both so should be built against both. But the build system just
> queries 'pkg-config python', so it gets whatever Python version was
> eselected. We end up having to work hard to work-around this.

Ok, I see your point and I can't say I totally disagree. Yet, I'd argue that a packager can epatch that to be 'pkg-config python$(python_get_version --major)' which would work perfectly regardless of what's the eselection at emerge time.
Comment 8 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-04-21 18:11:04 UTC
eselect-python won't do this.  For package builds, the eclasses already create necessary symlinks.
Comment 9 Mike Gilbert gentoo-dev 2023-03-12 03:38:23 UTC
*** Bug 900907 has been marked as a duplicate of this bug. ***