[01/12] import: Move json-fetch to (guix import utils).
Commit Message
* guix/import/utils.scm (json-fetch): Move json-fetch from
(guix import json).
---
guix/import/cpan.scm | 1 -
guix/import/gem.scm | 1 -
guix/import/json.scm | 32 --------------------------------
guix/import/pypi.scm | 1 -
guix/import/utils.scm | 12 ++++++++++++
5 files changed, 12 insertions(+), 35 deletions(-)
delete mode 100644 guix/import/json.scm
Comments
On 2016-09-22 08:18, David Craven wrote:
> * guix/import/utils.scm (json-fetch): Move json-fetch from
> (guix import json).
> ---
> guix/import/cpan.scm | 1 -
> guix/import/gem.scm | 1 -
> guix/import/json.scm | 32 --------------------------------
> guix/import/pypi.scm | 1 -
> guix/import/utils.scm | 12 ++++++++++++
> 5 files changed, 12 insertions(+), 35 deletions(-)
> delete mode 100644 guix/import/json.scm
We can't do this, since guile-json is an optional dependency for Guix.
See the manual and makefiles.
`~Eric
> guile-json is an optional dependency for Guix. See
> the manual and makefiles.
I see, didn't know.
> We can't do this
I'm not sure that this is correct.
From the manual:
> Installing Guile-JSON will allow you to use the guix
> import pypi command (see Section 6.5 [Invoking guix
> import], page 75). It is of interest primarily for
> developers and not for casual users.
CPAN, GEM and CARGO importers also use guile-json. If
a developer is using importers I think he can install guile-json
since most importers use it. (guix import utils) is only used
by importers, so people that don't want to use importers
can continue without using guile-json. To put it in perspective
guile-json is 100KB (guix size only displays MB).
On 2016-09-22 10:23, David Craven wrote:
>> guile-json is an optional dependency for Guix. See
>> the manual and makefiles.
>
> I see, didn't know.
>
>> We can't do this
>
> I'm not sure that this is correct.
>
> From the manual:
>> Installing Guile-JSON will allow you to use the guix
>> import pypi command (see Section 6.5 [Invoking guix
>> import], page 75). It is of interest primarily for
>> developers and not for casual users.
>
> CPAN, GEM and CARGO importers also use guile-json. If
> a developer is using importers I think he can install guile-json
> since most importers use it. (guix import utils) is only used
> by importers, so people that don't want to use importers
> can continue without using guile-json. To put it in perspective
> guile-json is 100KB (guix size only displays MB).
Overall the patch seems like a net loss. If guile-json is an optional
dependency for Guix and there are importers that don't need it (cran,
hackage, elpa, nix, gnu), then we shouldn't make importers completely
inaccessible for those who want to use Guix without guile-json so that
we can gain what?
Just didn't see the point of having a file json.scm file there and
found the name to be a little misleading, but ok.
David Craven <david@craven.ch> skribis:
> Just didn't see the point of having a file json.scm file there and
> found the name to be a little misleading, but ok.
Yeah, what Eric describes is the reason. And then (guix scripts
refresh) has this ‘maybe-updater’ macro that checks whether a given
import depends on a missing optional dependency.
Given that JSON is used a lot, we might eventually make Guile-JSON a
mandatory dependency. We could also push David Thompson to update the
(ice-9 json) module and have it in Guile proper. :-)
Ludo’.
@@ -31,7 +31,6 @@
#:use-module (guix base32)
#:use-module ((guix download) #:select (download-to-store))
#:use-module (guix import utils)
- #:use-module (guix import json)
#:use-module (guix packages)
#:use-module (guix derivations)
#:use-module (gnu packages perl)
@@ -26,7 +26,6 @@
#:use-module (web uri)
#:use-module ((guix download) #:prefix download:)
#:use-module (guix import utils)
- #:use-module (guix import json)
#:use-module (guix packages)
#:use-module (guix upstream)
#:use-module (guix licenses)
deleted file mode 100644
@@ -1,32 +0,0 @@
-;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014 David Thompson <davet@gnu.org>
-;;; Copyright © 2015 Eric Bavier <bavier@member.fsf.org>
-;;;
-;;; This file is part of GNU Guix.
-;;;
-;;; GNU Guix is free software; you can redistribute it and/or modify it
-;;; under the terms of the GNU General Public License as published by
-;;; the Free Software Foundation; either version 3 of the License, or (at
-;;; your option) any later version.
-;;;
-;;; GNU Guix is distributed in the hope that it will be useful, but
-;;; WITHOUT ANY WARRANTY; without even the implied warranty of
-;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;;; GNU General Public License for more details.
-;;;
-;;; You should have received a copy of the GNU General Public License
-;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
-
-(define-module (guix import json)
- #:use-module (json)
- #:use-module (guix utils)
- #:use-module (guix import utils)
- #:export (json-fetch))
-
-(define (json-fetch url)
- "Return an alist representation of the JSON resource URL, or #f on failure."
- (call-with-temporary-output-file
- (lambda (temp port)
- (and (url-fetch url temp)
- (hash-table->alist
- (call-with-input-file temp json->scm))))))
@@ -38,7 +38,6 @@
. hyphen-package-name->name+version)))
#:use-module (guix import utils)
#:use-module ((guix download) #:prefix download:)
- #:use-module (guix import json)
#:use-module (guix packages)
#:use-module (guix upstream)
#:use-module (guix licenses)
@@ -1,5 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014 David Thompson <davet@gnu.org>
+;;; Copyright © 2015 Eric Bavier <bavier@member.fsf.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -25,6 +27,7 @@
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix utils)
#:use-module ((guix build download) #:prefix build:)
+ #:use-module (json)
#:export (factorize-uri
hash-table->alist
@@ -32,6 +35,7 @@
assoc-ref*
url-fetch
+ json-fetch
guix-hash-url
string->license
@@ -148,3 +152,11 @@ into a proper sentence and by using two spaces between sentences."
;; Use double spacing between sentences
(regexp-substitute/global #f "\\. \\b"
cleaned 'pre ". " 'post)))
+
+(define (json-fetch url)
+ "Return an alist representation of the JSON resource URL, or #f on failure."
+ (call-with-temporary-output-file
+ (lambda (temp port)
+ (and (url-fetch url temp)
+ (hash-table->alist
+ (call-with-input-file temp json->scm))))))