From 35ca4927e93abd4eb737c379494ef3547f3e85dc Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Fri, 25 Apr 2014 17:21:11 +0200 Subject: [PATCH] Get rid of some lib dependencies. The charset business isn't worth depending on an AGPL licenced lib which is part of a huge Quicklisp system. --- pgloader.asd | 3 ++- src/main.lisp | 13 +------------ src/package.lisp | 6 ++++-- src/parser.lisp | 16 ++++++++-------- 4 files changed, 15 insertions(+), 23 deletions(-) diff --git a/pgloader.asd b/pgloader.asd index ac0d76a..a045dff 100644 --- a/pgloader.asd +++ b/pgloader.asd @@ -20,7 +20,6 @@ #:drakma ; http client, download archives #:zip ; support for zip archive files #:flexi-streams ; streams - #:com.informatimago.clext ; portable character-sets listings #:usocket ; UDP / syslog #:local-time ; UDP date parsing #:command-line-arguments ; for the main function @@ -44,8 +43,10 @@ "package" "logs")) + (:file "charsets":depends-on ("package")) (:file "utils" :depends-on ("params" "package" + "charsets" "monitor")) ;; those are one-package-per-file diff --git a/src/main.lisp b/src/main.lisp index a81891e..8dcb1a0 100644 --- a/src/main.lisp +++ b/src/main.lisp @@ -1,16 +1,5 @@ (in-package #:pgloader) -(defun list-encodings () - "List known encodings names and aliases from charsets::*lisp-encodings*." - (format *standard-output* "Name ~30TAliases~%") - (format *standard-output* "--------~30T--------------~%") - (loop - with encodings = (sort (copy-tree charsets::*lisp-encodings*) #'string< - :key #'car) - for (name . aliases) in encodings - do (format *standard-output* "~a~30T~{~a~^, ~}~%" name aliases)) - (terpri)) - (defun log-threshold (min-message &key quiet verbose debug) "Return the internal value to use given the script parameters." (cond ((and debug verbose) :data) @@ -135,7 +124,7 @@ (when (or help version) (uiop:quit)) (when list-encodings - (list-encodings) + (show-encodings) (uiop:quit)) (when upgrade-config diff --git a/src/package.lisp b/src/package.lisp index 770b301..ce5a941 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -55,7 +55,10 @@ #:with-stats-collection #:slurp-file-into-string #:camelCase-to-colname - #:make-kernel)) + #:make-kernel + #:list-encodings-and-aliases + #:show-encodings + #:make-external-format)) ;;; @@ -322,6 +325,5 @@ (lparallel.queue lq) (simple-date date) (split-sequence sq) - (com.informatimago.clext.character-sets charsets) (py-configparser ini)) do (rename-package package package nicknames)) diff --git a/src/parser.lisp b/src/parser.lisp index dadf284..d672854 100644 --- a/src/parser.lisp +++ b/src/parser.lisp @@ -1504,17 +1504,17 @@ load database ;; (defun find-encoding-by-name-or-alias (encoding) "charsets::*lisp-encodings* is an a-list of (NAME . ALIASES)..." - (loop for (name . aliases) in charsets::*lisp-encodings* - for encoding-name = (when (or (string-equal name encoding) - (member encoding aliases :test #'string-equal)) - name) - until encoding-name - finally (if encoding-name (return encoding-name) - (error "The encoding '~a' is unknown" encoding)))) + (loop :for (name . aliases) :in (list-encodings-and-aliases) + :for encoding-name := (when (or (string-equal name encoding) + (member encoding aliases :test #'string-equal)) + name) + :until encoding-name + :finally (if encoding-name (return encoding-name) + (error "The encoding '~a' is unknown" encoding)))) (defrule encoding (or namestring single-quoted-string) (:lambda (encoding) - (charsets:make-external-format (find-encoding-by-name-or-alias encoding)))) + (make-external-format (find-encoding-by-name-or-alias encoding)))) (defrule file-encoding (? (and kw-with kw-encoding encoding)) (:lambda (enc)