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
36addf1e
Commit
36addf1e
authored
May 03, 2014
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Monkey-patch the write_pkg_info method on Python 3.1 DistributionMetadata. Fixes #197
parent
9551d30e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
CHANGES.txt
CHANGES.txt
+7
-0
setuptools/dist.py
setuptools/dist.py
+21
-0
No files found.
CHANGES.txt
View file @
36addf1e
...
...
@@ -2,6 +2,13 @@
CHANGES
=======
---
3.5
---
* Issue #197: On Python 3.1, PKG-INFO is now saved in a UTF-8 encoding instead
of ``sys.getpreferredencoding`` to match the behavior on Python 2.6-3.4.
-----
3.4.4
-----
...
...
setuptools/dist.py
View file @
36addf1e
...
...
@@ -7,6 +7,7 @@ import warnings
import
distutils.log
import
distutils.core
import
distutils.cmd
import
distutils.dist
from
distutils.core
import
Distribution
as
_Distribution
from
distutils.errors
import
(
DistutilsOptionError
,
DistutilsPlatformError
,
DistutilsSetupError
)
...
...
@@ -31,6 +32,26 @@ def _get_unpatched(cls):
_Distribution
=
_get_unpatched
(
_Distribution
)
def
_patch_distribution_metadata_write_pkg_info
():
"""
Workaround issue #197 - Python 3.1 uses an environment-local encoding to
save the pkg_info. Monkey-patch its write_pkg_info method to correct
this undesirable behavior.
"""
if
sys
.
version_info
[:
2
]
!=
(
3
,
1
):
return
# from Python 3.4
def
write_pkg_info
(
self
,
base_dir
):
"""Write the PKG-INFO file into the release tree.
"""
with
open
(
os
.
path
.
join
(
base_dir
,
'PKG-INFO'
),
'w'
,
encoding
=
'UTF-8'
)
as
pkg_info
:
self
.
write_pkg_file
(
pkg_info
)
distutils
.
dist
.
DistributionMetadata
.
write_pkg_info
=
write_pkg_info
_patch_distribution_metadata_write_pkg_info
()
sequence
=
tuple
,
list
def
check_importable
(
dist
,
attr
,
value
):
...
...
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