From 7fa2c54a60902ee924a3b540cad0d5ed4894c418 Mon Sep 17 00:00:00 2001 From: Samuel Leathers Date: Fri, 15 Sep 2017 15:04:19 -0400 Subject: awesome-slugify: fixes tests --- .../python-modules/awesome-slugify/default.nix | 30 ++++++++++++++++++++++ .../awesome-slugify/slugify_filename_test.patch | 13 ++++++++++ pkgs/top-level/python-packages.nix | 24 +---------------- 3 files changed, 44 insertions(+), 23 deletions(-) create mode 100644 pkgs/development/python-modules/awesome-slugify/default.nix create mode 100644 pkgs/development/python-modules/awesome-slugify/slugify_filename_test.patch diff --git a/pkgs/development/python-modules/awesome-slugify/default.nix b/pkgs/development/python-modules/awesome-slugify/default.nix new file mode 100644 index 0000000000000..105c70c28b34d --- /dev/null +++ b/pkgs/development/python-modules/awesome-slugify/default.nix @@ -0,0 +1,30 @@ +{ stdenv, buildPythonPackage, fetchPypi, unidecode, regex, python }: + +buildPythonPackage rec { + pname = "awesome-slugify"; + version = "1.6.5"; + name = "${pname}-${version}"; + + src = fetchPypi { + inherit pname version; + sha256 = "0wgxrhr8s5vk2xmcz9s1z1aml4ppawmhkbggl9rp94c747xc7pmv"; + }; + + patches = [ + ./slugify_filename_test.patch # fixes broken test by new unidecode + ]; + + propagatedBuildInputs = [ unidecode regex ]; + + checkPhase = '' + ${python.interpreter} -m unittest discover + ''; + + meta = with stdenv.lib; { + homepage = "https://github.com/dimka665/awesome-slugify"; + description = "Python flexible slugify function"; + license = licenses.gpl3; + platforms = platforms.all; + maintainers = with maintainers; [ abbradar ]; + }; +} diff --git a/pkgs/development/python-modules/awesome-slugify/slugify_filename_test.patch b/pkgs/development/python-modules/awesome-slugify/slugify_filename_test.patch new file mode 100644 index 0000000000000..3283d76eae052 --- /dev/null +++ b/pkgs/development/python-modules/awesome-slugify/slugify_filename_test.patch @@ -0,0 +1,13 @@ +diff --git i/slugify/tests.py w/slugify/tests.py +index 4c9fa1c..3e14328 100644 +--- i/slugify/tests.py ++++ w/slugify/tests.py +@@ -57,7 +57,7 @@ class PredefinedSlugifyTestCase(unittest.TestCase): + self.assertEqual(slugify_url('The Über article'), 'uber-article') + + def test_slugify_filename(self): +- self.assertEqual(slugify_filename(u'Дrаft №2.txt'), u'Draft_2.txt') ++ self.assertEqual(slugify_filename(u'Дrаft №2.txt'), u'Draft_No._2.txt') + + + class ToLowerTestCase(unittest.TestCase): diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 4726edf6038fd..3210c6a53a2a4 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -743,29 +743,7 @@ in { python-slugify = callPackage ../development/python-modules/python-slugify { }; - awesome-slugify = buildPythonPackage rec { - name = "awesome-slugify-${version}"; - version = "1.6.5"; - - src = pkgs.fetchurl { - url = "mirror://pypi/a/awesome-slugify/${name}.tar.gz"; - sha256 = "0wgxrhr8s5vk2xmcz9s1z1aml4ppawmhkbggl9rp94c747xc7pmv"; - }; - - propagatedBuildInputs = with self; [ unidecode regex ]; - - checkPhase = '' - ${python.interpreter} -m unittest discover - ''; - - meta = with stdenv.lib; { - homepage = "https://github.com/dimka665/awesome-slugify"; - description = "Python flexible slugify function"; - license = licenses.gpl3; - platforms = platforms.all; - maintainers = with maintainers; [ abbradar ]; - }; - }; + awesome-slugify = callPackage ../development/python-modules/awesome-slugify {}; noise = buildPythonPackage rec { name = "noise-${version}"; -- cgit 1.4.1