Bug #3696
md_to_c.py requires python 2
100%
Description
The file support/doc/md_to_c.py has shebang "#!/usr/bin/env python". On Arch Linux and some other distributions, this points to python 3. This causes a build failure:
Markdown: docs/markdown/before_begin.md Markdown: docs/markdown/install_tvheadend.md Markdown: docs/markdown/install_hardware.md Markdown: docs/markdown/configure_tvheadend.md Markdown: docs/markdown/epg.md Traceback (most recent call last): File "support/doc/md_to_c.py", line 403, in <module> text = fp.read(1024*1024*2) File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 961: ordinal not in range(128) Makefile:671: recipe for target '/build/tvheadend-git/src/tvheadend-git/build.linux/docs-timestamp' failed
Changing the shebang to "#!/usr/bin/env python2" causes the file to run with python 2 and fixes the build. I believe this should work for any distribution that now defaults to python 3 and still has 2 installed.
History
Updated by Daniel Ziemba over 8 years ago
That fixed one problem, but exposed another:
Markdown: docs/markdown/before_begin.md Markdown: docs/markdown/install_tvheadend.md Markdown: docs/markdown/install_hardware.md Markdown: docs/markdown/configure_tvheadend.md Traceback (most recent call last): File "support/doc/md_to_c.py", line 418, in <module> print('const char *' + name + '[] = {\n' + text + '\nNULL\n};\n'); UnicodeEncodeError: 'ascii' codec can't encode character '\u2713' in position 7644: ordinal not in range(128) Makefile:671: recipe for target '/build/tvheadend-git/src/tvheadend-git/build.linux/docs-timestamp' failed
Updated by Daniel Ziemba over 8 years ago
Actually maybe the above isn't a problem. I have been building in a clean chroot on Arch Linux, and I just found that this is messing up the python output encoding. I added
print(sys.stdout.encoding, file=sys.stderr)before line 418 and it outputs "ANSI_X3.4-1968", but running the build normally works fine and outputs "UTF-8". If I set PYTHONIOENCODING="UTF-8", then the build works fine even in chroot.
Updated by Jaroslav Kysela over 8 years ago
- Status changed from New to Fixed
- % Done changed from 0 to 100
Applied in changeset commit:tvheadend|a4afbee17731a55cba8426aac1cd5197d9c5595b.
Updated by Jaroslav Kysela over 8 years ago
Thanks. I'm forcing UTF-8 using the environment variable defined in Makefile as for other python scripts. Fixed in v4.1-1832-ga4afbee.