Subject: Re: [bug#29137] [PATCH] gnu: Add python-clf.

From: Oleg Pykhalov <[email-masked]>
Date: Fri, 17 Nov 2017 20:09:30 +0300

Hello Marius,

Apologies for the late reply and thank you for review!

Marius Bakke <[email-masked]> writes:

> Oleg Pykhalov <[email-masked]> writes:
>
>> * gnu/packages/web.scm (python-clf): New variable.
>
> [...]
>
>> +(define-public python-clf
>> +  (package
>> +    (name "python-clf")
>> +    (version "0.5.7")
>> +    (source
>> +     (origin
>> +       (method url-fetch)
>> +       (uri (pypi-uri "clf" version))
>> +       (sha256
>> +        (base32
>> +         "0zlkzqnpz7a4iavsq5vaz0nf5nr7qm5znpg1vlpz6rwnx6hikjdb"))))
>> +    (build-system python-build-system)
>> +    (propagated-inputs
>> +     `(("python-docopt" ,python-docopt)
>> +       ("python-pygments" ,python-pygments)
>> +       ("python-requests" ,python-requests)))
>> +    (home-page "https://github.com/ncrocfer/clf")
>
> I noticed in the '.travis.yml' that it has a test suite that can be run
> with 'nosetests'.  Can you try overriding the check phase with one that
> runs it?  That way we are likely to catch regressions early.

Release tarball from pypi doesn't include test_clf.py.  So I pulled it
from git master branch.  Almost all tests require internet connection.

From d347266c2ceac106b13e114520c80ea6acf7d1b9 Mon Sep 17 00:00:00 2001
From: Oleg Pykhalov <[email-masked]>
Date: Fri, 3 Nov 2017 18:39:17 +0300
Subject: [PATCH] gnu: Add python-clf.

* gnu/packages/web.scm (python-clf): New variable.
---
 gnu/packages/web.scm | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index a78f5b6f0..98708f335 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -5203,6 +5203,58 @@ internetarchive python module for programatic access to archive.org.")
   (package-with-python2
    (strip-python2-variant python-internetarchive)))
 
+(define-public python-clf
+  (let ((commit-test-clf "d01d25923c599d3261910f79fb948825b4270d07")) ; 0.5.7
+    (package
+      (name "python-clf")
+      (version "0.5.7")
+      (source
+       (origin
+         (method url-fetch)
+         (uri (pypi-uri "clf" version))
+         (sha256
+          (base32
+           "0zlkzqnpz7a4iavsq5vaz0nf5nr7qm5znpg1vlpz6rwnx6hikjdb"))))
+      (build-system python-build-system)
+      (propagated-inputs
+       `(("python-docopt" ,python-docopt)
+         ("python-pygments" ,python-pygments)
+         ("python-requests" ,python-requests)
+         ("python-nose" ,python-nose)
+         ("python-lxml" ,python-lxml)
+         ("python-pyaml" ,python-pyaml)))
+      (inputs
+       `(("test-clf"
+          ,(origin
+             (method url-fetch)
+             (uri (string-append "https://raw.githubusercontent.com"
+                                 "/ncrocfer/clf/" commit-test-clf
+                                 "/test_clf.py"))
+             (sha256
+              (base32
+               "19lr5zdzsmxgkg7wrjq1yzkiahd03wi4k3dskssyhmjls8c10nqd"))))))
+      (arguments
+       '(#:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'get-tests
+             (lambda _
+               (copy-file (assoc-ref %build-inputs "test-clf") "test_clf.py")))
+           (replace 'check
+             (lambda _
+               (zero? (system* "nosetests"
+                               ;; These tests require internet connection
+                               "--exclude=test_browse"
+                               "--exclude=test_command"
+                               "--exclude=test_search")))))))
+      (home-page "https://github.com/ncrocfer/clf")
+      (synopsis "Search code snippets on @url{commandlinefu.com}")
+      (description "@code{clf} is a command line tool for searching code
+snippets on @url{https://commandlinefu.com}")
+      (license l:expat))))
+
+(define-public python2-clf
+  (package-with-python2 python-clf))
+
 (define-public r-shiny
   (package
     (name "r-shiny")
-- 
2.15.0

>> +    (synopsis "Search code snippets on @url{commandlinefu.com}")
>> +    (description "@code{clf} is a command line tool for searching code
>> +snippets on @url{commandlinefu.com}")
>
> Note: descriptions should end with a punctuation.

Ouch, "guix lint" didn't spot this.

> I think I'd also add http:// to the @url{}s here for clarity.

Sure, added "https://".

Oleg.