diff --git a/MANIFEST.in b/MANIFEST.in index 53b1276..3a8a9b7 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -7,3 +7,4 @@ include tox.ini .coveragerc include misc/classify_foolscap.py include versioneer.py include src/foolscap/_version.py +include src/foolscap/py.typed diff --git a/setup.py b/setup.py index 747700f..6a84a87 100755 --- a/setup.py +++ b/setup.py @@ -76,6 +76,10 @@ def run(self): }, } +setup_args.update( + include_package_data=True, +) + if __name__ == "__main__": setup(**setup_args) diff --git a/src/foolscap/py.typed b/src/foolscap/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/src/foolscap/remoteinterface.py b/src/foolscap/remoteinterface.py index aec17cf..bd489f9 100644 --- a/src/foolscap/remoteinterface.py +++ b/src/foolscap/remoteinterface.py @@ -1,4 +1,5 @@ +import six import types import inspect from zope.interface import interface, providedBy, implementer @@ -28,10 +29,9 @@ class RemoteInterfaceClass(interface.InterfaceClass): """ - def __init__(self, iname, bases=(), attrs=None, __module__=None): + def __init__(self, iname, bases=(), attrs=None): if attrs is None: - interface.InterfaceClass.__init__(self, iname, bases, attrs, - __module__) + interface.InterfaceClass.__init__(self, iname, bases, attrs) return # parse (and remove) the attributes that make this a RemoteInterface @@ -41,8 +41,7 @@ def __init__(self, iname, bases=(), attrs=None, __module__=None): raise # now let the normal InterfaceClass do its thing - interface.InterfaceClass.__init__(self, iname, bases, attrs, - __module__) + interface.InterfaceClass.__init__(self, iname, bases, attrs) # now add all the remote methods that InterfaceClass would have # complained about. This is really gross, and it really makes me @@ -92,10 +91,6 @@ def _parseRemoteInterface(self, iname, attrs): return remote_name, remote_attrs -RemoteInterface = RemoteInterfaceClass("RemoteInterface", - __module__="pb.flavors") - - def getRemoteInterface(obj): """Get the (one) RemoteInterface supported by the object, or None.""" @@ -412,3 +407,10 @@ def _makeConstraint(t): return LocalInterfaceConstraint(t) addToConstraintTypeMap(interface.InterfaceClass, _makeConstraint) + + +# See +# https://github.com/warner/foolscap/pull/76/commits/ff3b9e8c1e4fa13701273a2143ba80b1e58f47cf#r549428977 +# for more background on the use of add_metaclass here. +class RemoteInterface(six.with_metaclass(RemoteInterfaceClass, interface.Interface)): + pass