Merge remote-tracking branch 'origin/master' into 3618.bb-tests-python-3

This commit is contained in:
Itamar Turner-Trauring 2021-03-02 09:00:09 -05:00
commit f75eda1255
7 changed files with 26 additions and 12 deletions

0
newsfragments/3605.minor Normal file
View File

0
newsfragments/3608.minor Normal file
View File

1
newsfragments/3623.minor Normal file
View File

@ -0,0 +1 @@

View File

@ -152,9 +152,7 @@ tor_requires = [
i2p_requires = [
# txi2p has Python 3 support, but it's unreleased: https://github.com/str4d/txi2p/issues/10.
# URL lookups are in PEP-508 (via https://stackoverflow.com/a/54794506).
# Also see the comment in tor_requires.
"txi2p @ git+https://github.com/str4d/txi2p@0611b9a86172cb70d2f5e415a88eee9f230590b3#egg=txi2p",
"txi2p; python_version < '3.0'",
]
if len(sys.argv) > 1 and sys.argv[1] == '--fakedependency':

View File

@ -1,3 +1,13 @@
"""Ported to Python 3.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from future.utils import PY2
if PY2:
from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401
import os, time, tempfile
from zope.interface import implementer
@ -13,17 +23,17 @@ from twisted.python import log
def get_memory_usage():
# this is obviously linux-specific
stat_names = ("VmPeak",
"VmSize",
#"VmHWM",
"VmData")
stat_names = (b"VmPeak",
b"VmSize",
#b"VmHWM",
b"VmData")
stats = {}
try:
with open("/proc/self/status", "r") as f:
with open("/proc/self/status", "rb") as f:
for line in f:
name, right = line.split(":",2)
name, right = line.split(b":",2)
if name in stat_names:
assert right.endswith(" kB\n")
assert right.endswith(b" kB\n")
right = right[:-4]
stats[name] = int(right) * 1024
except:
@ -34,8 +44,8 @@ def get_memory_usage():
def log_memory_usage(where=""):
stats = get_memory_usage()
log.msg("VmSize: %9d VmPeak: %9d %s" % (stats["VmSize"],
stats["VmPeak"],
log.msg("VmSize: %9d VmPeak: %9d %s" % (stats[b"VmSize"],
stats[b"VmPeak"],
where))
@implementer(IConsumer)

View File

@ -29,6 +29,7 @@ PORTED_MODULES = [
"allmydata._monkeypatch",
"allmydata.blacklist",
"allmydata.codec",
"allmydata.control",
"allmydata.crypto",
"allmydata.crypto.aes",
"allmydata.crypto.ed25519",

View File

@ -123,6 +123,10 @@ deps =
mypy
git+https://github.com/Shoobx/mypy-zope
git+https://github.com/warner/foolscap
# Twisted 21.2.0 introduces some type hints which we are not yet
# compatible with.
# https://tahoe-lafs.org/trac/tahoe-lafs/ticket/3622
twisted<21.2.0
commands = mypy src