Skip to content

Commit

Permalink
Portable Python script across Python version
Browse files Browse the repository at this point in the history
SocketServer has been renamed socketserver in Python3.

Differential Revision: https://reviews.llvm.org/D55258

llvm-svn: 349010
  • Loading branch information
serge-sans-paille-qb committed Dec 13, 2018
1 parent 1f88dc5 commit 040ee58
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions clang/tools/scan-view/bin/scan-view
Expand Up @@ -80,9 +80,12 @@ def run(port, options, root):


def port_is_open(port):
import SocketServer
try:
t = SocketServer.TCPServer((kDefaultHost, port), None)
import socketserver
except ImportError:
import SocketServer as socketserver
try:
t = socketserver.TCPServer((kDefaultHost, port), None)
except:
return False
t.server_close()
Expand Down

0 comments on commit 040ee58

Please sign in to comment.