Browse Source

Only install monotonic on python2

monotonic is a backport of time.monotonic from python3. Only install it
for python2.

Depends-On: https://review.openstack.org/615441
Change-Id: Id27cd748e883d54dd93dac2e6bd8caee6728f7e1
Monty Taylor 10 months ago
parent
commit
658a29412b
No account linked to committer's email address
2 changed files with 7 additions and 2 deletions
  1. 6
    1
      futurist/_utils.py
  2. 1
    1
      requirements.txt

+ 6
- 1
futurist/_utils.py View File

@@ -21,7 +21,12 @@ import sys
21 21
 import threading
22 22
 import traceback
23 23
 
24
-from monotonic import monotonic as now  # noqa
24
+try:
25
+    from monotonic import monotonic as now  # noqa
26
+except ImportError:
27
+    import time
28
+    now = time.monotonic
29
+
25 30
 import six
26 31
 
27 32
 try:

+ 1
- 1
requirements.txt View File

@@ -4,7 +4,7 @@
4 4
 
5 5
 pbr!=2.1.0,>=2.0.0 # Apache-2.0
6 6
 six>=1.10.0 # MIT
7
-monotonic>=0.6 # Apache-2.0
7
+monotonic>=0.6;python_version<'3.3' # Apache-2.0
8 8
 futures>=3.0.0;python_version=='2.7' or python_version=='2.6' # BSD
9 9
 contextlib2>=0.4.0;python_version<'3.0' # PSF License
10 10
 PrettyTable<0.8,>=0.7.1 # BSD

Loading…
Cancel
Save