def get_make(self, _cache=[]): """ Return the path of the make binary. """ # the cache is not for performance but to return a consistent value # even if the cwd is changed if _cache: return _cache[0] make = self.opts.make if os.path.split(make)[0]: # At least a relative dir specified. if not os.path.exists(make): raise PgxnClientException( _("make executable not found: %s") % make ) # Convert to abs path to be robust in case the dir is changed. make = os.path.abspath(make) else: # we don't find make here and convert to abs path because it's a # security hole: make may be run under sudo and in this case we # don't want root to execute a make hacked in an user local dir if not find_executable(make): raise PgxnClientException( _("make executable not found: %s") % make ) _cache.append(make) return make
def get_make(self, _cache=[]): """ Return the path of the make binary. """ # the cache is not for performance but to return a consistent value # even if the cwd is changed if _cache: return _cache[0] make = self.opts.make if os.path.split(make)[0]: # At least a relative dir specified. if not os.path.exists(make): raise PgxnClientException(_("make executable not found: %s") % make) # Convert to abs path to be robust in case the dir is changed. make = os.path.abspath(make) else: # we don't find make here and convert to abs path because it's a # security hole: make may be run under sudo and in this case we # don't want root to execute a make hacked in an user local dir if not find_executable(make): raise PgxnClientException(_("make executable not found: %s") % make) _cache.append(make) return make
def _find_default_make(self): for make in ('gmake', 'make'): path = find_executable(make) if path: return make # if nothing was found, fall back on 'gmake'. If it was missing we # will give an error when attempting to use it return 'gmake'
def get_pg_config(self): """ Return the absolute path of the pg_config binary. """ pg_config = self.opts.pg_config if os.path.split(pg_config)[0]: pg_config = os.path.abspath(pg_config) else: pg_config = find_executable(pg_config) if not pg_config: raise PgxnClientException(_("pg_config executable not found")) return pg_config