comparison tests/dummysmtpd.py @ 30506:d9d8d78e6bc9

server: move cmdutil.service() to new module (API) And call it runservice() because I'll soon add createservice(). The main reason I'm going to introduce the 'server' module is to solve future dependency cycle between chgserver.py and commandserver.py. The 'server' module sits at the same layer as the cmdutil. I believe it's generally good to get rid of things from the big cmdutil module.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 15 Oct 2016 13:47:43 +0900
parents 1b8b6adb2365
children d83ca854fa21
comparison
equal deleted inserted replaced
30505:158b41842fd2 30506:d9d8d78e6bc9
9 import smtpd 9 import smtpd
10 import ssl 10 import ssl
11 import sys 11 import sys
12 12
13 from mercurial import ( 13 from mercurial import (
14 cmdutil, 14 server,
15 sslutil, 15 sslutil,
16 ui as uimod, 16 ui as uimod,
17 ) 17 )
18 18
19 def log(msg): 19 def log(msg):
73 dummysmtpserver(addr) 73 dummysmtpserver(addr)
74 else: 74 else:
75 dummysmtpsecureserver(addr, opts.certificate) 75 dummysmtpsecureserver(addr, opts.certificate)
76 log('listening at %s:%d\n' % addr) 76 log('listening at %s:%d\n' % addr)
77 77
78 cmdutil.service(vars(opts), initfn=init, runfn=run, 78 server.runservice(vars(opts), initfn=init, runfn=run,
79 runargs=[sys.executable, __file__] + sys.argv[1:]) 79 runargs=[sys.executable, __file__] + sys.argv[1:])
80 80
81 if __name__ == '__main__': 81 if __name__ == '__main__':
82 main() 82 main()