From ce7911ddae5d30ba73c8c9552b7d4e71268e5db3 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Fri, 24 Feb 2017 17:21:07 +0100 Subject: gnu: Add python-faker. * gnu/packages/patches/python-fake-factory-fix-build-32bit.patch: Adjust paths. Also rename to ... * gnu/packages/patches/python-faker-fix-build-32bit.patch: ... this. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. * gnu/packages/python.scm (python-faker, python2-faker): New variables. (python-fake-factory)[properties]: Superseded by PYTHON-FAKER. (python2-fake-factory)[properties]: Superseded by PYTHON2-FAKER. (python-orator, python2-orator)[propagated-inputs]: Replace PYTHON-FAKE-FACTORY with PYTHON-FAKER. --- gnu/local.mk | 2 +- .../python-fake-factory-fix-build-32bit.patch | 36 -------------- .../patches/python-faker-fix-build-32bit.patch | 36 ++++++++++++++ gnu/packages/python.scm | 55 +++++++++++++++++++++- 4 files changed, 90 insertions(+), 39 deletions(-) delete mode 100644 gnu/packages/patches/python-fake-factory-fix-build-32bit.patch create mode 100644 gnu/packages/patches/python-faker-fix-build-32bit.patch (limited to 'gnu') diff --git a/gnu/local.mk b/gnu/local.mk index ee40c1bd30..819fb4fcd3 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -862,7 +862,7 @@ dist_patch_DATA = \ %D%/packages/patches/python2-rdflib-drop-sparqlwrapper.patch \ %D%/packages/patches/python-statsmodels-fix-tests.patch \ %D%/packages/patches/python-configobj-setuptools.patch \ - %D%/packages/patches/python-fake-factory-fix-build-32bit.patch \ + %D%/packages/patches/python-faker-fix-build-32bit.patch \ %D%/packages/patches/python-paste-remove-website-test.patch \ %D%/packages/patches/python-paste-remove-timing-test.patch \ %D%/packages/patches/python-pygit2-disable-network-tests.patch \ diff --git a/gnu/packages/patches/python-fake-factory-fix-build-32bit.patch b/gnu/packages/patches/python-fake-factory-fix-build-32bit.patch deleted file mode 100644 index cb60896fad..0000000000 --- a/gnu/packages/patches/python-fake-factory-fix-build-32bit.patch +++ /dev/null @@ -1,36 +0,0 @@ -These tests fail on 32-bit due to an overflow. - -Upstream bug URL: https://github.com/joke2k/faker/issues/408 - -diff --git a/faker/tests/__init__.py b/faker/tests/__init__.py -index 6026772..58b6b83 100644 ---- a/faker/tests/__init__.py -+++ b/faker/tests/__init__.py -@@ -384,7 +384,6 @@ class FactoryTestCase(unittest.TestCase): - provider = Provider - # test century - self.assertTrue(self._datetime_to_time(provider.date_time_this_century(after_now=False)) <= self._datetime_to_time(datetime.datetime.now())) -- self.assertTrue(self._datetime_to_time(provider.date_time_this_century(before_now=False, after_now=True)) >= self._datetime_to_time(datetime.datetime.now())) - # test decade - self.assertTrue(self._datetime_to_time(provider.date_time_this_decade(after_now=False)) <= self._datetime_to_time(datetime.datetime.now())) - self.assertTrue(self._datetime_to_time(provider.date_time_this_decade(before_now=False, after_now=True)) >= self._datetime_to_time(datetime.datetime.now())) -@@ -413,8 +412,6 @@ class FactoryTestCase(unittest.TestCase): - - # ensure all methods provide timezone aware datetimes - with self.assertRaises(TypeError): -- provider.date_time_this_century(before_now=False, after_now=True, tzinfo=utc) >= datetime.datetime.now() -- with self.assertRaises(TypeError): - provider.date_time_this_decade(after_now=False, tzinfo=utc) <= datetime.datetime.now() - with self.assertRaises(TypeError): - provider.date_time_this_year(after_now=False, tzinfo=utc) <= datetime.datetime.now() -@@ -423,7 +420,6 @@ class FactoryTestCase(unittest.TestCase): - - # test century - self.assertTrue(provider.date_time_this_century(after_now=False, tzinfo=utc) <= datetime.datetime.now(utc)) -- self.assertTrue(provider.date_time_this_century(before_now=False, after_now=True, tzinfo=utc) >= datetime.datetime.now(utc)) - # test decade - self.assertTrue(provider.date_time_this_decade(after_now=False, tzinfo=utc) <= datetime.datetime.now(utc)) - self.assertTrue(provider.date_time_this_decade(before_now=False, after_now=True, tzinfo=utc) >= datetime.datetime.now(utc)) --- -2.11.1 - diff --git a/gnu/packages/patches/python-faker-fix-build-32bit.patch b/gnu/packages/patches/python-faker-fix-build-32bit.patch new file mode 100644 index 0000000000..466b289012 --- /dev/null +++ b/gnu/packages/patches/python-faker-fix-build-32bit.patch @@ -0,0 +1,36 @@ +These tests fail on 32-bit due to an overflow. + +Upstream bug URL: https://github.com/joke2k/faker/issues/408 + +diff --git a/tests/__init__.py b/tests/__init__.py +index 6026772..58b6b83 100644 +--- a/tests/__init__.py ++++ b/tests/__init__.py +@@ -384,7 +384,6 @@ class FactoryTestCase(unittest.TestCase): + provider = Provider + # test century + self.assertTrue(self._datetime_to_time(provider.date_time_this_century(after_now=False)) <= self._datetime_to_time(datetime.datetime.now())) +- self.assertTrue(self._datetime_to_time(provider.date_time_this_century(before_now=False, after_now=True)) >= self._datetime_to_time(datetime.datetime.now())) + # test decade + self.assertTrue(self._datetime_to_time(provider.date_time_this_decade(after_now=False)) <= self._datetime_to_time(datetime.datetime.now())) + self.assertTrue(self._datetime_to_time(provider.date_time_this_decade(before_now=False, after_now=True)) >= self._datetime_to_time(datetime.datetime.now())) +@@ -413,8 +412,6 @@ class FactoryTestCase(unittest.TestCase): + + # ensure all methods provide timezone aware datetimes + with self.assertRaises(TypeError): +- provider.date_time_this_century(before_now=False, after_now=True, tzinfo=utc) >= datetime.datetime.now() +- with self.assertRaises(TypeError): + provider.date_time_this_decade(after_now=False, tzinfo=utc) <= datetime.datetime.now() + with self.assertRaises(TypeError): + provider.date_time_this_year(after_now=False, tzinfo=utc) <= datetime.datetime.now() +@@ -423,7 +420,6 @@ class FactoryTestCase(unittest.TestCase): + + # test century + self.assertTrue(provider.date_time_this_century(after_now=False, tzinfo=utc) <= datetime.datetime.now(utc)) +- self.assertTrue(provider.date_time_this_century(before_now=False, after_now=True, tzinfo=utc) >= datetime.datetime.now(utc)) + # test decade + self.assertTrue(provider.date_time_this_decade(after_now=False, tzinfo=utc) <= datetime.datetime.now(utc)) + self.assertTrue(provider.date_time_this_decade(before_now=False, after_now=True, tzinfo=utc) >= datetime.datetime.now(utc)) +-- +2.11.1 + diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index 70fd1557b4..76e6ead644 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -11434,6 +11434,55 @@ parsing UK postcodes.") (define-public python2-ukpostcodeparser (package-with-python2 python-ukpostcodeparser)) +(define-public python-faker + (package + (name "python-faker") + (version "0.7.9") + (source (origin + (method url-fetch) + (uri (pypi-uri "Faker" version)) + (sha256 + (base32 + "1fh2p2yz0fsdr4fqwxgddwbvfb6qn6vp8yx0qwqzra27yq5d1wsm")) + (patches + (search-patches "python-faker-fix-build-32bit.patch")) + (modules '((guix build utils))) + (snippet + '(begin + (for-each delete-file (find-files "." "\\.pyc$")) + #t)))) + (build-system python-build-system) + (arguments + '(#:phases + (modify-phases %standard-phases + (replace 'check + (lambda _ + (zero? (system* "python" "-m" "unittest" "-v" "tests"))))))) + (native-inputs + `(;; For testing + ("python-email-validator" ,python-email-validator) + ("python-mock" ,python-mock) + ("python-ukpostcodeparser" ,python-ukpostcodeparser))) + (propagated-inputs + `(("python-dateutil" ,python-dateutil) + ("python-six" ,python-six))) + (home-page "https://github.com/joke2k/faker") + (synopsis "Python package that generates fake data") + (description + "Faker is a Python package that generates fake data such as names, +addresses, and phone numbers.") + (license license:expat) + (properties `((python2-variant . ,(delay python2-faker)))))) + +(define-public python2-faker + (let ((base (package-with-python2 (strip-python2-variant + python-faker)))) + (package + (inherit base) + (propagated-inputs + `(("python2-ipaddress" ,python2-ipaddress) + ,@(package-propagated-inputs base)))))) + (define-public python-fake-factory (package (name "python-fake-factory") @@ -11468,13 +11517,15 @@ parsing UK postcodes.") "Faker is a Python package that generates fake data such as names, addresses, and phone numbers.") (license license:expat) - (properties `((python2-variant . ,(delay python2-fake-factory)))))) + (properties `((python2-variant . ,(delay python2-fake-factory)) + (superseded . ,python-faker))))) (define-public python2-fake-factory (let ((base (package-with-python2 (strip-python2-variant python-fake-factory)))) (package (inherit base) + (properties `((superseded . ,python2-faker))) (propagated-inputs `(("python2-ipaddress" ,python2-ipaddress) ,@(package-propagated-inputs base)))))) @@ -11541,7 +11592,7 @@ mocks, stubs and fakes.") `(("python-arrow" ,python-arrow) ("python-blinker" ,python-blinker) ("python-cleo" ,python-cleo) - ("python-fake-factory" ,python-fake-factory) + ("python-faker" ,python-faker) ("python-inflection" ,python-inflection) ("python-lazy-object-proxy" ,python-lazy-object-proxy) ("python-pyaml" ,python-pyaml) -- cgit v1.2.3