Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
b3168e5e
Commit
b3168e5e
authored
Jan 25, 2018
by
Bo Bayles
Committed by
Éric Araujo
Jan 25, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-32304: Fix distutils upload for sdists ending with \x0d (GH-5264)
Patch by Bo Bayles.
parent
9a97c496
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
2 deletions
+26
-2
command/upload.py
command/upload.py
+0
-2
tests/test_upload.py
tests/test_upload.py
+26
-0
No files found.
command/upload.py
View file @
b3168e5e
...
...
@@ -159,8 +159,6 @@ class upload(PyPIRCCommand):
body
.
write
(
title
.
encode
(
'utf-8'
))
body
.
write
(
b"
\
r
\
n
\
r
\
n
"
)
body
.
write
(
value
)
if
value
and
value
[
-
1
:]
==
b'
\
r
'
:
body
.
write
(
b'
\
n
'
)
# write an extra newline (lurve Macs)
body
.
write
(
end_boundary
)
body
=
body
.
getvalue
()
...
...
tests/test_upload.py
View file @
b3168e5e
...
...
@@ -143,6 +143,32 @@ class uploadTestCase(BasePyPIRCCommandTestCase):
results
=
self
.
get_logs
(
INFO
)
self
.
assertEqual
(
results
[
-
1
],
75
*
'-'
+
'
\
n
xyzzy
\
n
'
+
75
*
'-'
)
# bpo-32304: archives whose last byte was b'\r' were corrupted due to
# normalization intended for Mac OS 9.
def
test_upload_correct_cr
(
self
):
# content that ends with \r should not be modified.
tmp
=
self
.
mkdtemp
()
path
=
os
.
path
.
join
(
tmp
,
'xxx'
)
self
.
write_file
(
path
,
content
=
'yy
\
r
'
)
command
,
pyversion
,
filename
=
'xxx'
,
'2.6'
,
path
dist_files
=
[(
command
,
pyversion
,
filename
)]
self
.
write_file
(
self
.
rc
,
PYPIRC_LONG_PASSWORD
)
# other fields that ended with \r used to be modified, now are
# preserved.
pkg_dir
,
dist
=
self
.
create_dist
(
dist_files
=
dist_files
,
description
=
'long description
\
r
'
)
cmd
=
upload
(
dist
)
cmd
.
show_response
=
1
cmd
.
ensure_finalized
()
cmd
.
run
()
headers
=
dict
(
self
.
last_open
.
req
.
headers
)
self
.
assertEqual
(
headers
[
'Content-length'
],
'2172'
)
self
.
assertIn
(
b'long description
\
r
'
,
self
.
last_open
.
req
.
data
)
def
test_upload_fails
(
self
):
self
.
next_msg
=
"Not Found"
self
.
next_code
=
404
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment