all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Bozhidar Batsov" <bozhidar@batsov.dev>
To: "Emacs Devel" <emacs-devel@gnu.org>
Subject: Re: Obtaining the version of an installed package
Date: Wed, 11 Aug 2021 10:15:36 +0300	[thread overview]
Message-ID: <62035d5e-5249-4952-b216-cb778ff7d28d@www.fastmail.com> (raw)
In-Reply-To: <jwvr1f2bpxy.fsf-monnier+emacs@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1732 bytes --]

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 <FOO>-pkg.el files) and
> then look inside its return value with `package-desc-<foo>`.

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
> 
> 
> 

[-- Attachment #2: Type: text/html, Size: 3993 bytes --]

  reply	other threads:[~2021-08-11  7:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-09  8:28 Obtaining the version of an installed package Bozhidar Batsov
2021-08-09 12:58 ` Stefan Monnier
2021-08-09 14:03   ` Bozhidar Batsov
2021-08-09 15:35     ` Philip Kaludercic
2021-08-09 15:39     ` Stefan Monnier
2021-08-11  7:15       ` Bozhidar Batsov [this message]
2021-08-11 13:28         ` Stefan Monnier

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=62035d5e-5249-4952-b216-cb778ff7d28d@www.fastmail.com \
    --to=bozhidar@batsov.dev \
    --cc=emacs-devel@gnu.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.