From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH 4/5] import: pypi: Compute test requirements when reading requirements files. Date: Mon, 25 Jul 2016 23:12:56 +0200 Message-ID: <87r3ahfmlj.fsf@gnu.org> References: <1468682605-12622-1-git-send-email-tipecaml@gmail.com> <1468682605-12622-5-git-send-email-tipecaml@gmail.com> <87d1m5pdhe.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRnBQ-0007Fb-PU for guix-devel@gnu.org; Mon, 25 Jul 2016 17:13:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bRnBM-00041J-9j for guix-devel@gnu.org; Mon, 25 Jul 2016 17:13:03 -0400 In-Reply-To: (Cyril Roelandt's message of "Sat, 23 Jul 2016 16:48:40 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Cyril Roelandt Cc: guix-devel@gnu.org Cyril Roelandt skribis: > On 07/22/2016 11:30 PM, Ludovic Court=C3=A8s wrote: >> This seems to suggest that this could be factorized somehow. Maybe >> unpack once and read the two files at once? > > The problem is that both files might not be there, and unzip will return > a non-zero exit code if any of them is missing, so it seems easier to > just run unzip twice. WDYT? OK, I see. Then what about adding a procedure like: (define (file-from-zip-archive archive file) "Return the contents of FILE from ARCHIVE as a string, or #f if FILE could not be found in ARCHIVE or extraction failed." ;; =E2=80=A6 invoke unzip in temporary dir, check return code, then: (call-with-input-file (string-append tempdir "/" file) get-string-all)) That would move the bits about exit codes and all that out of the main logic. WDYT? Thanks, Ludo=E2=80=99.