From: Philip Kaludercic <philipk@posteo.net>
To: "Bozhidar Batsov" <bozhidar@batsov.dev>
Cc: Emacs Devel <emacs-devel@gnu.org>
Subject: Re: Obtaining the version of an installed package
Date: Mon, 09 Aug 2021 15:35:32 +0000 [thread overview]
Message-ID: <87fsviiqbf.fsf@posteo.net> (raw)
In-Reply-To: <0b71ad0a-8e9e-41ff-99a2-616b9e3bacef@www.fastmail.com> (Bozhidar Batsov's message of "Mon, 09 Aug 2021 17:03:21 +0300")
"Bozhidar Batsov" <bozhidar@batsov.dev> writes:
> 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)`.
Extracting the code from package-get-version, I would get something
like
(require 'find-func)
(require 'lisp-mnt)
(defun get-library-version (library)
"Return a version string for LIBRARY."
(with-temp-buffer
(insert-file-contents (find-library-name library))
(or (lm-header "package-version")
(lm-header "version"))))
and it seems to work
(get-library-version "auctex") ;=> "13.0.12"
> On Mon, Aug 9, 2021, at 3:58 PM, Stefan Monnier wrote:
>> > I'm wondering if there's an API for obtaining metadata about installed
>> > packages, in particular the version information.
>> > For years I was using this function from pkg-info
>> > https://github.com/emacsorphanage/pkg-info/blob/master/pkg-info.el#L65, but
>> > I'm wondering if it'd be easy to strip one dependency from my packages.
>>
>> Are you looking for `package-get-version`?
>>
>>
>> Stefan
>>
>>
>>
--
Philip Kaludercic
next prev parent reply other threads:[~2021-08-09 15:35 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 [this message]
2021-08-09 15:39 ` Stefan Monnier
2021-08-11 7:15 ` Bozhidar Batsov
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=87fsviiqbf.fsf@posteo.net \
--to=philipk@posteo.net \
--cc=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.