From: Maxime Devos <maximedevos@telenet.be>
To: Justin Veilleux <terramorpha@cock.li>, guix-devel@gnu.org
Subject: Re: Getting the name of file-like objects
Date: Sat, 02 Apr 2022 10:32:20 +0200 [thread overview]
Message-ID: <f9eef0e8b29f9b5cb44755fc4d5c530fa4c7d95e.camel@telenet.be> (raw)
In-Reply-To: <e581a026-dad8-3a04-dde0-9b2e35a3042f@cock.li>
[-- Attachment #1: Type: text/plain, Size: 1031 bytes --]
Justin Veilleux schreef op vr 01-04-2022 om 16:29 [-0400]:
> (define (unzip f)
> (computed-file (string-append (name f) "-unzipped")
> #~(begin
> (system* (string-append #$unzip "/bin/unzip")
(unrelated) you can do #+(file-append unzip "/bin/unzip") here. The
'file-append' is not very important here, but the #+ is. The
difference between #+ (cf. 'native-inputs) and #$ (cf. 'inputs') is
important when cross-compiling.
Also, I would use 'invoke' instead of 'system*' here -- 'invoke' throws
an exception if it fails (making the derivation fail to build), whereas
'system*' silently returns an integer.
> "-d" #$output
> #$file))
> #$out))
> ```
>
> Is there someting which ressembles the imaginary `name` function
> I used above?
computed-file-name, local-file-name, package-name ... I don't think
there's some generic procedure for this.
Greetings,
Maxime.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
next prev parent reply other threads:[~2022-04-02 8:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-01 20:29 Getting the name of file-like objects Justin Veilleux
2022-04-02 8:32 ` Maxime Devos [this message]
2022-04-05 12:26 ` Ludovic Courtès
2022-04-02 20:03 ` Liliana Marie Prikler
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=f9eef0e8b29f9b5cb44755fc4d5c530fa4c7d95e.camel@telenet.be \
--to=maximedevos@telenet.be \
--cc=guix-devel@gnu.org \
--cc=terramorpha@cock.li \
/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).