summaryrefslogtreecommitdiff
path: root/dev-python/freezegun
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2019-12-15 18:09:03 +0000
committerV3n3RiX <venerix@redcorelinux.org>2019-12-15 18:09:03 +0000
commit7bc9c63c9da678a7e6fceb095d56c634afd22c56 (patch)
tree4a67d50a439e9af63947e5f8b6ba3719af98b6c9 /dev-python/freezegun
parentb284a3168fa91a038925d2ecf5e4791011ea5e7d (diff)
gentoo resync : 15.12.2019
Diffstat (limited to 'dev-python/freezegun')
-rw-r--r--dev-python/freezegun/Manifest8
-rw-r--r--dev-python/freezegun/files/freezegun-0.3.12-py38.patch122
-rw-r--r--dev-python/freezegun/files/freezegun-0.3.12-tests.patch13
-rw-r--r--dev-python/freezegun/freezegun-0.3.10.ebuild1
-rw-r--r--dev-python/freezegun/freezegun-0.3.11.ebuild1
-rw-r--r--dev-python/freezegun/freezegun-0.3.12-r1.ebuild55
6 files changed, 198 insertions, 2 deletions
diff --git a/dev-python/freezegun/Manifest b/dev-python/freezegun/Manifest
index 506167b8f8e5..5f055f0347dc 100644
--- a/dev-python/freezegun/Manifest
+++ b/dev-python/freezegun/Manifest
@@ -1,6 +1,10 @@
AUX freezegun-0.3.10-py37.patch 2157 BLAKE2B 9d7815473f512a36431872664aae95d9aba815380ec08ed6bd54d764a3e65347c9214fbc7ede39b94964105f8fca2a3127e1eddb9b4385d30788b3bceb2f975d SHA512 1664ce2e1947a6b9b37beb3191ab83f3e7e257f500aa512c0d0d085af34b150fb964b18875faba976f0d094b80681e778a7b06b5251eaa1e811cfb2eaf9a2fb3
+AUX freezegun-0.3.12-py38.patch 3813 BLAKE2B 53509e06187e190811d067b7235a366a218131b1f871dda7d3a20fea1ca8b75682c386ea29dbd24a9950815f03da76e54dc432ddb20eb38b038e03bb9552ac90 SHA512 55bd488698e5e401650d15fa911f21dcea8128fa394c914981d615415cb19dd9b5bcc6ac3866e46e730c6b7a40b894bd9e9e748ced6a8586dabd7e71040d827e
+AUX freezegun-0.3.12-tests.patch 431 BLAKE2B 42719249d4498d44f2810436b11e53b4b58027b916c8959d2273222076a1a94dc22e3721ce277a6edd6c96b49ef35e5076ae5e33529efae6148319b1d8fb1c15 SHA512 ed0311fe047eb3df82d444eed5de8dbc38315942a13640a95108b402f4e4fc5a77b56f6c24f52c4491573da7ce7c30c024c134b097e76f8ad8914bf47750afed
DIST freezegun-0.3.10.tar.gz 20398 BLAKE2B 971f4f3de565878b8a1e4671160f41cc7c558f5c848f5c79dfc48e3f3e3cb71ff9c71090705167d4252edbfee040ef52a7eafd33073011c07337311a7e0ec366 SHA512 64364459dc72484e2124a20a0a84d2b88617efd0578fba687adb51635d578a1e36a00cb119998082610c608e7b6c3589bff5424e38845bad026e85449c8065a5
DIST freezegun-0.3.11.tar.gz 23382 BLAKE2B 759cc0355c8600fc46124dfb73b46a771de5cae4e66f5826c175295da96190920d7ff45b6457a061276c0c698bd448e294f29f3b89a0ed8fe76db58e1180b080 SHA512 e8b392176641d52f6ed795c9af5fbc0a62892aeedf32b42375b56ab44a9ad7a5ecd3bb81363ed0ae65204aff2ef894cd7f2e17f42be72f31d3409b2bffa59ab8
-EBUILD freezegun-0.3.10.ebuild 926 BLAKE2B 13ce0d244680523b9c6102c1ad0ddcd0dad5ebfd9e48a327e0eb5f3102800841db5af12755838201d4cd0f6cb404123cf1d0b169591ca35c9ee04d19df414f9f SHA512 a921b61e9718b68cfea116b378be225b017e4995ee2953e42eeebd30edd76938f22b76c27fb6ed6784517937265e549b3866098b27bf92325cc177519f09c833
-EBUILD freezegun-0.3.11.ebuild 881 BLAKE2B 8950f71f840dcb6cdf7aa4ab22282b64ef0b624cf5eb7a89f03390dbd0b6524d5e2602a97c606ffd96028c58f6b55c52cae8ab3c99227fac22a4595cf0e797da SHA512 b44bdac10d8e07ac253febf41bea3ee785acc2b37ed9e523b8494e8a0e5d3b2545087519ba903c335900b9b4eaf3fc9d985d7f6ec8224c526e62cbeb8e89fa99
+DIST freezegun-0.3.12.tar.gz 24346 BLAKE2B 09d7c662a82d7b7fa6ae56c09bff0d73e2b63fba2b492620cd8e68ee06a15129a7e901418d1881e65b440babcfe0d014ad3574ab8dd2c7eab8486b3d868273ac SHA512 f7d98ea84735b24380fa53e1e62622fe91be5a35cb75221ca4cb02418add9b0a4add9b2f691242be75acbc45d4745fef82ffe3c89890dcdffa4405940e527af4
+EBUILD freezegun-0.3.10.ebuild 953 BLAKE2B b57ac38fe16e8bf255e317f8bb5b6fa18d3546a5fa853c721548540fea27434d83d77da97feff77744eff53117aa21f3e5aa759596d8857b072d370fd8402c6d SHA512 f466ea45fc4d8880f327835483109c49da31b738f2d34aa281f7c0e44dfca44f7448c859a321d23463d13474848188bae53e36b2de42492f3c15d77252851966
+EBUILD freezegun-0.3.11.ebuild 908 BLAKE2B 7133c4b2ef60a147479ef362174cf49a43feadcb709b753eb3766685568bea95e258f3549a0fb3e2e7870547f991407d6620d7bc342db4832971a34778685f91 SHA512 fa7f70603226bda71b641daa8fb6bde0b06b446950065b4ff189b6d7d8ea5e877882bf57ce6b61b06e9fa85d5b74527ae5d773ec701b9eea429894a79943390b
+EBUILD freezegun-0.3.12-r1.ebuild 1306 BLAKE2B 6695516c7d81a5d1cf3e99408ef4bb80e9af7b7ea7e529c66f28399869fd31b05f94afb0bfbd81299465b491679dbc2ff96d9a7302c8eff82319d10d3bd6bb86 SHA512 294298ffedbb8ac583e8c8d3d0aa0e857155d4fc1490e6ed5c68cc11481a4086d8f50285762a2b74d4416e34c3ad96feb6ce5d78ae814767c4b187b59def6aec
MISC metadata.xml 392 BLAKE2B 574f859b6be3de78801f9214b561b366ddb87357be71a6891084da1f3de2e6481692d5da7ca6d5008d3ae963cc1e36ead4aae6115f0008d63d65a089cf70115f SHA512 b39f8a45d62f0c220fb915ad64c6a17e9f9619aa8c358694c3a3a83464eb5fcf50ed658430d9aabfb76e8310d4ab3baf059a8de78ebe46a59d6af187735489ed
diff --git a/dev-python/freezegun/files/freezegun-0.3.12-py38.patch b/dev-python/freezegun/files/freezegun-0.3.12-py38.patch
new file mode 100644
index 000000000000..d35303bf9fe5
--- /dev/null
+++ b/dev-python/freezegun/files/freezegun-0.3.12-py38.patch
@@ -0,0 +1,122 @@
+commit 4d998c9d6b130ed4e2d54cb96b010fec749a9c59
+Author: xtreak <tir.karthi@gmail.com>
+Date: Wed Jun 19 14:54:22 2019 +0000
+
+ Patch time.time_ns to support Python 3.8
+
+diff --git a/CHANGELOG b/CHANGELOG
+index efac4d3..14d96be 100644
+--- a/CHANGELOG
++++ b/CHANGELOG
+@@ -11,6 +11,7 @@ Latest
+ * Ignore Selenium
+ * Move to pytest
+ * Conditionally patch time.clock
++* Patch time.time_ns added in Python 3.7
+
+ 0.3.11
+ ------
+@@ -57,4 +58,4 @@ Latest
+
+ * Add `tick` argument to allow time to move forward
+ * Performance improvements
+-* Fix timezone example in README
+\ No newline at end of file
++* Fix timezone example in README
+diff --git a/freezegun/api.py b/freezegun/api.py
+index 5e7d7fa..bc61270 100644
+--- a/freezegun/api.py
++++ b/freezegun/api.py
+@@ -20,6 +20,7 @@ try:
+ except ImportError:
+ MayaDT = None
+
++_TIME_NS_PRESENT = hasattr(time, 'time_ns')
+
+ real_time = time.time
+ real_localtime = time.localtime
+@@ -28,6 +29,11 @@ real_strftime = time.strftime
+ real_date = datetime.date
+ real_datetime = datetime.datetime
+ real_date_objects = [real_time, real_localtime, real_gmtime, real_strftime, real_date, real_datetime]
++
++if _TIME_NS_PRESENT:
++ real_time_ns = time.time_ns
++ real_date_objects.append(real_time_ns)
++
+ _real_time_object_ids = set(id(obj) for obj in real_date_objects)
+
+ # time.clock is deprecated and was removed in Python 3.8
+@@ -175,6 +181,12 @@ def fake_time():
+ current_time = get_current_time()
+ return calendar.timegm(current_time.timetuple()) + current_time.microsecond / 1000000.0
+
++if _TIME_NS_PRESENT:
++ def fake_time_ns():
++ if _should_use_real_time():
++ return real_time_ns()
++ return int(int(fake_time()) * 1e9)
++
+
+ def fake_localtime(t=None):
+ if t is not None:
+@@ -331,7 +343,7 @@ class FakeDatetime(with_metaclass(FakeDatetimeMeta, real_datetime, FakeDate)):
+
+ def date(self):
+ return date_to_fakedate(self)
+-
++
+ @property
+ def nanosecond(self):
+ try:
+@@ -599,6 +611,10 @@ class _freeze_time(object):
+ ('real_time', real_time, fake_time),
+ ]
+
++ if _TIME_NS_PRESENT:
++ time.time_ns = fake_time_ns
++ to_patch.append(('real_time_ns', real_time_ns, fake_time_ns))
++
+ if real_clock is not None:
+ # time.clock is deprecated and was removed in Python 3.8
+ time.clock = fake_clock
+@@ -741,7 +757,7 @@ def freeze_time(time_to_freeze=None, tz_offset=0, ignore=None, tick=False, as_ar
+ ignore.append('selenium')
+ ignore.append('_pytest.terminal.')
+ ignore.append('_pytest.runner.')
+-
++
+ return _freeze_time(time_to_freeze, tz_offset, ignore, tick, as_arg, auto_tick_seconds)
+
+
+diff --git a/tests/test_datetimes.py b/tests/test_datetimes.py
+index cfef4a1..688fdce 100644
+--- a/tests/test_datetimes.py
++++ b/tests/test_datetimes.py
+@@ -19,6 +19,7 @@ except ImportError:
+
+ # time.clock was removed in Python 3.8
+ HAS_CLOCK = hasattr(time, 'clock')
++HAS_TIME_NS = hasattr(time, 'time_ns')
+
+ class temp_locale(object):
+ """Temporarily change the locale."""
+@@ -656,3 +657,18 @@ def test_should_use_real_time():
+ assert time.gmtime() != expected_frozen_gmt
+ if HAS_CLOCK:
+ assert time.clock() != expected_clock
++
++
++@pytest.mark.skipif(not HAS_TIME_NS,
++ reason="time.time_ns is present only on 3.7 and above")
++def test_time_ns():
++ freezer = freeze_time("2012-01-14")
++ local_time = datetime.datetime(2012, 1, 14)
++ utc_time = local_time - datetime.timedelta(seconds=time.timezone)
++ expected_timestamp = time.mktime(utc_time.timetuple())
++
++ freezer.start()
++ assert time.time() == expected_timestamp
++ assert time.time_ns() == expected_timestamp * 1e9
++ freezer.stop()
++ assert time.time() != expected_timestamp
diff --git a/dev-python/freezegun/files/freezegun-0.3.12-tests.patch b/dev-python/freezegun/files/freezegun-0.3.12-tests.patch
new file mode 100644
index 000000000000..08543fc7d595
--- /dev/null
+++ b/dev-python/freezegun/files/freezegun-0.3.12-tests.patch
@@ -0,0 +1,13 @@
+diff --git a/tests/test_datetimes.py b/tests/test_datetimes.py
+index 688fdce..a61484d 100644
+--- a/tests/test_datetimes.py
++++ b/tests/test_datetimes.py
+@@ -18,7 +18,7 @@ except ImportError:
+ maya = None
+
+ # time.clock was removed in Python 3.8
+-HAS_CLOCK = hasattr(time, 'clock')
++HAS_CLOCK = hasattr(time, 'clock') and getattr(time, 'clock') is not None
+ HAS_TIME_NS = hasattr(time, 'time_ns')
+
+ class temp_locale(object):
diff --git a/dev-python/freezegun/freezegun-0.3.10.ebuild b/dev-python/freezegun/freezegun-0.3.10.ebuild
index d87eb1ebce87..a398a264edc3 100644
--- a/dev-python/freezegun/freezegun-0.3.10.ebuild
+++ b/dev-python/freezegun/freezegun-0.3.10.ebuild
@@ -14,6 +14,7 @@ LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 s390 ~sh sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
IUSE="test"
+RESTRICT="!test? ( test )"
RDEPEND="
>dev-python/python-dateutil-2.0[${PYTHON_USEDEP}]
diff --git a/dev-python/freezegun/freezegun-0.3.11.ebuild b/dev-python/freezegun/freezegun-0.3.11.ebuild
index d74d7f9153bd..8211ca08193a 100644
--- a/dev-python/freezegun/freezegun-0.3.11.ebuild
+++ b/dev-python/freezegun/freezegun-0.3.11.ebuild
@@ -14,6 +14,7 @@ LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
IUSE="test"
+RESTRICT="!test? ( test )"
RDEPEND="
>dev-python/python-dateutil-2.0[${PYTHON_USEDEP}]
diff --git a/dev-python/freezegun/freezegun-0.3.12-r1.ebuild b/dev-python/freezegun/freezegun-0.3.12-r1.ebuild
new file mode 100644
index 000000000000..bef9ce1ee62a
--- /dev/null
+++ b/dev-python/freezegun/freezegun-0.3.12-r1.ebuild
@@ -0,0 +1,55 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+PYTHON_COMPAT=( python{2_7,3_{5,6,7,8}} pypy{,3} )
+
+inherit distutils-r1
+
+DESCRIPTION="Let your Python tests travel through time"
+HOMEPAGE="https://github.com/spulec/freezegun"
+SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
+IUSE="test"
+
+RDEPEND="
+ >dev-python/python-dateutil-2.0[${PYTHON_USEDEP}]
+ dev-python/six[${PYTHON_USEDEP}]
+"
+DEPEND="${RDEPEND}
+ dev-python/setuptools[${PYTHON_USEDEP}]
+ test? (
+ $(python_gen_impl_dep sqlite)
+ dev-python/mock[${PYTHON_USEDEP}]
+ dev-python/nose[${PYTHON_USEDEP}]
+ )
+"
+
+PATCHES=(
+ # pulled from upstream git, will be in next release
+ "${FILESDIR}/freezegun-0.3.12-py38.patch"
+
+ # test fixes
+ "${FILESDIR}/freezegun-0.3.12-tests.patch"
+)
+
+distutils_enable_tests pytest
+
+python_prepare_all() {
+ sed -r \
+ -e 's:(python-dateutil)>=2.0:\1:' \
+ -e "s:'(python-dateutil)>=[0-9.]+,.+':'\1':" \
+ -i setup.py
+
+ distutils-r1_python_prepare_all
+}
+
+python_prepare() {
+ # optional and only works with python3
+ if ! python_is_python3; then
+ rm ${PN}/_async.py || die
+ fi
+}