[tor-commits] [stem/master] Adding is_python_3() to prereq module

atagar at torproject.org atagar at torproject.org
Sat Feb 2 18:20:49 UTC 2013


commit 84df4318abce565fd2f682ee6e12ea2fe9acf072
Author: Damian Johnson <atagar at torproject.org>
Date:   Mon Jan 21 08:56:35 2013 -0800

    Adding is_python_3() to prereq module
    
    Something tells me that we'll need this...
---
 stem/prereq.py |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/stem/prereq.py b/stem/prereq.py
index f80a907..b0a508e 100644
--- a/stem/prereq.py
+++ b/stem/prereq.py
@@ -16,6 +16,7 @@ series). Other requirements for complete functionality are...
 
   is_python_26 - checks if python 2.6 or later is available
   is_python_27 - checks if python 2.7 or later is available
+  is_python_3 - checks if python 3.0 or later is available
 
   is_rsa_available - checks if the rsa module is available
 """
@@ -61,6 +62,16 @@ def is_python_27():
   return _check_version(7)
 
 
+def is_python_3():
+  """
+  Checks if we're in the 3.0 - 3.x range.
+
+  :returns: bool that is True if we meet this requirement and False otherwise
+  """
+
+  return sys.version_info[0] == 3
+
+
 def is_crypto_available():
   global IS_CRYPTO_AVAILABLE
 





More information about the tor-commits mailing list