diff --git a/SConstruct b/SConstruct index 6c5e2d5ee..daf25e1ca 100644 --- a/SConstruct +++ b/SConstruct @@ -929,7 +929,12 @@ if env['python_package'] in ('full','default','new'): # See http://pypi.python.org/pypi/3to2 if env['python_package'] == 'new': try: - ret = getCommandOutput('3to2','-l') + if env['OS'] == 'Windows': + python_dir = os.path.dirname(which(env['python_cmd'])) + threetotwo_cmd = pjoin(python_dir, 'Scripts', '3to2') + ret = getCommandOutput(env['python_cmd'], threetotwo_cmd, '-l') + else: + ret = getCommandOutput('3to2', '-l') except OSError: ret = '' if 'print' in ret: diff --git a/interfaces/cython/SConscript b/interfaces/cython/SConscript index e3cf7e28e..c5f96adb1 100644 --- a/interfaces/cython/SConscript +++ b/interfaces/cython/SConscript @@ -213,7 +213,14 @@ if localenv['python_package'] == 'new': if env['python_convert_examples']: def convert_example(target, source, env): shutil.copyfile(source[0].abspath, target[0].abspath) - subprocess.call(['3to2', '--no-diff', '-n', '-w','-x', 'str', + if env['OS'] == 'Windows': + python_dir = os.path.dirname(which(env['python_cmd'])) + threetotwo_cmd = pjoin(python_dir, 'Scripts', '3to2') + subprocess.call([env['python_cmd'], threetotwo_cmd, '--no-diff', '-n', '-w','-x', 'str', + '-f', 'all', '-f', 'printfunction', '-x', 'print', + '-x', 'open', target[0].abspath]) + else: + subprocess.call(['3to2', '--no-diff', '-n', '-w','-x', 'str', '-f', 'all', '-f', 'printfunction', '-x', 'print', '-x', 'open', target[0].abspath])