Patchwork [05/16] gnu: Add python-testpath.

login
register
mail settings
Submitter Ricardo Wurmus
Date Nov. 1, 2016, 12:20 p.m.
Message ID <20161101122046.751-6-ricardo.wurmus@mdc-berlin.de>
Download mbox | patch
Permalink /patch/17064/
State New
Headers show

Comments

Ricardo Wurmus - Nov. 1, 2016, 12:20 p.m.
* gnu/packages/python.scm (python-testpath, python2-testpath): New
variables.
---
 gnu/packages/python.scm | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
Roel Janssen - Nov. 1, 2016, 1:36 p.m.
Ricardo Wurmus writes:

> * gnu/packages/python.scm (python-testpath, python2-testpath): New
> variables.
> ---
>  gnu/packages/python.scm | 42 ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 42 insertions(+)
>
> diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
> index 9785b5e..e6f537e 100644
> --- a/gnu/packages/python.scm
> +++ b/gnu/packages/python.scm
> @@ -4583,6 +4583,48 @@ installing kernelspecs for use with Jupyter frontends.")
>  (define-public python2-ipykernel
>    (package-with-python2 python-ipykernel))
>  
> +

I don't think two blank lines are needed here.

> +(define-public python-testpath
> +  (package
> +    (name "python-testpath")
> +    (version "0.2")
> +    (source
> +     (origin
> +       (method url-fetch)
> +       (uri (string-append "https://github.com/jupyter/testpath/archive/"
> +                           version ".tar.gz"))
> +       (file-name (string-append name "-" version ".tar.gz"))
> +       (sha256
> +        (base32
> +         "04kh3fgvmqz6cfcw79q70qwjz7ib7lxm27cc548iy2rpr33qqf55"))))
> +    (build-system python-build-system)
> +    (arguments
> +     `(#:tests? #f ; this package does not even have a setup.py
> +       #:phases
> +       (modify-phases %standard-phases
> +         (delete 'install)
> +         (replace 'build
> +                  (lambda* (#:key inputs outputs #:allow-other-keys)
> +                    (let ((dir (string-append
> +                                (assoc-ref outputs "out")
> +                                "/lib/python"
> +                                (string-take (string-take-right
> +                                              (assoc-ref inputs "python") 5) 3)
> +                                "/site-packages/testpath")))
> +                      (mkdir-p dir)
> +                      (copy-recursively "testpath" dir))
> +                    #t)))))
> +    (home-page "https://github.com/takluyver/testpath")
> +    (synopsis "Test utilities for code working with files and commands")
> +    (description
> +     "Testpath is a collection of utilities for Python code working with files
> +and commands.  It contains functions to check things on the filesystem, and
> +tools for mocking system commands and recording calls to those.")
> +    (license license:expat)))
> +
> +(define-public python2-testpath
> +  (package-with-python2 python-testpath))
> +
>  (define-public python-ipython
>    (package
>      (name "python-ipython")

Otherwise LGTM.

Kind regards,
Roel Janssen
Hartmut Goebel - Nov. 2, 2016, 8:23 a.m.
Am 01.11.2016 um 13:20 schrieb Ricardo Wurmus:
> +                                (assoc-ref outputs "out")
> +                                "/lib/python"
> +                                (string-take (string-take-right
> +                                              (assoc-ref inputs "python") 5) 3)
> +                                "/site-packages/testpath")))

python-build-system contains a function "python-version", which would
give cleaner code here. Unfortunatly this function is private. But the
new python build system exports a function "site-packages" which does
exactly this.
Ricardo Wurmus - Nov. 4, 2016, 10:25 a.m.
Roel Janssen <roel@gnu.org> writes:

> Ricardo Wurmus writes:
>
>> * gnu/packages/python.scm (python-testpath, python2-testpath): New
>> variables.
>> ---
>>  gnu/packages/python.scm | 42 ++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 42 insertions(+)
>>
>> diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
>> index 9785b5e..e6f537e 100644
>> --- a/gnu/packages/python.scm
>> +++ b/gnu/packages/python.scm
>> @@ -4583,6 +4583,48 @@ installing kernelspecs for use with Jupyter frontends.")
>>  (define-public python2-ipykernel
>>    (package-with-python2 python-ipykernel))
>>  
>> +
>
> I don't think two blank lines are needed here.

You’re right!  That’s a rebase error.  Due to the number of dependency
cycles I had the packages in a different order before.

~~ Ricardo
Ricardo Wurmus - Nov. 4, 2016, 10:25 a.m.
Hartmut Goebel <h.goebel@crazy-compilers.com> writes:

> Am 01.11.2016 um 13:20 schrieb Ricardo Wurmus:
>> +                                (assoc-ref outputs "out")
>> +                                "/lib/python"
>> +                                (string-take (string-take-right
>> +                                              (assoc-ref inputs "python") 5) 3)
>> +                                "/site-packages/testpath")))
>
> python-build-system contains a function "python-version", which would
> give cleaner code here. Unfortunatly this function is private. But the
> new python build system exports a function "site-packages" which does
> exactly this.

That’s good to know!  I’m looking forward to updating the packages that
currently contain snippets like the above.

~~ Ricardo

Patch

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 9785b5e..e6f537e 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -4583,6 +4583,48 @@  installing kernelspecs for use with Jupyter frontends.")
 (define-public python2-ipykernel
   (package-with-python2 python-ipykernel))
 
+
+(define-public python-testpath
+  (package
+    (name "python-testpath")
+    (version "0.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://github.com/jupyter/testpath/archive/"
+                           version ".tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32
+         "04kh3fgvmqz6cfcw79q70qwjz7ib7lxm27cc548iy2rpr33qqf55"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:tests? #f ; this package does not even have a setup.py
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'install)
+         (replace 'build
+                  (lambda* (#:key inputs outputs #:allow-other-keys)
+                    (let ((dir (string-append
+                                (assoc-ref outputs "out")
+                                "/lib/python"
+                                (string-take (string-take-right
+                                              (assoc-ref inputs "python") 5) 3)
+                                "/site-packages/testpath")))
+                      (mkdir-p dir)
+                      (copy-recursively "testpath" dir))
+                    #t)))))
+    (home-page "https://github.com/takluyver/testpath")
+    (synopsis "Test utilities for code working with files and commands")
+    (description
+     "Testpath is a collection of utilities for Python code working with files
+and commands.  It contains functions to check things on the filesystem, and
+tools for mocking system commands and recording calls to those.")
+    (license license:expat)))
+
+(define-public python2-testpath
+  (package-with-python2 python-testpath))
+
 (define-public python-ipython
   (package
     (name "python-ipython")