mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-06-01 07:10:53 +00:00
bump Twisted dep to 11.1.0, thus simplify IntishPermissions
This commit is contained in:
parent
b36903d02c
commit
cc68a81326
@ -110,10 +110,12 @@ if sys.platform == "win32":
|
|||||||
# which includes the fix to <https://twistedmatrix.com/trac/ticket/411>.
|
# which includes the fix to <https://twistedmatrix.com/trac/ticket/411>.
|
||||||
# * The SFTP frontend depends on Twisted 11.0.0 to fix the SSH server
|
# * The SFTP frontend depends on Twisted 11.0.0 to fix the SSH server
|
||||||
# rekeying bug <https://twistedmatrix.com/trac/ticket/4395>
|
# rekeying bug <https://twistedmatrix.com/trac/ticket/4395>
|
||||||
|
# * The FTP frontend depends on Twisted >=11.1.0 for
|
||||||
|
# filepath.Permissions
|
||||||
# * We don't want Twisted >= 12.2.0 to avoid a dependency of its endpoints
|
# * We don't want Twisted >= 12.2.0 to avoid a dependency of its endpoints
|
||||||
# code on pywin32. <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2028>
|
# code on pywin32. <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2028>
|
||||||
#
|
#
|
||||||
"Twisted >= 11.0.0, <= 12.1.0",
|
"Twisted >= 11.1.0, <= 12.1.0",
|
||||||
|
|
||||||
# * We need Nevow >= 0.9.33 to avoid a bug in Nevow's setup.py
|
# * We need Nevow >= 0.9.33 to avoid a bug in Nevow's setup.py
|
||||||
# which imported twisted at setup time.
|
# which imported twisted at setup time.
|
||||||
|
@ -62,18 +62,16 @@ class WriteFile:
|
|||||||
class NoParentError(Exception):
|
class NoParentError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if hasattr(filepath, "Permissions"):
|
# filepath.Permissions was added in Twisted-11.1.0, which we require. Twisted
|
||||||
# filepath.Permissions was added in Twisted-11.1.0, but we're compatible
|
# <15.0.0 expected an int, and only does '&' on it. Twisted >=15.0.0 expects
|
||||||
# back to 11.0.0 (on windows). Fortunately we don't really need to
|
# a filepath.Permissions. This satisfies both.
|
||||||
# provide anything more than an int until Twisted-15.0.0 .
|
|
||||||
class IntishPermissions(filepath.Permissions):
|
class IntishPermissions(filepath.Permissions):
|
||||||
def __init__(self, statModeInt):
|
def __init__(self, statModeInt):
|
||||||
self.statModeInt = statModeInt
|
self._tahoe_statModeInt = statModeInt
|
||||||
filepath.Permissions.__init__(self, statModeInt)
|
filepath.Permissions.__init__(self, statModeInt)
|
||||||
def __and__(self, other):
|
def __and__(self, other):
|
||||||
return self.statModeInt & other
|
return self._tahoe_statModeInt & other
|
||||||
else:
|
|
||||||
IntishPermissions = lambda statModeInt: statModeInt
|
|
||||||
|
|
||||||
class Handler:
|
class Handler:
|
||||||
implements(ftp.IFTPShell)
|
implements(ftp.IFTPShell)
|
||||||
@ -214,10 +212,11 @@ class Handler:
|
|||||||
elif key == "directory":
|
elif key == "directory":
|
||||||
value = isdir
|
value = isdir
|
||||||
elif key == "permissions":
|
elif key == "permissions":
|
||||||
# Twisted-14.0.2 expected an int, and used it in a rendering
|
# Twisted-14.0.2 (and earlier) expected an int, and used it
|
||||||
# function that did (mode & NUMBER). Twisted-15.0.0 expects a
|
# in a rendering function that did (mode & NUMBER).
|
||||||
|
# Twisted-15.0.0 expects a
|
||||||
# twisted.python.filepath.Permissions , and calls its
|
# twisted.python.filepath.Permissions , and calls its
|
||||||
# .shorthand() method. Try to provide both.
|
# .shorthand() method. This provides both both.
|
||||||
value = IntishPermissions(0600)
|
value = IntishPermissions(0600)
|
||||||
elif key == "hardlinks":
|
elif key == "hardlinks":
|
||||||
value = 1
|
value = 1
|
||||||
|
@ -79,11 +79,6 @@ class Handler(GridTestMixin, ReallyEqualMixin, unittest.TestCase):
|
|||||||
actual_list, expected_list))
|
actual_list, expected_list))
|
||||||
for (a, b) in zip(actual_list, expected_list):
|
for (a, b) in zip(actual_list, expected_list):
|
||||||
(name, meta) = a
|
(name, meta) = a
|
||||||
# convert meta.permissions to int for comparison. When we run
|
|
||||||
# against many (but not all) versions of Twisted, this is a
|
|
||||||
# filepath.Permissions object, not an int
|
|
||||||
meta = list(meta)
|
|
||||||
meta[2] = meta[2] & 0xffffffff
|
|
||||||
(expected_name, expected_meta) = b
|
(expected_name, expected_meta) = b
|
||||||
self.failUnlessReallyEqual(name, expected_name)
|
self.failUnlessReallyEqual(name, expected_name)
|
||||||
self.failUnlessReallyEqual(meta, expected_meta)
|
self.failUnlessReallyEqual(meta, expected_meta)
|
||||||
@ -98,12 +93,12 @@ class Handler(GridTestMixin, ReallyEqualMixin, unittest.TestCase):
|
|||||||
|
|
||||||
expected_root = [
|
expected_root = [
|
||||||
('loop',
|
('loop',
|
||||||
[0, True, 0600, 1, self.FALL_OF_BERLIN_WALL, 'alice', 'alice', '??']),
|
[0, True, ftpd.IntishPermissions(0600), 1, self.FALL_OF_BERLIN_WALL, 'alice', 'alice', '??']),
|
||||||
('immutable',
|
('immutable',
|
||||||
[23, False, 0600, 1, self.TURN_OF_MILLENIUM, 'alice', 'alice', '??']),
|
[23, False, ftpd.IntishPermissions(0600), 1, self.TURN_OF_MILLENIUM, 'alice', 'alice', '??']),
|
||||||
('mutable',
|
('mutable',
|
||||||
# timestamp should be 0 if no timestamp metadata is present
|
# timestamp should be 0 if no timestamp metadata is present
|
||||||
[0, False, 0600, 1, 0, 'alice', 'alice', '??'])]
|
[0, False, ftpd.IntishPermissions(0600), 1, 0, 'alice', 'alice', '??'])]
|
||||||
|
|
||||||
d.addCallback(lambda root: self._compareDirLists(root, expected_root))
|
d.addCallback(lambda root: self._compareDirLists(root, expected_root))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user