Control: tags 904582 + patch
Control: tags 904582 + pending

Dear maintainer,

I've prepared an NMU for python-stem (versioned as 1.6.0-3.1) and
uploaded it to DELAYED/1. Please feel free to tell me if I
should delay it longer.

Regards.

diff -Nru python-stem-1.6.0/debian/changelog python-stem-1.6.0/debian/changelog
--- python-stem-1.6.0/debian/changelog	2018-07-24 15:18:23.000000000 +0100
+++ python-stem-1.6.0/debian/changelog	2018-07-30 17:10:46.000000000 +0100
@@ -1,3 +1,10 @@
+python-stem (1.6.0-3.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Fixes for PyPy compatibility issues (Closes: #904582).
+
+ -- Iain R. Learmonth <i...@debian.org>  Mon, 30 Jul 2018 17:10:46 +0100
+
 python-stem (1.6.0-3) unstable; urgency=medium
 
   * Prepare package for pypy. Thanks IainRLearmonth! (Closes: #904454).
diff -Nru python-stem-1.6.0/debian/patches/pypy_compatibility.patch python-stem-1.6.0/debian/patches/pypy_compatibility.patch
--- python-stem-1.6.0/debian/patches/pypy_compatibility.patch	1970-01-01 01:00:00.000000000 +0100
+++ python-stem-1.6.0/debian/patches/pypy_compatibility.patch	2018-07-30 16:59:41.000000000 +0100
@@ -0,0 +1,172 @@
+Description: Compatibility fixed for PyPy support
+Author: Damian Johnson <ata...@torproject.org>
+Bug-Debian: https://bugs.debian.org/904582
+Last-Update: 2018-07-30
+---
+
+--- python-stem-1.6.0.orig/docs/change_log.rst
++++ python-stem-1.6.0/docs/change_log.rst
+@@ -87,6 +87,7 @@ The following are only available within
+ 
+  * **Utilities**
+ 
++  * Fixed PyPy compatibility (:trac:`26207`)
+   * Support connection resolution on OpenBSD using fstat (:trac:`13807`)
+   * Added :func:`~stem.util.system.size_of`
+   * Added :func:`~stem.util.log.is_tracing`
+--- python-stem-1.6.0.orig/setup.py
++++ python-stem-1.6.0/setup.py
+@@ -7,6 +7,9 @@
+ #
+ # * Recache latest information (cache_manual.py and cache_fallback_directories.py)
+ #
++# * Run 'run_tests.py --all --target RUN_ALL,ONLINE' with python2.6, python2.7,
++#   python3, and pypy.
++#
+ # * Tag the release
+ #   |- Bump stem's version (in stem/__init__.py and docs/index.rst).
+ #   |- git commit -a -m "Stem release 1.0.0"
+--- python-stem-1.6.0.orig/stem/prereq.py
++++ python-stem-1.6.0/stem/prereq.py
+@@ -20,6 +20,7 @@ Checks for stem dependencies. We require
+ """
+ 
+ import inspect
++import platform
+ import sys
+ 
+ try:
+@@ -85,6 +86,18 @@ def is_python_3():
+   return sys.version_info[0] == 3
+ 
+ 
++def is_pypy():
++  """
++  Checks if we're running PyPy.
++
++  .. versionadded:: 1.7.0
++
++  :returns: **True** if running pypy, **False** otherwise
++  """
++
++  return platform.python_implementation() == 'PyPy'
++
++
+ @lru_cache()
+ def is_sqlite_available():
+   """
+--- python-stem-1.6.0.orig/stem/util/system.py
++++ python-stem-1.6.0/stem/util/system.py
+@@ -80,6 +80,7 @@ import tarfile
+ import threading
+ import time
+ 
++import stem.prereq
+ import stem.util.enum
+ import stem.util.proc
+ import stem.util.str_tools
+@@ -94,8 +95,6 @@ State = stem.util.enum.UppercaseEnum(
+   'FAILED',
+ )
+ 
+-DEFAULT_SIZE = sys.getsizeof(0)  # estimate if object lacks a __sizeof__
+-
+ SIZE_RECURSES = {
+   tuple: iter,
+   list: iter,
+@@ -475,14 +474,23 @@ def size_of(obj, exclude = None):
+   :param set exclude: object ids to exclude from size estimation
+ 
+   :returns: **int** with the size of the object in bytes
++
++  :raises: **NotImplementedError** if using PyPy
+   """
+ 
++  if stem.prereq.is_pypy():
++    raise NotImplementedError('PyPy does not implement sys.getsizeof()')
++
+   if exclude is None:
+     exclude = set()
+   elif id(obj) in exclude:
+     return 0
+ 
+-  size = sys.getsizeof(obj, DEFAULT_SIZE)
++  try:
++    size = sys.getsizeof(obj)
++  except TypeError:
++    size = sys.getsizeof(0)  # estimate if object lacks a __sizeof__
++
+   exclude.add(id(obj))
+ 
+   if type(obj) in SIZE_RECURSES:
+--- python-stem-1.6.0.orig/test/integ/installation.py
++++ python-stem-1.6.0/test/integ/installation.py
+@@ -11,6 +11,7 @@ import time
+ import unittest
+ 
+ import stem
++import stem.prereq
+ import stem.util.system
+ import stem.util.test_tools
+ import test
+@@ -73,7 +74,11 @@ class TestInstallation(unittest.TestCase
+       try:
+         stem.util.system.call('%s setup.py install --prefix %s' % (PYTHON_EXE, BASE_INSTALL_PATH), timeout = 60, cwd = test.STEM_BASE)
+         stem.util.system.call('%s setup.py clean --all' % PYTHON_EXE, timeout = 60, cwd = test.STEM_BASE)  # tidy up the build directory
+-        site_packages_paths = glob.glob('%s/lib*/*/site-packages' % BASE_INSTALL_PATH)
++
++        if stem.prereq.is_pypy():
++          site_packages_paths = glob.glob('%s/site-packages' % BASE_INSTALL_PATH)
++        else:
++          site_packages_paths = glob.glob('%s/lib*/*/site-packages' % BASE_INSTALL_PATH)
+       except Exception as exc:
+         raise AssertionError("Unable to install with 'python setup.py install': %s" % exc)
+ 
+--- python-stem-1.6.0.orig/test/integ/util/system.py
++++ python-stem-1.6.0/test/integ/util/system.py
+@@ -8,6 +8,7 @@ import os
+ import tempfile
+ import unittest
+ 
++import stem.prereq
+ import stem.util.proc
+ import stem.util.system
+ import test.require
+@@ -546,6 +547,10 @@ class TestSystem(unittest.TestCase):
+     Exercises the get_process_name() and set_process_name() methods.
+     """
+ 
++    if stem.prereq.is_pypy():
++      self.skipTest('(unimplemented for pypy)')
++      return
++
+     initial_name = stem.util.system.get_process_name()
+     self.assertTrue('run_tests.py' in initial_name)
+ 
+--- python-stem-1.6.0.orig/test/unit/util/system.py
++++ python-stem-1.6.0/test/unit/util/system.py
+@@ -12,6 +12,8 @@ import posixpath
+ import tempfile
+ import unittest
+ 
++import stem.prereq
++
+ from stem.util import str_type, system
+ 
+ try:
+@@ -155,9 +157,12 @@ class TestSystem(unittest.TestCase):
+     Exercises the size_of function.
+     """
+ 
+-    self.assertTrue(system.size_of('') < system.size_of('hello') < system.size_of('hello world'))
+-    self.assertTrue(system.size_of([]) < system.size_of(['hello']) < system.size_of(['hello', 'world']))
+-    self.assertTrue(system.size_of({}) < system.size_of({'hello': 'world'}) < system.size_of({'hello': 'world', 'more': 'stuff'}))
++    if stem.prereq.is_pypy():
++      self.assertRaises(NotImplementedError, system.size_of, 'hello')
++    else:
++      self.assertTrue(system.size_of('') < system.size_of('hello') < system.size_of('hello world'))
++      self.assertTrue(system.size_of([]) < system.size_of(['hello']) < system.size_of(['hello', 'world']))
++      self.assertTrue(system.size_of({}) < system.size_of({'hello': 'world'}) < system.size_of({'hello': 'world', 'more': 'stuff'}))
+ 
+   @patch('stem.util.system.call')
+   @patch('stem.util.proc.is_available', Mock(return_value = False))
diff -Nru python-stem-1.6.0/debian/patches/series python-stem-1.6.0/debian/patches/series
--- python-stem-1.6.0/debian/patches/series	2018-07-23 14:24:24.000000000 +0100
+++ python-stem-1.6.0/debian/patches/series	2018-07-30 16:57:43.000000000 +0100
@@ -1 +1,2 @@
 python37_compatibility.patch
+pypy_compatibility.patch

Reply via email to