PageRenderTime 81ms CodeModel.GetById 40ms app.highlight 6ms RepoModel.GetById 34ms app.codeStats 0ms

/thirdparty/liblastfm2/admin/utils.rb

http://github.com/tomahawk-player/tomahawk
Ruby | 34 lines | 28 code | 6 blank | 0 comment | 7 complexity | ed8d3721731bbfa2c181a40b4de296e3 MD5 | raw file
 1cwd = File.dirname( __FILE__ )
 2
 3def h(s, n)
 4    puts '==> '+s
 5end
 6
 7def h1 s
 8    h(s, 34)
 9end
10
11def h2 s
12    h(s, 33)
13    yield
14end
15
16def qmake_env(env, qenv)
17  env=Array.new(1,env) if env.instance_of? String
18  values=Array.new
19  env.each { |x| values << ENV[x] if ENV[x] }
20  if values.size > 0
21    "#{qenv} = #{values.join(' ')}\n"
22  else
23    nil
24  end
25end
26
27class PkgConfigNotFound < RuntimeError; end
28class PkgNotFound < RuntimeError; end
29
30def pkgconfig pkg, prettyname
31  system "pkg-config --exists '#{pkg}'"
32  raise PkgConfigNotFound if $? == 127
33  raise PkgNotFound.new(prettyname) if $? != 0
34end