pyside_aur / pyside-tools / PKGBUILD

# Maintainer: arlx_ignacy <ziphims@gmail.com>
# Contributor: Matthias Maennich <arch@maennich.net>
# Contributor: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>


# modify this to whatever Python 2 interpreter you're targetting; on my
# system I use the vanilla python2
_py2exec=$(which python2)
# modify this to whatever Python 3 interpreter you're targetting; on my
# system I use the vanilla python3
_py3exec=$(which python3)

pkgbase=pyside-tools
pkgname=('python2-pyside-tools' 'python-pyside-tools' 'pyside-tools')
pkgver=0.2.14
pkgrel=1
arch=('i686' 'x86_64')
license=('LGPL')
url="http://www.pyside.org"
depends=('python-pyside>=1.1.2')
makedepends=('cmake' 'automoc4' 'python-shiboken>=1.1.2')
replaces=('pyside-tools-py3')
source=("https://distfiles.macports.org/py-pyside-tools/pyside-tools-$pkgver.tar.bz2"
        'py3build.patch')
md5sums=('0a683e1dc426df5834cb1e540d0c6e3f'
         '02003622eeeebb9ce302375dce05dc05')

build() {
    echo ""
}

package_python-pyside-tools() {
    if [ "$_py3exec" != "" ]; then
        depends=('pyside-tools')
        makedepends=('patch' 'sed' 'findutils')
        pkgdesc='PySide development tools for Python 3.'

        echo "Applying python 3 patch ..."
        cd "$srcdir/pyside-tools-$pkgver"
        patch -p1 < ../py3build.patch
        # of course, if you want to undo the patch you can use:
        #  $ patch -p1 -R < ../py3build.patch

        if [ -d "$srcdir/build" ]; then
            rm -r "$srcdir/build"
        fi
        mkdir -p "$srcdir/build"

        cd "$srcdir/build"
        cmake ../pyside-tools-$pkgver -DBUILD_TESTS=False           \
                                      -DCMAKE_BUILD_TYPE=Release    \
                                      -DCMAKE_INSTALL_PREFIX=/usr   \
                                      -DPYTHON_EXECUTABLE=$_py3exec
        make DESTDIR="$pkgdir" install

        cd "$pkgdir/usr/bin"
        sed -i -e "1c #!$_py3exec" pyside-uic
        mv pyside-uic pyside-uic-python3
        ln -sf pyside-uic-python3 pyside-uic
        mv pyside-rcc pyside-rcc-python3
        ln -sf pyside-rcc-python3 pyside-rcc

        # remove unused file
        rm "$pkgdir/usr/bin/pyside-lupdate"
        cd "$pkgdir/usr/share/man"
        find -type f -iname "pyside-lupdate*" -delete
        for fname in $(find -type f -iname "pyside-rcc*"); do
            mv "$fname" "${fname/-rcc/-rcc-python3}"
        done
        for fname in $(find -type f -iname "pyside-uic*"); do
            mv "$fname" "${fname/-uic/-uic-python3}"
        done
    fi
}

package_python2-pyside-tools() {
    if [ "$_py2exec" != "" ]; then
        depends=('pyside-tools')
        makedepends=('sed' 'findutils')
        pkgdesc='PySide development tools for Python 2.'

        if [ -d "$srcdir/build" ]; then
            rm -r "$srcdir/build"
        fi
        mkdir -p "$srcdir/build"

        cd "$srcdir/build"
        cmake ../pyside-tools-$pkgver -DBUILD_TESTS=False           \
                                      -DCMAKE_BUILD_TYPE=Release    \
                                      -DCMAKE_INSTALL_PREFIX=/usr   \
                                      -DPYTHON_EXECUTABLE=$_py2exec
        make DESTDIR="$pkgdir" install

        cd "$pkgdir/usr/bin"
        sed -i -e "1c #!$_py2exec" pyside-uic
        mv pyside-uic pyside-uic-python2
        mv pyside-rcc pyside-rcc-python2

        # remove unused file
        rm "$pkgdir/usr/bin/pyside-lupdate"
        cd "$pkgdir/usr/share/man"
        find -type f -iname "pyside-lupdate*" -delete
        for fname in $(find -type f -iname "pyside-rcc*"); do
            mv "$fname" "${fname/-rcc/-rcc-python2}"
        done
        for fname in $(find -type f -iname "pyside-uic*"); do
            mv "$fname" "${fname/-uic/-uic-python2}"
        done
    fi
}

package_pyside-tools() {
    pkgdesc='PySide development tools.'
    makedepends=('findutils')

    if [ -d "$srcdir/build" ]; then
        rm -r "$srcdir/build"
    fi
    mkdir -p "$srcdir/build"

    cd "$srcdir/build"
    cmake ../pyside-tools-$pkgver -DBUILD_TESTS=False         \
                                  -DCMAKE_BUILD_TYPE=Release  \
                                  -DCMAKE_INSTALL_PREFIX=/usr
    make DESTDIR="$pkgdir" install

    # remove unused files
    cd "$pkgdir/usr"
    rm -r lib
    cd "$pkgdir/usr/bin"
    rm -r pyside-uic pyside-rcc
    cd "$pkgdir/usr/share/man"
    find -type f -iname "pyside-uic*" -delete
    find -type f -iname "pyside-rcc*" -delete
}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.