[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Deprecate is_python_27() function



commit c9852a8b183cba944aefc72462d2dcbfb88ace10
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Fri Jan 1 12:44:02 2016 -0800

    Deprecate is_python_27() function
    
    Name is deceptive. It doesn't check that we're running python 2.7, but rather
    that we're simply *not* 2.6. Now that we have a private helper for that it's
    more straight forward to use that.
---
 stem/descriptor/export.py      |    2 +-
 stem/prereq.py                 |    9 +++++----
 test/runner.py                 |    2 +-
 test/unit/descriptor/export.py |    6 ++----
 4 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/stem/descriptor/export.py b/stem/descriptor/export.py
index f90a607..1e311a2 100644
--- a/stem/descriptor/export.py
+++ b/stem/descriptor/export.py
@@ -98,7 +98,7 @@ def export_csv_file(output_file, descriptors, included_fields = (), excluded_fie
 
   writer = csv.DictWriter(output_file, included_fields, dialect = _ExportDialect(), extrasaction='ignore')
 
-  if header and stem.prereq.is_python_27():
+  if header and not stem.prereq._is_python_26():
     writer.writeheader()
 
   for desc in descriptors:
diff --git a/stem/prereq.py b/stem/prereq.py
index 45c0bf5..9051b41 100644
--- a/stem/prereq.py
+++ b/stem/prereq.py
@@ -3,7 +3,8 @@
 
 """
 Checks for stem dependencies. We require python 2.6 or greater (including the
-3.x series). Other requirements for complete functionality are...
+3.x series), but note we'll be bumping our requirements to python 2.7 in stem
+2.0. Other requirements for complete functionality are...
 
 * pycrypto module
 
@@ -12,10 +13,7 @@ Checks for stem dependencies. We require python 2.6 or greater (including the
 ::
 
   check_requirements - checks for minimum requirements for running stem
-
-  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_crypto_available - checks if the pycrypto module is available
 """
 
@@ -63,6 +61,9 @@ def is_python_27():
   """
   Checks if we're running python 2.7 or above (including the 3.x series).
 
+  .. deprecated:: 1.5.0
+     Function lacks much utility and will be eventually removed.
+
   :returns: **True** if we meet this requirement and **False** otherwise
   """
 
diff --git a/test/runner.py b/test/runner.py
index 80f390e..8793616 100644
--- a/test/runner.py
+++ b/test/runner.py
@@ -113,7 +113,7 @@ def skip(test_case, message):
   :param str message: message to skip the test with
   """
 
-  if stem.prereq.is_python_27():
+  if not stem.prereq._is_python_26():
     test_case.skipTest(message)
 
 
diff --git a/test/unit/descriptor/export.py b/test/unit/descriptor/export.py
index 7e9e01b..31537c5 100644
--- a/test/unit/descriptor/export.py
+++ b/test/unit/descriptor/export.py
@@ -26,8 +26,7 @@ class TestExport(unittest.TestCase):
     Exports a single minimal tor server descriptor.
     """
 
-    # we won't have a header prior to python 2.7
-    if not stem.prereq.is_python_27():
+    if stem.prereq._is_python_26():
       test.runner.skip(self, '(header added in python 2.7)')
       return
 
@@ -76,8 +75,7 @@ class TestExport(unittest.TestCase):
     Checks that the default attributes for our csv output doesn't include private fields.
     """
 
-    # we won't have a header prior to python 2.7
-    if not stem.prereq.is_python_27():
+    if stem.prereq._is_python_26():
       test.runner.skip(self, '(header added in python 2.7)')
       return
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits