Skip to content

Commit 03f0cbc

Browse files
committed
backend_driver is more selective with unicode_literals
1 parent a800631 commit 03f0cbc

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

examples/tests/backend_driver.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,16 +347,16 @@ def drive(backend, directories, python=['python'], switches = []):
347347
tmpfile_name = '_tmp_%s.py' % basename
348348
tmpfile = open(tmpfile_name, 'w')
349349

350+
future_imports = 'from __future__ import division, print_function'
350351
for line in open(fullpath):
351352
line_lstrip = line.lstrip()
352353
if line_lstrip.startswith("#"):
353354
tmpfile.write(line)
354-
else:
355-
break
355+
elif 'unicode_literals' in line:
356+
future_imports = future_imports + ', unicode_literals'
356357

357358
tmpfile.writelines((
358-
'from __future__ import (',
359-
' division, print_function, unicode_literals)\n',
359+
future_imports+'\n',
360360
'import sys\n',
361361
'sys.path.append("%s")\n' % fpath.replace('\\', '\\\\'),
362362
'import matplotlib\n',

0 commit comments

Comments
 (0)