guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Version from file in a package


From: Reza Housseini
Subject: Version from file in a package
Date: Fri, 22 Sep 2023 14:20:27 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0

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: OpenPGP_0xC375C6AF05125C52.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]