From: Michael Mercier <michael.mercier-MZpvjPyXg2s@public.gmane.org>
To: Jean Delvare <jdelvare-l3A5Bk7waGM@public.gmane.org>
Cc: Angelo Compagnucci
<angelo.compagnucci-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, "Renz,
Bernhard" <bernhard.renz-//tT4aWmXyZBDgjK7y7TUQ@public.gmane.org>
Subject: Re: i2c-tools: add compatibility for python2/3 to py-smbus
Date: Thu, 22 Jan 2015 14:28:10 +0100 [thread overview]
Message-ID: <1421933290.21840.1@smtp.inria.fr> (raw)
In-Reply-To: <20150122114958.3178f5f6-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
Thanks a lot!
It was a linking problem. I applied the patch and I it works for both
python2 and python3.
For those who are interested you can choose to the python version with
the PYTHON variable:
make install # use "python" so it depends on your system configuration
make install PYTHON=python2 # for python 2 explicitly
make install PYTHON=python3 # for python 3 explicitly
I have only tested read_i2c_block_data write_i2c_block_data for python
3.2 and python 2.7.
I think you can push these patchs upstream.
Thanks again,
Michael Mercier
Le jeu. 22 janv. 2015 à 11:49, Jean Delvare <jdelvare-l3A5Bk7waGM@public.gmane.org> a
écrit :
> Hi again Michael,
>
> On Thu, 22 Jan 2015 09:56:58 +0100, Michael Mercier wrote:
>> I just tried you patch and I got an error when I try to import the
>> smbus python package:
>>
>> import smbus
>>
>> ImportError:
>> /usr/local/lib/python3.2/dist-packages/smbus.cpython-32mu.so:
>> undefined
>> symbol: i2c_smbus_process_call
>>
>> Any idea?
>
> Hmm, OK, I think I see what's going on here.
>
> There are two i2c-tools branches: the stable branch (3.1) and the
> development branch (SVN trunk.) The patch I sent was for the
> development branch.
>
> One important difference between the two branches is that, in the
> stable branch, the i2c API is implemented as a set of inline
> functions,
> while in the development branch it is a library. I don't think that
> py-smbus was properly ported so most likely it was already broken
> before my patch. I suppose you are using SVN trunk and this is why you
> have this linking problem?
>
> If that is the case, then maybe the following patch will do the trick:
>
> ---
> py-smbus/Module.mk | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- i2c-tools.orig/py-smbus/Module.mk 2012-04-26 12:05:55.351086796
> +0200
> +++ i2c-tools/py-smbus/Module.mk 2015-01-22 11:47:06.524806243 +0100
> @@ -12,7 +12,7 @@ PY_SMBUS_DIR := py-smbus
> PYTHON ?= python
> DISTUTILS := \
> cd $(PY_SMBUS_DIR) && \
> - CPPFLAGS="$(CPPFLAGS) -I../include" $(PYTHON) setup.py
> + CPPFLAGS="$(CPPFLAGS) -I../include" LDFLAGS="$(LDFLAGS) -Llib
> -li2c" $(PYTHON) setup.py
>
> all-python: $(INCLUDE_DIR)/i2c/smbus.h
> $(DISTUTILS) build
>
> But please keep in mind that my python knowledge is non-existent so it
> might be plain wrong. Hopefully Angelo can comment on this.
>
> --
> Jean Delvare
> SUSE L3 Support
> --
> To unsubscribe from this list: send the line "unsubscribe linux-i2c"
> in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-01-22 13:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-19 15:13 i2c-tools: add compatibility for python2/3 to py-smbus Angelo Compagnucci
[not found] ` <CA+TH9VkT1K2aqAuNOLsGiU407OA4NYcMVaUakEQgSWLpMBBg2A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-01-19 22:03 ` Jean Delvare
[not found] ` <20150119230327.0224d0ba-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2015-01-22 8:56 ` Michael Mercier
[not found] ` <1421917018.21840.0-YAXBhf1W29QAs8EywTwl9A@public.gmane.org>
2015-01-22 10:25 ` Jean Delvare
2015-01-22 10:49 ` Jean Delvare
[not found] ` <20150122114958.3178f5f6-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2015-01-22 13:28 ` Michael Mercier [this message]
[not found] ` <1421933290.21840.1-YAXBhf1W29QAs8EywTwl9A@public.gmane.org>
2015-01-22 13:37 ` Jean Delvare
2015-01-26 11:46 ` Jean Delvare
[not found] ` <20150126124615.7fd1f64f-R0o5gVi9kd7kN2dkZ6Wm7A@public.gmane.org>
2015-04-09 20:32 ` Angelo Compagnucci
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1421933290.21840.1@smtp.inria.fr \
--to=michael.mercier-mzpvjpyxg2s@public.gmane.org \
--cc=angelo.compagnucci-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=bernhard.renz-//tT4aWmXyZBDgjK7y7TUQ@public.gmane.org \
--cc=jdelvare-l3A5Bk7waGM@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).