LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 03-12-2014, 10:38 AM   #1
rshepard
Member
 
Registered: Oct 2007
Location: Troutdale, Oregon
Distribution: Slackware
Posts: 130

Rep: Reputation: 15
PyQt for Python3?


PyQt-4.9.6 is installed with the -14.1 upgrade. I assume that it's built against Python-2.8.12.1 since that's the version installed.

I have a tool I use in which the latest version was built against Python3. I installed python3-3.3.3 and would like to learn how to buid a PyQt3 against that python version.

Your guidance and advice appreciated.

Rich
 
Old 03-12-2014, 12:22 PM   #2
tux_dude
Member
 
Registered: Dec 2008
Distribution: Slackware64 Current
Posts: 226

Rep: Reputation: 33
PyQt should build against whichever python version you have installed. Check the build script on the Slackware source repository for direction.
 
Old 03-12-2014, 05:05 PM   #3
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Ruhr Area, Germany
Distribution: Slackware64 14.0
Posts: 1,517

Rep: Reputation: 90
From memory I did the following steps. There might be traps I don't remember, but it works here

1. If you haven't done it yet, get the source folders for "sip" and "PyQt" from the Slackware DVD or a Slackware mirror.
2. Compile and install python3 from www.slackbuilds.org
3. Recompile sip, replace all occurances of "python" (as an executable command) to "python3". I think I had to compile and install it twice, else some files were missing from the (first) package.
4. Change PyQt SlackBuild and eventually the slack-desc to point it to python3. Since you want to keep it installed and not overwrite the original PyQt package, name it something like Py3Qt. There are more places in the SlackBuild where it has to be replaced if I remember correctly. Please notice that at the beginning of the SlackBuild there is a line with "python" and "print". Make sure to put "python3" there and put the argument of "print" in parentheses, because python3 requires that.
5. I uninstalled the python3-sip and reinstalled the original one.

I managed to include both PyQt for python2 and for python3 in one package. I tried the same with sip which failed. Don't know why and I was not keen enough to try it again and again. That's the reason I later removed the sip that was configured by python3 and replaced with the original one. The program that I need it for is still working and I'm absolutely not sure what would happen else

Good luck with it and have fun compiling

Last edited by titopoquito; 03-12-2014 at 05:23 PM. Reason: typo
 
1 members found this post helpful.
Old 03-14-2014, 10:44 AM   #4
rshepard
Member
 
Registered: Oct 2007
Location: Troutdale, Oregon
Distribution: Slackware
Posts: 130

Original Poster
Rep: Reputation: 15
@tux_dude: I have both python-2.7.5 and python3-3.3.3 installed. I'd like to have PyQt for both versions, too.

@titopoquito: I tried your approach without success. Will try again later. I changed the PRGNAME to Py3QT, and the .xz file to reflect that change, and the SlackBuild script responds that it cannot find the file with that name. While I went through the script I did not see any reference to PyQt of python that I had not changed to Py3Qt and python3.

Thanks, both of you. I'll let you know how it goes from here.

Rich
 
Old 03-14-2014, 10:48 AM   #5
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Ruhr Area, Germany
Distribution: Slackware64 14.0
Posts: 1,517

Rep: Reputation: 90
tar xvf ... and maybe the next line (cd ...) are the culprits I think.
 
Old 03-16-2014, 06:58 AM   #6
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Ruhr Area, Germany
Distribution: Slackware64 14.0
Posts: 1,517

Rep: Reputation: 90
I cannot set up a virtual build box right now, but the following SlackBuilds should work. Like I said, AFAIR I had to run the sip SlackBuild twice, but I cannot test now if it was my fault or if it works with one run, too.

sip.SlackBuild
Code:
#!/bin/sh

# Copyright 2008  Aleksandar Samardzic <asamardzic@gmail.com>
# Copyright 2008, 2009, 2010, 2011  Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Modified by Robby Workman <rworkman@slackware.com>
# Modified by Eric Hameleers <alien@slackware.com>


PKGNAM=sip
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
BUILD=${BUILD:-1_python2and3}

NUMJOBS=${NUMJOBS:--j3}

# Automatically determine the architecture we're building on:
MARCH=$( uname -m )
if [ -z "$ARCH" ]; then
  case "$MARCH" in
    i?86)    export ARCH=i486 ;;
    armv7hl) export ARCH=$MARCH ;;
    arm*)    export ARCH=arm ;;
    # Unless $ARCH is already set, use uname -m for all other archs:
    *)       export ARCH=$MARCH ;;
  esac
fi

if [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
elif [ "$ARCH" = "armv7hl" ]; then
  SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16"
else
  SLKCFLAGS="-O2"
fi

CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-$PKGNAM

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PKGNAM-$VERSION
tar xvf $CWD/$PKGNAM-$VERSION.tar.?z* || exit 1
cd $PKGNAM-$VERSION || exit 1
chown -R root:root .
find . \
 \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
 -exec chmod 755 {} \; -o \
 \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
 -exec chmod 644 {} \;

PYTHONVER=$(python2 -V 2>&1 | cut -f 2 -d' ' | cut -f 1-2 -d.)
PYTHONLIB=$( python2 -c 'from distutils.sysconfig import get_python_lib; print get_python_lib()' )

python configure.py \
  -b "/usr/bin" \
  -d "$PYTHONLIB" \
  -e "/usr/include/python$PYTHONVER" \
  CFLAGS="$SLKCFLAGS" \
  CXXFLAGS="$SLKCFLAGS"

make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1

cd $TMP
rm -rf $PKGNAM-$VERSION
tar xvf $CWD/$PKGNAM-$VERSION.tar.?z* || exit 1
cd $PKGNAM-$VERSION || exit 1
chown -R root:root .
find . \
 \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
 -exec chmod 755 {} \; -o \
 \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
 -exec chmod 644 {} \;

PYTHONVER=$(python3 -V 2>&1 | cut -f 2 -d' ' | cut -f 1-2 -d.)
PYTHONLIB=$( python3 -c 'from distutils.sysconfig import get_python_lib; print (get_python_lib())' )

python3 configure.py \
  -b "/usr/bin" \
  -d "$PYTHONLIB" \
  -e "/usr/include/python$PYTHONVER" \
  CFLAGS="$SLKCFLAGS" \
  CXXFLAGS="$SLKCFLAGS"

make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1

find $PKG | xargs file | grep -e "executable" -e "shared object" \
  | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null

mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
cp -a \
  LICENSE COPYING* NEWS README TODO doc/* \
  $PKG/usr/doc/$PKGNAM-$VERSION
chown -R root:root $PKG/usr/doc

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c n $TMP/$PKGNAM-$(echo $VERSION |tr - _)-$ARCH-$BUILD.txz
PyQt.SlackBuild
Code:
#!/bin/sh

# Slackware build script for PyQt

# Copyright 2008  Aleksandar Samardzic <asamardzic@gmail.com>
# Copyright 2008, 2009, 2010, 2011  Patrick J. Volkerding, Sebeka, MN, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Modified by Robby Workman <rworkman@slackware.com>
# Modified by Eric Hameleers <alien@slackware.com>

PKGNAM=PyQt
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
BUILD=${BUILD:-1python2and3}

NUMJOBS=${NUMJOBS:--j3}

# Automatically determine the architecture we're building on:
MARCH=$( uname -m )
if [ -z "$ARCH" ]; then
  case "$MARCH" in
    i?86)    export ARCH=i486 ;;
    armv7hl) export ARCH=$MARCH ;;
    arm*)    export ARCH=arm ;;
    # Unless $ARCH is already set, use uname -m for all other archs:
    *)       export ARCH=$MARCH ;;
  esac
fi

CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-$PKGNAM

if [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
elif [ "$ARCH" = "armv7hl" ]; then
  SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16"
else
  SLKCFLAGS="-O2"
fi

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PKGNAM-x11-gpl-$VERSION
tar xvf $CWD/$PKGNAM-x11-gpl-$VERSION.tar.?z* || exit 1
cd $PKGNAM-x11-gpl-$VERSION || exit 1

# Fix phonon detection:
zcat $CWD/$PKGNAM.phonon.diff.gz | patch -p1 --verbose || exit 1

chown -R root:root .
find . \
 \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
 -exec chmod 755 {} \; -o \
 \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
 -exec chmod 644 {} \;

# This avoids compiling a version number into KDE's .la files:
export QTDIR=/usr/lib${LIBDIRSUFFIX}/qt

export CFLAGS="$SLKCFLAGS"
export CXXFLAGS="$SLKCFLAGS"

python configure.py --confirm-license --verbose

make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1

cd $TMP
rm -rf $PKGNAM-x11-gpl-$VERSION
tar xvf $CWD/$PKGNAM-x11-gpl-$VERSION.tar.?z* || exit 1
cd $PKGNAM-x11-gpl-$VERSION || exit 1

# Fix phonon detection:
zcat $CWD/$PKGNAM.phonon.diff.gz | patch -p1 --verbose || exit 1

chown -R root:root .
find . \
 \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
 -exec chmod 755 {} \; -o \
 \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
 -exec chmod 644 {} \;

# This avoids compiling a version number into KDE's .la files:
export QTDIR=/usr/lib${LIBDIRSUFFIX}/qt

export CFLAGS="$SLKCFLAGS"
export CXXFLAGS="$SLKCFLAGS"

python3 configure.py --confirm-license --verbose

make $NUMJOBS || make || exit 1
make install DESTDIR=$PKG || exit 1

find $PKG | xargs file | grep -e "executable" -e "shared object" \
  | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null

mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
cp -a \
  GPL_EXCEPTION*.TXT LICENSE.* NEWS OPENSOURCE-NOTICE.TXT README THANKS doc/* \
  $PKG/usr/doc/$PKGNAM-$VERSION

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c n $TMP/$PKGNAM-$(echo $VERSION |tr - _)-$ARCH-$BUILD.txz
 
1 members found this post helpful.
Old 04-22-2014, 03:02 AM   #7
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Ruhr Area, Germany
Distribution: Slackware64 14.0
Posts: 1,517

Rep: Reputation: 90
Hi Rich,

since you posted about this on the slackbuilds.org mailing list, a follow up (if it worked or which problem you encountered) would be nice, so that others searching about this have an answer as well. You marked this thread as "SOLVED", so did it work out in the end with the two SlackBuilds?
 
Old 04-22-2014, 07:38 PM   #8
rshepard
Member
 
Registered: Oct 2007
Location: Troutdale, Oregon
Distribution: Slackware
Posts: 130

Original Poster
Rep: Reputation: 15
titopoquito:

No, it did not work. I marked it 'solved' because I was not going to pursue building py3qt. However, my priorities have changed (based on starting a new Python/wxPython application and hitting all sorts of changes in the current versions of both).

I followed the INSTALL procedures for sip, specifying 'python3 configure.py'; make; make install. Running the SlackBuild script for PyQt (specifying python3 instead of python) fails with this error message:

make[2]: Entering directory /tmp/PyQt-x11-gpl-4.9.6/qpy/QtCore'
g++ -c -pipe -fno-strict-aliasing -O2 -march=i486 -mtune=i686 -fPIC -Wall -W -D_REENTRANT -DQT_DISABLE_DEPRECATED_BEFORE=0x040900 -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/lib/qt/mkspecs/linux-g++ -I. -I/usr/lib/qt/include/QtCore -I/usr/lib/qt/include/QtGui -I/usr/lib/qt/include -I/usr/include/python3.3m -I../../QtCore -I. -I. -o qpycore_chimera.o qpycore_chimera.cpp
qpycore_chimera.cpp: In member function ‘void Chimera::set_flag()’:
qpycore_chimera.cpp:552:50: error: ‘pyqt4ClassTypeDef’ has no member named ‘qt4_flags’
_is_flag = ((pyqt4ClassTypeDef *)_type)->qt4_flags & 0x01;
^
make[2]: *** [qpycore_chimera.o] Error 1
make[2]: Leaving directory /tmp/PyQt-x11-gpl-4.9.6/qpy/QtCore'
make[1]: *** [all] Error 2
make[1]: Leaving directory /tmp/PyQt-x11-gpl-4.9.6/qpy'
make: *** [all] Error 2

That's where I'm currently stuck.

Rich
 
Old 04-23-2014, 12:41 AM   #9
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Ruhr Area, Germany
Distribution: Slackware64 14.0
Posts: 1,517

Rep: Reputation: 90
Quote:
Originally Posted by rshepard View Post
titopoquito:

No, it did not work. I marked it 'solved' because I was not going to pursue building py3qt. However, my priorities have changed (based on starting a new Python/wxPython application and hitting all sorts of changes in the current versions of both).

I followed the INSTALL procedures for sip, specifying 'python3 configure.py'; make; make install. Running the SlackBuild script for PyQt (specifying python3 instead of python) fails with this error message:
You did not use the above posted SlackBuilds then? I tested them with current Python3 (3.4) and the PyQt from Slackware 14.1. I even set up a new build box yesterday to make sure they both compile fine on a stock Slackware system. Rich, could you please try with the SlackBuilds I posted on 16th of march? They worked then with Python 3.3 too, so I think that is not why you're getting the build error. And make sure there are no old python or sip packages around besides the ones from Slackware 14.1.
 
Old 04-23-2014, 03:43 AM   #10
55020
Member
 
Registered: Sep 2009
Location: Yorks. W.R. 167397
Distribution: Slackware
Posts: 347
Blog Entries: 4

Rep: Reputation: 310Reputation: 310Reputation: 310Reputation: 310
Top hit on Google for "‘pyqt4ClassTypeDef’ has no member named ‘qt4_flags’" is here, which suggests that the version of sip you used is too new for the version of PyQt you used.
 
Old 04-23-2014, 04:42 AM   #11
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Ruhr Area, Germany
Distribution: Slackware64 14.0
Posts: 1,517

Rep: Reputation: 90
Quote:
Originally Posted by 55020 View Post
Top hit on Google for "‘pyqt4ClassTypeDef’ has no member named ‘qt4_flags’" is here, which suggests that the version of sip you used is too new for the version of PyQt you used.
And to add to 55020's post the versions I used:

python3 from slackbuilds.org, currently 3.4.0 from the 14.1 repository
sip from Slackware 14.1 source folder but build with the above posted SlackBuild, version is 4.14.2
PyQt also from Slackware 14.1 source folder with the according above posted SlackBuild, version is 4.9.6
 
1 members found this post helpful.
Old 04-24-2014, 11:35 AM   #12
rshepard
Member
 
Registered: Oct 2007
Location: Troutdale, Oregon
Distribution: Slackware
Posts: 130

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by titopoquito View Post
And to add to 55020's post the versions I used:

python3 from slackbuilds.org, currently 3.4.0 from the 14.1 repository
sip from Slackware 14.1 source folder but build with the above posted SlackBuild, version is 4.14.2
PyQt also from Slackware 14.1 source folder with the according above posted SlackBuild, version is 4.9.6
Yes, I did not use the provided SlackBuild scripts and I upgraded sip from the latest source. Mea culpa!

Today I upgraded python3-3.3.3 to -3.4, re-built the -14.1 sip with your script, and rebuilt PyQt with your script. Naturally, it all worked.

Thanks for your patient help.

Rich
 
Old 04-24-2014, 01:27 PM   #13
titopoquito
Senior Member
 
Registered: Jul 2004
Location: Ruhr Area, Germany
Distribution: Slackware64 14.0
Posts: 1,517

Rep: Reputation: 90
Glad you got it worked out!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Python3 Scripting (Part 1?) LXer Syndicated Linux News 0 11-20-2013 07:20 PM
Python3 on Cygwin AsherM Linux - Newbie 6 09-14-2013 03:25 PM
[SOLVED] Python3 shelve UnicodeDecodeError vmsda Programming 2 05-03-2013 03:32 AM
[SOLVED] Python3.2 vs yum hpfeil Fedora 4 08-01-2012 10:51 AM
[SOLVED] how to run bpython with python3? saavedra29 Slackware 2 03-08-2012 07:36 PM


All times are GMT -5. The time now is 02:51 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration