Subject: [bug#36194] [PATCH 01/10 v2] gnu: Add python-slugify.

From: Pierre Langlois <[email-masked]>
Date: Fri, 21 Jun 2019 11:42:23 +0100

Pierre Langlois writes:

> * gnu/packages/python-web.scm (python-slugify): New variable.
> * gnu/packages/patches/python-slugify-depend-on-unidecode.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Add it.
> ---
>  gnu/local.mk                                  |  1 +
>  .../python-slugify-depend-on-unidecode.patch  | 22 +++++++++++++
>  gnu/packages/python-web.scm                   | 31 +++++++++++++++++++
>  3 files changed, 54 insertions(+)
>  create mode 100644 gnu/packages/patches/python-slugify-depend-on-unidecode.patch
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index c7b557ca61..f8c33dd8c2 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -1214,6 +1214,7 @@ dist_patch_DATA =						\
>    %D%/packages/patches/python2-pygobject-2-gi-info-type-error-domain.patch \
>    %D%/packages/patches/python-pygpgme-fix-pinentry-tests.patch	\
>    %D%/packages/patches/python-robotframework-honor-source-date-epoch.patch \
> +  %D%/packages/patches/python-slugify-depend-on-unidecode.patch	\
>    %D%/packages/patches/python2-subprocess32-disable-input-test.patch	\
>    %D%/packages/patches/python-unittest2-python3-compat.patch	\
>    %D%/packages/patches/python-unittest2-remove-argparse.patch	\
> diff --git a/gnu/packages/patches/python-slugify-depend-on-unidecode.patch b/gnu/packages/patches/python-slugify-depend-on-unidecode.patch
> new file mode 100644
> index 0000000000..93a3aaebe9
> --- /dev/null
> +++ b/gnu/packages/patches/python-slugify-depend-on-unidecode.patch
> @@ -0,0 +1,22 @@
> +diff --git a/setup.py b/setup.py
> +index 4800173..6bdd77f 100755
> +--- a/setup.py
> ++++ b/setup.py
> +@@ -14,8 +14,7 @@ url = 'https://github.com/un33k/python-slugify'
> + author = 'Val Neekman'
> + author_email = [email-masked]'
> + license = 'MIT'
> +-install_requires = ['text-unidecode==1.2']
> +-extras_require = {'unidecode': ['Unidecode==1.0.23']}
> ++install_requires = ['Unidecode==1.0.23']

Ah, the python-unidecode package was just updated to version 1.1.0 which
then breaks csvkit.

Here's a fixed patch that ignores the version number, the tests pass so
I think we're good still.

Thanks!
Pierre

>From 39110b5dc66485cdda73b85bc46ff9ff2c85b97f Mon Sep 17 00:00:00 2001
From: Pierre Langlois <[email-masked]>
Date: Wed, 12 Jun 2019 21:15:27 +0100
Subject: [PATCH] gnu: Add python-slugify.

* gnu/packages/python-web.scm (python-slugify): New variable.
* gnu/packages/patches/python-slugify-depend-on-unidecode.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
---
 gnu/local.mk                                  |  1 +
 .../python-slugify-depend-on-unidecode.patch  | 22 +++++++++++++
 gnu/packages/python-web.scm                   | 31 +++++++++++++++++++
 3 files changed, 54 insertions(+)
 create mode 100644 gnu/packages/patches/python-slugify-depend-on-unidecode.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 4c54f024e0..28d9d118a6 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1223,6 +1223,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/python2-pygobject-2-gi-info-type-error-domain.patch \
   %D%/packages/patches/python-pygpgme-fix-pinentry-tests.patch	\
   %D%/packages/patches/python-robotframework-honor-source-date-epoch.patch \
+  %D%/packages/patches/python-slugify-depend-on-unidecode.patch	\
   %D%/packages/patches/python2-subprocess32-disable-input-test.patch	\
   %D%/packages/patches/python-unittest2-python3-compat.patch	\
   %D%/packages/patches/python-unittest2-remove-argparse.patch	\
diff --git a/gnu/packages/patches/python-slugify-depend-on-unidecode.patch b/gnu/packages/patches/python-slugify-depend-on-unidecode.patch
new file mode 100644
index 0000000000..6038f432f1
--- /dev/null
+++ b/gnu/packages/patches/python-slugify-depend-on-unidecode.patch
@@ -0,0 +1,22 @@
+diff --git a/setup.py b/setup.py
+index 4800173..6bdd77f 100755
+--- a/setup.py
++++ b/setup.py
+@@ -14,8 +14,7 @@ url = 'https://github.com/un33k/python-slugify'
+ author = 'Val Neekman'
+ author_email = [email-masked]'
+ license = 'MIT'
+-install_requires = ['text-unidecode==1.2']
+-extras_require = {'unidecode': ['Unidecode==1.0.23']}
++install_requires = ['Unidecode']
+ 
+ classifiers = [
+     'Development Status :: 5 - Production/Stable',
+@@ -67,7 +66,6 @@ setup(
+     author_email=author_email,
+     packages=find_packages(exclude=EXCLUDE_FROM_PACKAGES),
+     install_requires=install_requires,
+-    extras_require=extras_require,
+     classifiers=classifiers,
+     entry_points={'console_scripts': ['slugify=slugify.slugify:main']},
+ )
diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index cbcbe6c867..e441cbaa81 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -29,6 +29,7 @@
 ;;; Copyright © 2018 Maxim Cournoyer <[email-masked]>
 ;;; Copyright © 2019 Vagrant Cascadian <[email-masked]>
 ;;; Copyright © 2019 Brendan Tildesley <[email-masked]>
+;;; Copyright © 2019 Pierre Langlois <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -3165,3 +3166,33 @@ Python.")
     (propagated-inputs
      `(("python-gevent" ,python2-gevent)
        ("python-tornado" ,python2-tornado)))))
+
+(define-public python-slugify
+  (package
+    (name "python-slugify")
+    (version "3.0.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "python-slugify" version))
+       (sha256
+        (base32
+         "0n6pfmsq899c54plpvzi46l7zrpa3zfpm8im6h32czjw6kxky5jp"))
+       (patches
+        (search-patches "python-slugify-depend-on-unidecode.patch"))))
+    (native-inputs
+     `(("python-wheel" ,python-wheel)))
+    (propagated-inputs
+     `(("python-unidecode" ,python-unidecode)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _
+             (invoke "python" "test.py"))))))
+    (build-system python-build-system)
+    (home-page "https://github.com/un33k/python-slugify")
+    (synopsis "Python Slugify application that handles Unicode")
+    (description "This package provides a @command{slufigy} command and
+library to create slugs from unicode strings while keeping it DRY.")
+    (license license:expat)))
-- 
2.22.0