[PATCH] py3: write out hgextindex as bytes in setup.py
Matt Harbison
mharbison72 at gmail.com
Fri Apr 5 22:38:54 UTC 2019
# HG changeset patch
# User Matt Harbison <matt_harbison at yahoo.com>
# Date 1554503803 14400
# Fri Apr 05 18:36:43 2019 -0400
# Node ID d8aef987cc88a5abead0c9cecf5e14066f161968
# Parent a975821d0938615b8cb235f12cc6461a42dcfbd8
py3: write out hgextindex as bytes in setup.py
I hit this trying to build the py2exe target using python3, just to see what
would happen. After commenting out `py2exe.Distribution` in setup.py and
pointing to a local copy of py2exe that supports python3[1], it complained that
`out` was bytes, not str.
[1] https://github.com/albertosottile/py2exe/releases/tag/v0.9.3.0
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -583,9 +583,9 @@ class buildhgextindex(Command):
if err or returncode != 0:
raise DistutilsExecError(err)
- with open(self._indexfilename, 'w') as f:
- f.write('# this file is autogenerated by setup.py\n')
- f.write('docs = ')
+ with open(self._indexfilename, 'wb') as f:
+ f.write(b'# this file is autogenerated by setup.py\n')
+ f.write(b'docs = ')
f.write(out)
class buildhgexe(build_ext):
More information about the Mercurial-devel
mailing list