Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bugzilla DB migration completed. Please report issues to Infra team via email via infra@gentoo.org or IRC
Bug 246182 - sys-apps/i2c-tools appears not to build py-smbus
Summary: sys-apps/i2c-tools appears not to build py-smbus
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Mobile Herd (OBSOLETE)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-11-09 17:09 UTC by lxg
Modified: 2009-01-14 18:00 UTC (History)
0 users

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


Attachments
Ebuild for a standalone py-smbus (py-smbus-3.0.2.ebuild,1.18 KB, text/plain)
2009-01-14 13:02 UTC, lxg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description lxg 2008-11-09 17:09:24 UTC
It seems that the package i2c-tools contains the python module "smbus". (There is no other package that appears to provide this module, and in i2c-tools, there's a reference to py-smbus). If this is not true, this bug is of course invalid.

The README file for py-smbus installed by i2c-tools suggests that the module could be built by this package. It also says that it needs lm_sensors to be installed.

However, <lm_sensors-3 is blocked by i2c-tools, while >=lm_sensors-3 is masked. But even after unmasking >=lm_sensors-3, emerging >=lm_sensors-3 (3.0.2 atm) and again emerging i2c-tools, the smbus module doesn't get built. 

Proposed solution: Add the python USE flag to the package; if it is activated, the package will pull in lm_sensors, then build py-smbus.

Reproducible: Always

Steps to Reproduce:
1. echo ">=sys-apps/lm_sensors-3" >> /etc/portage/package.unmask
2. emerge -av lm_sensors i2c-tools
3. python -c "import smbus"



# emerge --info
WARNING: repository at /usr/local/portage is missing a repo_name entry
Portage 2.2_rc13 (default/linux/x86/2008.0/desktop, gcc-4.3.2, glibc-2.8_p20080602-r0, 2.6.25-gentoo-r4 i686)
=================================================================
System uname: Linux-2.6.25-gentoo-r4-i686-Intel-R-_Pentium-R-_4_CPU_2.40GHz-with-glibc2.0
Timestamp of tree: Sun, 09 Nov 2008 14:46:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     3.2_p39
dev-lang/python:     2.4.4-r13, 2.5.2-r8
dev-python/pycrypto: 2.0.1-r6
dev-util/ccache:     2.4-r8
dev-util/cmake:      2.6.2
sys-apps/baselayout: 2.0.0
sys-apps/openrc:     0.3.0-r1
sys-apps/sandbox:    1.2.18.1-r3
sys-devel/autoconf:  2.63
sys-devel/automake:  1.7.9-r1, 1.9.6-r2, 1.10.1-r1
sys-devel/binutils:  2.18-r4
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   2.2.6a
virtual/os-headers:  2.6.27-r1
ACCEPT_KEYWORDS="x86 ~x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=i686 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-O2 -march=i686 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="buildpkg ccache distlocks parallel-fetch preserve-libs protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/ ftp://mirror.nutsmaas.nl/gentoo/"
LDFLAGS="-Wl,-O1"
LINGUAS="en"
MAKEOPTS="-j2 -s"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.de.gentoo.org/gentoo-portage"
USE="X acl acpi alsa bash-completition berkdb bluetooth branding bzip2 cdr cli cracklib crypt cups dbus dri dvd dvdr dvdread eds emboss encode evo fam firefox fortran gdbm gif gpm hal iconv ipv6 isdnlog jpeg kde libnotify mad midi mikmod mp3 mpeg mudflap ncurses nls nptl nptlonly ogg opengl openmp pam pcre pdf perl png ppds pppd python qt3 qt3support qt4 quicktime readline reflection sdl session spell spl ssl startup-notification svg sysfs tcpd tiff truetype unicode usb vorbis win32codecs x86 xml xorg xv zlib" ALSA_CARDS="hda-intel" 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="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 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" ELIBC="glibc" INPUT_DEVICES="keyboard mouse synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" USERLAND="GNU" VIDEO_CARDS="vesa vga intel"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 lxg 2008-11-09 17:41:21 UTC
Addendum:

It appears the the module smbus actually could be build from the contents of the i2c-tools package: When emerging i2c-tools and pressing Ctrl+C before the installation, you will find a directory /var/tmp/portage/sys-apps/i2c-tools-3.0.1/work/i2c-tools-3.0.1/py-smbus with a setup.py. This script is to compile the file smbusmodule.c.

However, a "python setup.py install" will fail due to missing definitions. It appears that smbusmodule.c lacks an include for linux/i2c.h (it only includes linux/i2c.h). After adding the include, the compile runs fine and the python module is installed.

However, it still appears to be broken:

# python -c "import smbus"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: /usr/lib/python2.5/site-packages/smbus.so: undefined symbol: i2c_smbus_process_call

Now I'm trying to find out what/where i2c_smbus_process_call could be.
Comment 2 lxg 2008-11-09 17:43:26 UTC
Sorry, in my last comment, it should say: "... (it only includes linux/i2c-dev.h)".
Comment 3 lxg 2008-11-09 17:52:32 UTC
There is a python-smbus package for Ubuntu Hardy: http://packages.ubuntu.com/de/hardy/i386/python-smbus/download

Copying the smbus.so and smbus-1.1-py2.5.egg-info from that Debian archive appears to work. At least 'python -c "import smbus"' does not fail anymore.
Comment 4 lxg 2009-01-14 13:02:59 UTC
Created attachment 178476 [details]
Ebuild for a standalone py-smbus

Ok, I finally found a fix for the problem; it is two-fold:

1. The i2c-tools ebuild should explicitely build the py-smbus module, which it currently doesn't.

2. There's a bug in the i2c-tools package's py-smbus/smbusmodule.c: Instead of including its own i2c-dev.h, it includes the kernel's one.

I've implemented the fix as an ebuild, because I need only py-smbus to work and I didn't want to mess around with a local ebuild of i2c-tools. Also, i2c-tools/lm_sensors are AFAIK only build dependencies for the py-smbus module, so I think it could as well be standalone in Portage.

The ebuild is attached, it also contains a patch for smbusmodule.c. Feel free to loot the ebuild and merge it into sys-apps/i2c-tools -- or to introduce a new ebuild for py-smbus.

By the way, why is >lm_sensors-3 still masked in Portage? And wouldn't it be possible to have i2c-tools not depend mandatorily on lm_sensors (Maybe a switch with a USE flag)? At least, there must have been a purpose in dividing both packages with v3.
Comment 5 SpanKY gentoo-dev 2009-01-14 16:19:31 UTC
i2c-tools-3.0.2 should work with USE=python
Comment 6 lxg 2009-01-14 18:00:11 UTC
Thanks for the the version bump and applying the fix. I just synced, updated i2c-tools and tried -- works like a charm.

And please ignore my statement about i2c-tools depending on >lm_sensors-3. I must have confused that when first investigated the issues with i2c-tools and since then had it in mind. But I just unmerged lm_sensors completely, and when trying to re-emerge i2c-tools, it doesn't require lm_sensors.