test_distutils fails when python is Python 3
test_distutils (tests.test_main.EndToEndTest) ... /home/lantw44/gnome/source/jhbuild/jhbuild/frontends/terminal.py:111: ResourceWarning: unclosed file <_io.TextIOWrapper name='/dev/null' mode='w' encoding='UTF-8'>
buildscript.BuildScript.__init__(self, config, module_list, module_set=module_set)
/home/lantw44/gnome/source/jhbuild/jhbuild/modtypes/distutils.py:64: ResourceWarning: unclosed file <_io.BufferedWriter name=6>
buildscript.execute(cmd, cwd = srcdir, extra_env = self.extra_env)
/home/lantw44/gnome/source/jhbuild/jhbuild/modtypes/distutils.py:79: ResourceWarning: unclosed file <_io.BufferedWriter name=6>
buildscript.execute(cmd, cwd = srcdir, extra_env = self.extra_env)
File "/tmp/unittest-otdx3nvi/prefix/bin/hello", line 3
print "Hello world (distutils)"
^
SyntaxError: invalid syntax
FAIL
======================================================================
FAIL: test_distutils (tests.test_main.EndToEndTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/lantw44/gnome/source/jhbuild/tests/test_main.py", line 692, in test_distutils
self.assertEqual(stdout.strip(), b'Hello world (distutils)')
AssertionError: b'' != b'Hello world (distutils)'
----------------------------------------------------------------------
Since jhbuild/modtypes/distutils.py
defaults to python
when neither PYTHON
environment variable nor python3
attribute is set, there is no way to explicitly choose Python 2 for building a module. If your system uses Python 3 as the default python
executable, test_distutils
fails because tests/distutils/hello
only works with Python 2.