/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

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