From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "Bozhidar Batsov" Newsgroups: gmane.emacs.devel Subject: Re: Obtaining the version of an installed package Date: Wed, 11 Aug 2021 10:15:36 +0300 Message-ID: <62035d5e-5249-4952-b216-cb778ff7d28d@www.fastmail.com> References: <0b71ad0a-8e9e-41ff-99a2-616b9e3bacef@www.fastmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=c95684ae2b304e35b9b43aa48dbd412e Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32749"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Cyrus-JMAP/3.5.0-alpha0-554-g53a5f93b7d-fm-20210809.002-g53a5f93b To: "Emacs Devel" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Aug 11 09:17:20 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mDiUG-00088J-Hv for ged-emacs-devel@m.gmane-mx.org; Wed, 11 Aug 2021 09:17:18 +0200 Original-Received: from localhost ([::1]:60848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mDiUF-0005i5-D1 for ged-emacs-devel@m.gmane-mx.org; Wed, 11 Aug 2021 03:17:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46508) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mDiT3-0004w3-HS for emacs-devel@gnu.org; Wed, 11 Aug 2021 03:16:01 -0400 Original-Received: from new2-smtp.messagingengine.com ([66.111.4.224]:45209) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mDiT1-0002m1-18 for emacs-devel@gnu.org; Wed, 11 Aug 2021 03:16:01 -0400 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id E1D50580A42 for ; Wed, 11 Aug 2021 03:15:57 -0400 (EDT) Original-Received: from imap43 ([10.202.2.93]) by compute4.internal (MEProxy); Wed, 11 Aug 2021 03:15:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=batsov.dev; h= mime-version:message-id:in-reply-to:references:date:from:to :subject:content-type; s=fm1; bh=KtQShsDBhifyk4HMGtchyVRIOivQ2rq k2lmY2mmRqm8=; b=bL2mzJVPLKNdvui9Z71jEV/Dl2BZOLhmlGoNyCjoLHbx+oN 7XurNWjNgrINvCM/WnlP89S6rbQYrNPjDivDZKRB95OepEgUK6mG/n6BpdMvBThD SRQbwbv8qHG2qJjEmiBQTMpYwKgIGZuqYAAsb+ufd1PDMm6tCL/XoiUvZPnXpkju uXxMX5u3vl8i5n6ddXJyuCrMLDrCS6jzbmYP6lGl1OG5vyRKqIKntEs1cGnTT9OX EYa1zVREHsilk4kTEk0wTNuqWZ0lwAfDimkNjA+gB8ohKbIUXba9I11oC9Cdcge+ cAod9BVKHTA4HnuJNRfPjlKNMpnJFITY94QrFzg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=KtQShs DBhifyk4HMGtchyVRIOivQ2rqk2lmY2mmRqm8=; b=NAxAztI59FU/eoAC9qpesV gs+vK9E8lZ53/UAlBtOSwRjRnBC3QG2PROxDn1IItZAgXb3sNf76f9EOIdp8BooJ NFIX7R7d6satCeOf0KwbkqedWZsjcxIMHSlHUQRFMwcnlPrVspakxSd6AAnwzcHg gzud3oUb26OnOsDUJnerxVLOmd3HqBpIKxYS48JVPfa7KQVnTj4cSyfkalN6Hbni f3OJ0CV7MVekzhb0Y7VM+fYaKiR85QML0M9nJt1KiILMqHd6eHJIeuWrvIpOtUZq QsgJ5KTRqnAKl4WiX3UfN/QOX4wNjKF/emwFrEFFiQTMLpwE8oCTc+f/TSmmcpKQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrkedtgdduudehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesrgdtreerreertdenucfhrhhomhepfdeuohii hhhiuggrrhcuuegrthhsohhvfdcuoegsohiihhhiuggrrhessggrthhsohhvrdguvghvqe enucggtffrrghtthgvrhhnpeegvdetfeekkeetieelffdtkedutdfhffefgedtvefhteef veejhffgtdekjeeiueenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrih hlfhhrohhmpegsohiihhhiuggrrhessggrthhsohhvrdguvghv X-ME-Proxy: Original-Received: by mailuser.nyi.internal (Postfix, from userid 501) id 35A23AC0DD0; Wed, 11 Aug 2021 03:15:57 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface In-Reply-To: Received-SPF: pass client-ip=66.111.4.224; envelope-from=bozhidar@batsov.dev; helo=new2-smtp.messagingengine.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.1 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_FMBLA_NEWDOM28=0.798, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:272316 Archived-At: --c95684ae2b304e35b9b43aa48dbd412e Content-Type: text/plain On Mon, Aug 9, 2021, at 6:39 PM, Stefan Monnier wrote: > Bozhidar Batsov [2021-08-09 17:03:21] wrote: > > I guess that could work, although from what I gathered it operates only on > > the current package. I was hoping to find something like an API like > > `(package-get-version 'package-name)`. > > Ah, no, we don't have such an abstraction. > > Currently, you'd have to use the `package--alist` function (whose first > call will take a bit of time to real all the -pkg.el files) and > then look inside its return value with `package-desc-`. Got it, thanks! > > [ That's assuming you're interested in the packages currently installed. > If you're interested in the packages currently activated, then you > have that list in `package-activated-list` but that fails to record > which version has been activated :-( ] > > Patches welcome to add more friendly accessors. Will keep this in mind! > > I'm also curious to know the specific context in which you need that > info. Is it to test at runtime whether some dependency includes > a particular bugfix/feature ? Yeah, something like this. Probably an overkill and it's not something I really need right now. What I mostly needed was to extract the installed version of a snapshot package for debug purposes (useful for packages on MELPA to understand how old is the snapshot someone installed there). E.g. I print this in CIDER's REPL: `;; CIDER 1.2.0snapshot (package: 20210729.521)` In this case the "real" version 1.2.0-snapshot, but there's also the MELPA package version, that's basically the date the package was built. The function you mentioned might help with this, probably in combination with lm-version. > > > Stefan > > > --c95684ae2b304e35b9b43aa48dbd412e Content-Type: text/html Content-Transfer-Encoding: quoted-printable
On Mon, Aug 9, = 2021, at 6:39 PM, Stefan Monnier wrote:
Bozhidar Batsov [2021-08-09 17:03:21] wrote= :
> I guess that could work, although from what I gathe= red it operates only on
> the current package. I was ho= ping to find something like an API like
> `(package-get= -version 'package-name)`.

Ah, no, we don't = have such an abstraction.

Currently, you'd = have to use the `package--alist` function (whose first
cal= l will take a bit of time to real all the <FOO>-pkg.el files) and<= br>
then look inside its return value with `package-desc-<f= oo>`.

Got it, thanks!
=


<= /div>
[ That's assuming you're interested in the packages currently = installed.
  If you're interested in the packages cur= rently activated, then you
  have that list in `packa= ge-activated-list` but that fails to record
  which v= ersion has been activated :-(  ]

Patch= es welcome to add more friendly accessors.
Will keep this in mind!


I'm also curious to = know the specific context in which you need that
info.&nbs= p; Is it to test at runtime whether some dependency includes
a particular bugfix/feature ?

Yeah, something like this. Probably an overkill and it's not somethin= g I really need right now.
What I mostly needed was to ext= ract the installed version of a snapshot package for debug purposes (use= ful for packages on MELPA to understand how old is the snapshot someone = installed there). E.g. I print this in CIDER's REPL:

<= /div>
;; CIDER 1.2.0sna= pshot (package: 20210729.521)

In thi= s case the "real" version 1.2.0-snapshot, but there's also the MELPA pac= kage version, that's basically the date the package was built.
The function you mentioned might help with this, probably in combinatio= n with lm-version. 



  &= nbsp;     Stefan




--c95684ae2b304e35b9b43aa48dbd412e--