[PyQt] pyqt does not find phonon (from kde.org) at build time

linux fan linuxscratch at gmail.com
Sat Apr 17 15:52:28 BST 2010


PyQt fails to use non-qt, externally installed phonon preferred by KDE4 .

Attachment (perl script) adds external phonon's include_dirs and
lib_dirs when phonon is built to KDE4 specs with qt -no-phonon and
external phonon.

(why configure.py cannot do itself?)
(configure.py acts hard-coded that it is in qt dir)
-------------- next part --------------
#!/usr/bin/perl

# USAGE: perl -i [path_to]PyQt-KDE-phonon.pl configure.py

# This adds external phonon's include_dirs and lib_dirs
# when phonon built to KDE4 specs with qt -no-phonon and external phonon
# (why configure.py cannot do itself?)
# (configure.py acts hard-coded that it is in qt dir)

$PHONON_PREFIX = "";
$sys_cmd = 'pkg-config --variable=prefix phonon';
if (open(SYS_CMD, "$sys_cmd |")) {
  while (<SYS_CMD>) {
    chomp;
    $PHONON_PREFIX = $_;
    last;
  }
}

$eid_eld = "";
if ($PHONON_PREFIX ne "") {
  if ($PHONON_PREFIX =~ m@/usr@) {
    $eid_eld = ", extra_include_dirs=[\"${PHONON_PREFIX}/include/phonon\"]\)";
  }
  elsif ($PHONON_PREFIX !~ m@/qt@) {
    $eid_eld = ", extra_include_dirs=[\"${PHONON_PREFIX}/include\", \"${PHONON_PREFIX}/include/phonon\"], extra_lib_dirs=[\"${PHONON_PREFIX}/lib\"]\)";
  }
}

while (<>) {
  if ($eid_eld ne "") {
    $_ =~ s@^(\s+"new Phonon::VideoWidget\(\))"\)@$1"$eid_eld@;
    $_ =~ s@^(\s+generate_code\("phonon")\)$@$1$eid_eld@;
  }
  print
}


More information about the PyQt mailing list