Skip to content

Commit

Permalink
Bug 844509 - Always encode config.status as utf-8. r=nalexander
Browse files Browse the repository at this point in the history
Now that there is no bytes strings in it, we don't need to store
config.status in the system encoding to keep those valid. Moreover, the
system encoding is lossy, which utf-8 is not.

Differential Revision: https://phabricator.services.mozilla.com/D42731
  • Loading branch information
glandium committed Aug 21, 2019
1 parent d2207bc commit c83adc7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from mozbuild.backend.configenvironment import PartialConfigEnvironment
from mozbuild.util import (
indented_repr,
system_encoding,
)
import mozpack.path as mozpath
import six
Expand Down Expand Up @@ -102,12 +101,12 @@ def sanitized_bools(v):
# here, when we're able to skip configure tests/use cached results/not rely
# on autoconf.
logging.getLogger('moz.configure').info('Creating config.status')
with codecs.open('config.status', 'w', system_encoding) as fh:
with codecs.open('config.status', 'w', 'utf-8') as fh:
fh.write(textwrap.dedent('''\
#!%(python)s
# coding=%(encoding)s
# coding=utf-8
from __future__ import unicode_literals
''') % {'python': config['PYTHON'], 'encoding': system_encoding})
''') % {'python': config['PYTHON']})
for k, v in six.iteritems(sanitized_config):
fh.write('%s = %s\n' % (k, indented_repr(v)))
fh.write("__all__ = ['topobjdir', 'topsrcdir', 'defines', "
Expand Down

0 comments on commit c83adc7

Please sign in to comment.