Skip to content

Commit

Permalink
[SCons] Use python3_array_home option
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanwweber authored and speth committed Nov 12, 2016
1 parent 170f1d0 commit adcd5de
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ config_options = [
PathVariable(
'python3_array_home',
""""If numpy was installed to a custom location (e.g. using the --home
option, set this to the directory for numpy.""",
option), set this to the directory for numpy.""",
'', PathVariable.PathAccept),
PathVariable(
'python3_prefix',
Expand Down Expand Up @@ -1097,12 +1097,16 @@ if env['python3_package'] in ('y', 'default'):
try:
script = '\n'.join(("from distutils.sysconfig import *",
"import site",
"import numpy",
"import numpy",
"print(get_python_version())",
"try:",
" print(site.getusersitepackages())",
"except AttributeError:",
" print(site.USER_SITE)"))

if env['python3_array_home']:
script = "sys.path.append({})\n".format(env['python3_array_home']) + script

info = getCommandOutput(env['python3_cmd'], '-c', script)
(env['python3_version'],
env['python3_usersitepackages']) = info.splitlines()[-2:]
Expand All @@ -1119,7 +1123,8 @@ if env['python3_package'] in ('y', 'default'):
'(e.g. numpy) was not found.' % env['python3_cmd'])
env['python3_package'] = 'n'
else:
print ('ERROR: Could not execute the Python 3 interpreter %r.' %
print ('ERROR: Could not execute the Python 3 interpreter %r or a '
'required dependency (e.g. numpy) could not be found.' %
env['python3_cmd'])
sys.exit(1)
else:
Expand Down

0 comments on commit adcd5de

Please sign in to comment.