mirror of
https://github.com/python/cpython.git
synced 2025-11-25 12:44:13 +00:00
Make a number of small changes to ease the backport to distutils2
This commit is contained in:
parent
41479450ec
commit
229011d949
19 changed files with 104 additions and 125 deletions
|
|
@ -40,6 +40,7 @@ from xmlrpc.server import SimpleXMLRPCServer
|
|||
|
||||
from packaging.tests import unittest
|
||||
|
||||
|
||||
PYPI_DEFAULT_STATIC_PATH = os.path.join(
|
||||
os.path.dirname(os.path.abspath(__file__)), 'pypiserver')
|
||||
|
||||
|
|
@ -219,7 +220,7 @@ class PyPIRequestHandler(SimpleHTTPRequestHandler):
|
|||
relative_path += "index.html"
|
||||
|
||||
if relative_path.endswith('.tar.gz'):
|
||||
with open(fs_path + relative_path, 'br') as file:
|
||||
with open(fs_path + relative_path, 'rb') as file:
|
||||
data = file.read()
|
||||
headers = [('Content-type', 'application/x-gtar')]
|
||||
else:
|
||||
|
|
@ -260,8 +261,8 @@ class PyPIRequestHandler(SimpleHTTPRequestHandler):
|
|||
self.send_header(header, value)
|
||||
self.end_headers()
|
||||
|
||||
if type(data) is str:
|
||||
data = data.encode()
|
||||
if isinstance(data, str):
|
||||
data = data.encode('utf-8')
|
||||
|
||||
self.wfile.write(data)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue