From b05913bf152367efa4e89130c63267d5c0a842b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eray=20=C3=96zkural?= Date: Wed, 10 Aug 2005 12:10:54 +0000 Subject: [PATCH] * revert: advanced getBInutilsInfo function * TODO: incorporate the CC=mycc config. thing into this stuff * fix: get rid of mutual module import silliness (my bad) * make beta-light run on non-gentoo systems again. --- pisi/actionsapi/get.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/pisi/actionsapi/get.py b/pisi/actionsapi/get.py index 3741212c..dfd3345a 100644 --- a/pisi/actionsapi/get.py +++ b/pisi/actionsapi/get.py @@ -89,8 +89,29 @@ def defaultprefixDIR(): # Binutils Variables -def getBinutilsInfo(needed): - return '%s-%s' % (HOST(), needed) +def exists_binary(bin): + # determine if path has binary + path = os.environ['PATH'].split(':') + for directory in path: + if os.path.exists(os.path.join(directory, bin) ): + return True + return False + +class BinutilsError: + pass + +def getBinutilsInfo(util): + cross_build_name = '%s-%s' % (HOST(), util) + if not exists_binary(cross_build_name): + if not exists_binary(util): + #ui.error('Error: util %s cannot be found' % util) + raise BinutilsError('util %s cannot be found' % util) + else: + ui.debug('Warning: %s does not exist, using plain name %s' + % (cross_build_name, util)) + return util + else: + return cross_build_name def AR(): return getBinutilsInfo('ar')