unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Version from file in a package
@ 2023-09-22 12:20 Reza Housseini
  2023-09-22 13:11 ` paul
  2023-09-23 12:22 ` Attila Lendvai
  0 siblings, 2 replies; 3+ messages in thread
From: Reza Housseini @ 2023-09-22 12:20 UTC (permalink / raw)
  To: guix-devel


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-09-23 12:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-22 12:20 Version from file in a package Reza Housseini
2023-09-22 13:11 ` paul
2023-09-23 12:22 ` Attila Lendvai

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