1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-24 14:30:43 -08:00

Support Python 3 in 'package-test-update-archives-async'

* test/lisp/emacs-lisp/package-resources/package-test-server.py:
Support Python 3.
* test/lisp/emacs-lisp/package-tests.el
(package-test-update-archives-async): Search for an executable
named "python", "python3", or "python2".  (Bug#70722)

Co-authored-by: Lin Sun <sunlin7@hotmail.com>
This commit is contained in:
kobarity 2024-05-10 00:39:10 +09:00 committed by Eli Zaretskii
parent 5fdc6d8357
commit 6380806196
2 changed files with 15 additions and 18 deletions

View file

@ -1,23 +1,19 @@
import sys
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
try:
from http.server import HTTPServer, SimpleHTTPRequestHandler
except ImportError:
from BaseHTTPServer import HTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
HandlerClass = SimpleHTTPRequestHandler
ServerClass = BaseHTTPServer.HTTPServer
Protocol = "HTTP/1.0"
if sys.argv[1:]:
port = int(sys.argv[1])
else:
port = 0
server_address = ('127.0.0.1', port)
HandlerClass.protocol_version = Protocol
httpd = ServerClass(server_address, HandlerClass)
HandlerClass.protocol_version = "HTTP/1.0"
server_address = ("127.0.0.1", int(sys.argv[1]) if sys.argv[1:] else 0)
httpd = HTTPServer(server_address, HandlerClass)
ip, port = httpd.socket.getsockname()[0:2]
print ("Server started, http://%s:%s/" % (ip, port))
print("Server started, http://%s:%s/" % (ip, port))
# Flush in case we're in full buffering mode (instead of line
# buffering), this might happen if python is a cygwin program and we
# run it from a native w32 program.