diff --git a/SConstruct b/SConstruct index 44c51845e..4ae10c37d 100644 --- a/SConstruct +++ b/SConstruct @@ -948,7 +948,12 @@ if env['python_package'] in ('full','default'): # Check for 3to2. See http://pypi.python.org/pypi/3to2 if env['python_package'] == 'full': 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 038e38582..cbf9f4a75 100644 --- a/interfaces/cython/SConscript +++ b/interfaces/cython/SConscript @@ -170,7 +170,14 @@ if localenv['python_package'] == 'full': 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])