From 658a29412b71d0c4ea7d48968935447b99cdde32 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Mon, 11 Jun 2018 13:12:22 -0500 Subject: [PATCH] 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 --- futurist/_utils.py | 7 ++++++- requirements.txt | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/futurist/_utils.py b/futurist/_utils.py index b200d90..94498b7 100644 --- a/futurist/_utils.py +++ b/futurist/_utils.py @@ -21,7 +21,12 @@ import sys import threading import traceback -from monotonic import monotonic as now # noqa +try: + from monotonic import monotonic as now # noqa +except ImportError: + import time + now = time.monotonic + import six try: diff --git a/requirements.txt b/requirements.txt index 777e49c..4f2ad36 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ pbr!=2.1.0,>=2.0.0 # Apache-2.0 six>=1.10.0 # MIT -monotonic>=0.6 # Apache-2.0 +monotonic>=0.6;python_version<'3.3' # Apache-2.0 futures>=3.0.0;python_version=='2.7' or python_version=='2.6' # BSD contextlib2>=0.4.0;python_version<'3.0' # PSF License PrettyTable<0.8,>=0.7.1 # BSD