linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: "Bartosz Golaszewski" <brgl@bgdev.pl>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Vincent Guittot" <vincent.guittot@linaro.org>,
	linux-gpio@vger.kernel.org,
	"Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>,
	"Wedson Almeida Filho" <wedsonaf@gmail.com>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	stratos-dev@op-lists.linaro.org,
	"Gerard Ryan" <g.m0n3y.2503@gmail.com>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	y86-dev <y86-dev@protonmail.com>
Subject: Re: [libgpiod][PATCH V10 2/6] bindings: rust: Add libgpiod crate
Date: Tue, 22 Nov 2022 13:09:20 +0800	[thread overview]
Message-ID: <Y3xZgDch57EyTr9x@sol> (raw)
In-Reply-To: <20221122043831.hemnrbyily25rhhk@vireshk-i7>

On Tue, Nov 22, 2022 at 10:08:31AM +0530, Viresh Kumar wrote:
> On 21-11-22, 15:12, Bartosz Golaszewski wrote:
> > This is not a blocker, I will apply this series to master later and we
> > can add modifications on top of that, but I am now questioning the
> > need for this function here and also the value of __version__ in
> > Python bindings.
> > 
> > Previously the python bindings were built with autotools as part of
> > the whole library. In v2 python now has a proper setup.py script and I
> > intend to publish the bindings on pypi. It can now be built separately
> > from the rest of the libgpiod code as long as the system satisfies the
> > dependency for libgpiod. Example: I will split the yocto recipe for
> > libgpiod into one for the core lib + tools + C++ bindings and another
> > for python that will go to meta-python. The latter will depend on the
> > libgpiod package but will be built in a separate sysroot.
> > 
> > In that case keeping the libgpiod API version as the Python's package
> > __version__ (which made sense before when that code was closely
> > integrated with libgpiod core) is no longer necessary. I'm thinking
> > about setting __version__ to v2.0.0 (because we already had python
> > bindings with v1.x.y versioning out there) but decoupling it from
> > libgpiod's API version.
> > 
> > In your rust code all the crates already have their own versions that
> > don't follow libgpiod's API's version. I think we should drop this
> > function. What do you think?
> 
> whatever you and Kent decide is fine with me :)
> 

As previously mentioned, it makes sense to me for there to be functions
that return both the binding version and the libgpiod version you are
running against.  Separately, as the two are distinct.

So keeping the wrapper around the libgpiod version method for the
latter, and another function that returns the CARGO_PKG_VERSION for the
binding crate.

Then, if the user is interested, they can report them in their help,
version, log, startup banner or whatever works for them.

> > Also: is there a standardized way for crates to inspect their version?
> > As in: println!(crate.version()) or something?
> 
> I think that would be "version!()" [1].
> 

Which is a library that reads the envvars set by Cargo at compile time,
so you could also just

const VERSION: &'static str = env!("CARGO_PKG_VERSION");

and provide a function that returns that.

Cheers,
Kent.

  reply	other threads:[~2022-11-22  5:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-18 10:44 [libgpiod][PATCH V10 0/6] libgpiod: Add Rust bindings Viresh Kumar
2022-11-18 10:44 ` [libgpiod][PATCH V10 1/6] bindings: rust: Add libgpiod-sys rust crate Viresh Kumar
2022-11-18 10:44 ` [libgpiod][PATCH V10 2/6] bindings: rust: Add libgpiod crate Viresh Kumar
2022-11-21 14:12   ` Bartosz Golaszewski
2022-11-22  4:38     ` Viresh Kumar
2022-11-22  5:09       ` Kent Gibson [this message]
2022-11-22  5:15         ` Viresh Kumar
2022-11-22  5:30           ` Kent Gibson
2022-11-22  5:35             ` Viresh Kumar
2022-11-18 10:44 ` [libgpiod][PATCH V10 3/6] bindings: rust: Add gpiosim-sys crate Viresh Kumar
2022-11-18 10:44 ` [libgpiod][PATCH V10 4/6] bindings: rust: Add examples to libgpiod crate Viresh Kumar
2022-11-18 10:44 ` [libgpiod][PATCH V10 5/6] bindings: rust: Add tests for " Viresh Kumar
2022-11-18 10:44 ` [libgpiod][PATCH V10 6/6] bindings: rust: Integrate building of bindings with make Viresh Kumar
2022-11-21 13:46 ` [libgpiod][PATCH V10 0/6] libgpiod: Add Rust bindings Linus Walleij
2022-11-21 20:22   ` Bartosz Golaszewski
2022-11-22  4:27     ` Viresh Kumar

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=Y3xZgDch57EyTr9x@sol \
    --to=warthog618@gmail.com \
    --cc=alex.bennee@linaro.org \
    --cc=alex.gaynor@gmail.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=brgl@bgdev.pl \
    --cc=g.m0n3y.2503@gmail.com \
    --cc=gary@garyguo.net \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=stratos-dev@op-lists.linaro.org \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    --cc=wedsonaf@gmail.com \
    --cc=y86-dev@protonmail.com \
    /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).