summaryrefslogtreecommitdiff
path: root/site_scons
diff options
context:
space:
mode:
authorDaniel Burrows <dburrows@debian.org>2010-04-26 09:17:23 -0700
committerDaniel Burrows <dburrows@debian.org>2010-04-26 09:17:23 -0700
commit1f2ad8cdb7d0e370a52d914a48b5afa1c7614e3f (patch)
tree277c3d6f807c3bb09ae94440463fdf552ba9b0a8 /site_scons
parent952c77a975ab125b82650422ac81f71923f7bbd5 (diff)
downloadaptitude-1f2ad8cdb7d0e370a52d914a48b5afa1c7614e3f.tar.gz
Make CheckForExecutable() automatically add an option to override the executable location.
Diffstat (limited to 'site_scons')
-rw-r--r--site_scons/aptitude_configure_checks.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/site_scons/aptitude_configure_checks.py b/site_scons/aptitude_configure_checks.py
index a246e059..4d8c1b62 100644
--- a/site_scons/aptitude_configure_checks.py
+++ b/site_scons/aptitude_configure_checks.py
@@ -15,6 +15,7 @@
# Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
# MA 02111-1307, USA.
+from SCons.Script import AddOption, GetOption
import SCons.Script
# Custom configure checks for aptitude and the code to register and
@@ -120,13 +121,20 @@ def TryInclude(d):
return ("In %s" % d, { 'CPPPATH' : [ d ] })
@RegisterCheck
-def CheckForExecutable(context, filename, var):
+def CheckForExecutable(context, filename, var, help = None):
"""Look for the given filename in $PATH. If var is set in the
environment, use its value; otherwise find the program and set var to
its absolute path."""
context.Message("Checking for %s..." % filename)
- location = context.env.get(var)
+ AddOption('--with-%s' % filename,
+ dest = 'check_for_%s' % filename,
+ nargs = 1,
+ type = 'string', action = 'store',
+ metavar = 'DIR',
+ default = context.env.get(var),
+ help = help or 'set the path to %s' % filename)
+ location = GetOption('check_for_%s' % filename)
if location is None:
location = context.env.WhereIs(filename)