mirror of
https://github.com/saltstack/salt.git
synced 2025-04-15 09:10:20 +00:00
setup.py: Work around bad code in distutils
While running an sdist, distutils logs when it creates paths. However, if the paths are unicode _and_ contain unicode code points, the log message results in a `UnicodeEncodeError` as distutils attempts to perform string replacement using a str format string and a unicode path. Paths recently added in the test suite's files to test unicode compatibility have caused this issue to surface. This fixes the resulting traceback by ensuring that Python 2 only passes utf-8 encoded bytestrings when making the release tree.
This commit is contained in:
parent
d72cf1dd6f
commit
61b90bc4bf
1 changed files with 5 additions and 2 deletions
7
setup.py
7
setup.py
|
@ -522,8 +522,11 @@ class Sdist(sdist):
|
|||
self.run_command('write_salt_ssh_packaging_file')
|
||||
self.filelist.files.append(os.path.basename(PACKAGED_FOR_SALT_SSH_FILE))
|
||||
|
||||
pkgfiles = [pkgfile if IS_PY3 else pkgfile.decode(__salt_system_encoding__) for pkgfile in files]
|
||||
sdist.make_release_tree(self, base_dir, pkgfiles)
|
||||
if not IS_PY3 and isinstance(base_dir, unicode): # pylint: disable=incompatible-py3-code
|
||||
# Work around some bad code in distutils which logs unicode paths
|
||||
# against a str format string.
|
||||
base_dir = base_dir.encode('utf-8')
|
||||
sdist.make_release_tree(self, base_dir, files)
|
||||
|
||||
# Let's generate salt/_version.py to include in the sdist tarball
|
||||
self.distribution.running_salt_sdist = True
|
||||
|
|
Loading…
Add table
Reference in a new issue