forked from Flumotion/flumotion-common
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gendoc.py
90 lines (63 loc) · 2.32 KB
/
gendoc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
# PYTHONPATH should be set so that if this is part of a Flumotion project,
# it points to misc so we can import setup.py from there
try:
from misc import setup
setup.setup()
except ImportError:
print "Not importing misc.setup"
pass
# we import docutils before installing the packager to prevent
# messing with the datadir which causes epydoc to crash
try:
import docutils
except ImportError:
print "Not importing docutils"
pass
from flumotion.common import boot
boot.init_gobject()
boot.init_gst()
from twisted.internet import gtk2reactor
gtk2reactor.install(useGtk=False)
# reinstall our import hooks that could have been overridden by
# pygtk/pygst ltihooks
from flumotion.common import package
package.getPackager().install()
# monkey patching twisted doc errors
from twisted.spread import pb
def login(self, credentials, client=None):
"""Login and get perspective from remote PB server.
Currently only credentials implementing IUsernamePassword are
supported.
@return: Deferred of RemoteReference to the perspective."""
def getRootObject(self):
"""Get root object of remote PB server.
@return: Deferred of the root object.
"""
def getPerspective(self, username, password, serviceName,
perspectiveName=None, client=None):
"""Get perspective from remote PB server.
New systems should use login() instead.
@return: Deferred of RemoteReference to the perspective.
"""
pb.PBClientFactory.login = login
pb.PBClientFactory.getRootObject = getRootObject
pb.PBClientFactory.getPerspective = getPerspective
from twisted.internet.posixbase import PosixReactorBase
def listenUDP(self, port, protocol, interface='', maxPacketSize=8192):
"""Connects a given DatagramProtocol to the given numeric UDP port.
EXPERIMENTAL.
@returns: object conforming to IListeningPort.
"""
def connectUDP(self, remotehost, remoteport, protocol, localport=0,
interface='', maxPacketSize=8192):
"""Connects a ConnectedDatagramProtocol instance to a UDP port.
EXPERIMENTAL.
"""
PosixReactorBase.listenUDP = listenUDP
PosixReactorBase.listenUNIXDatagram = listenUDP
PosixReactorBase.connectUDP = connectUDP
PosixReactorBase.connectUNIXDatagram = connectUDP
from epydoc.cli import cli
cli()