unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Reza Housseini <reza.housseini@gmail.com>
To: guix-devel@gnu.org
Subject: Version from file in a package
Date: Fri, 22 Sep 2023 14:20:27 +0200	[thread overview]
Message-ID: <1d2a4522-3844-403b-1c09-aeb423bf4d28@gmail.com> (raw)


[-- Attachment #1.1.1: Type: text/plain, Size: 1308 bytes --]

Hi List

Following the excellent blog post from Ludo [1] to guixify my python 
project, I wanted to include a version string from file to have a single 
source for the guix files and also for the python pyproject.toml file.
Something along this:

(define-public my-package
   (let* ((vcs-file? (or (git-predicate %source-dir) (const #t)))
	 (version-file "VERSION")
	 (version-from-file (call-with-input-file version-file get-string-all)))
     (package
       (name "my-package")
       (version version-from-file)
       (source (local-file "../.." "my-package-checkout"
                           #:recursive? #t
                           #:select? vcs-file?))
       (build-system pyproject-build-system)
       ...

this seems to work when I build locally but throws an error when I build 
after a guix pull:

(exception system-error (value "open-file") (value "~A: ~S") (value ("No 
such file or directory" "VERSION")) (value (2)))

How can I achieve this?

Thanks for your input!

Best,
Reza

[1] 
https://guix.gnu.org/en/blog/2023/from-development-environments-to-continuous-integrationthe-ultimate-guide-to-software-development-with-guix/
-- 
Reza Housseini

This message is signed with my GnuPG key:

     C0F3 0812 9AF2 80F4 0830 C2C1 C375 C6AF 0512 5C52

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 15557 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

             reply	other threads:[~2023-09-22 12:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-22 12:20 Reza Housseini [this message]
2023-09-22 13:11 ` Version from file in a package paul
2023-09-23 12:22 ` Attila Lendvai

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

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1d2a4522-3844-403b-1c09-aeb423bf4d28@gmail.com \
    --to=reza.housseini@gmail.com \
    --cc=guix-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 public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).