On Wednesday 22 September 2010, 08:24:05 Simon Edwards wrote:
> Hello,
>
> On 09/21/2010 11:32 PM, Hans-Peter Jansen wrote:
> > in an attempt to build python-kde4 from kdebindings-4.4.4, I stumbled
> > across this failure:
> >
> > sip: 
> > /usr/src/packages/BUILD/kdebindings-4.4.4/python/pykde4/sip/kdecore/typ
> >edefs.sip:737: Mapped type has already been defined in another module
> > make[2]: *** [python/pykde4/sip/akonadi/sipakonadipart0.cpp] Error 1
> > make[2]: Leaving directory `/usr/src/packages/BUILD/kdebindings-4.4.4/b
> >uild'
> > make[1]: *** [python/pykde4/CMakeFiles/python_module_PyKDE4_akonadi.dir
> >/all] Error 2
> >
> > Is this issue already known?
>
> yep. It is a small incompatibility in PyQt introduced after KDE 4.5 came
> out.
>
> This change on trunk will most likely fix your problem. You should be
> able to apply the change to 4.4.4 & 4.5.1.
>
>    http://websvn.kde.org/?view=revision&revision=1170602
>

Yes, that fixed this problem. Thanks a bunch. I guess, sip got pickier about 
multiply defined type converters lately.

Unfurtunately, here's the next stumbling point:

/usr/include/kio/tcpslavebase.h: In function 'PyObject* 
slot_KIO_TCPSlaveBase_SslResult___xor__(PyObject*, PyObject*)':
/usr/include/kio/tcpslavebase.h:63: error: 'enum 
KIO::TCPSlaveBase::SslResultDetail' is protected
/usr/share/sip/PyQt4/QtCore/qglobal.sip:320: error: within this context
/usr/include/kio/tcpslavebase.h: In function 'PyObject* 
slot_KIO_TCPSlaveBase_SslResult___or__(PyObject*, PyObject*)':
/usr/include/kio/tcpslavebase.h:63: error: 'enum 
KIO::TCPSlaveBase::SslResultDetail' is protected
/usr/share/sip/PyQt4/QtCore/qglobal.sip:315: error: within this context

Phil, this one is due to the logic operator changes. It's not obvious, what's 
going wrong, but related to the friend class QFlags declararation, where 
qglobal.sip got pulled in..

Here's the KDE class excerpt:

class KIO_EXPORT TCPSlaveBase : public SlaveBase
{
public:
    /**
     * Constructor.
     *
     * @param autoSsl if true, will automatically invoke startSsl() right after
     *                connecting. In the absence of errors the use of SSL will
     *                therefore be transparent to higher layers.
     */
    TCPSlaveBase(const QByteArray &protocol,
                 const QByteArray &poolSocket, const QByteArray &appSocket,
                 bool autoSsl = false);

    virtual ~TCPSlaveBase();

protected:
    enum SslResultDetail {
        ResultOk = 1,
        ResultOverridden = 2,
        ResultFailed = 4,
        ResultFailedEarly = 8
    };
    friend class QFlags<KIO::TCPSlaveBase::SslResultDetail>;
public:
    Q_DECLARE_FLAGS(SslResult, SslResultDetail)
protected:
[...]

and the related sip file excerpt:

%ModuleHeaderCode
//ctscc
#include <forwardingslavebase.h>
#include <slavebase.h>
#include <tcpslavebase.h>
%End

namespace KIO
{

class TCPSlaveBase : KIO::SlaveBase
{
%TypeHeaderCode
#include <tcpslavebase.h>
%End


public:
    TCPSlaveBase (const QByteArray& protocol, const QByteArray& poolSocket, 
const QByteArray& appSocket, bool autoSsl = 0);


protected:
    enum SslResultDetail
    {
        ResultOk,
        ResultOverridden,
        ResultFailed,
        ResultFailedEarly
    };
[...]

Both attached.

Pete


//
//     Copyright 2008 Jim Bublitz <jbubl...@nwinternet.com>
//     Earlier copyrights 1998 - 2007 Jim Bublitz also apply

//                 Generated by twine

// This file is part of PyKDE4.

// PyKDE4 is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of
// the License, or (at your option) any later version.

// PyKDE4 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.


%ModuleHeaderCode
//ctscc
#include <forwardingslavebase.h>
#include <slavebase.h>
#include <tcpslavebase.h>
%End

namespace KIO
{

class TCPSlaveBase : KIO::SlaveBase
{
%TypeHeaderCode
#include <tcpslavebase.h>
%End


public:
                            TCPSlaveBase (const QByteArray& protocol, const QByteArray& poolSocket, const QByteArray& appSocket, bool autoSsl = 0);


protected:
    enum SslResultDetail
    {
        ResultOk,
        ResultOverridden,
        ResultFailed,
        ResultFailedEarly
    };

    ssize_t                 write (const char* data, ssize_t len);
    ssize_t                 read (char* data, ssize_t len);
    ssize_t                 readLine (char* data, ssize_t len);
    bool                    connectToHost (const QString& protocol, const QString& host, quint16 port);
    quint16                 port () const;
    bool                    isAutoSsl () const;
    bool                    isUsingSsl () const;
    bool                    startSsl ();
    void                    disconnectFromHost ();
    bool                    atEnd () const;
    bool                    isConnected () const;
    bool                    waitForResponse (int t);
    void                    setBlocking (bool b);
    QIODevice*              socket () const;
//ig    virtual void            virtual_hook (int id, void* data);

private:
//force
                            TCPSlaveBase (const KIO::TCPSlaveBase& other);

//  Subclasses of KIO::SlaveBase

//end
%ConvertToSubClassCode
    // CTSCC for subclasses of 'SlaveBase'
    sipType = NULL;

    if (dynamic_cast<KIO::ForwardingSlaveBase*>(sipCpp))
        sipType = sipType_KIO_ForwardingSlaveBase;
    else if (dynamic_cast<KIO::TCPSlaveBase*>(sipCpp))
        sipType = sipType_KIO_TCPSlaveBase;
%End

public:
    ~TCPSlaveBase ();
    typedef QFlags<KIO::TCPSlaveBase::SslResultDetail> SslResult;
};
// TCPSlaveBase

};
// KIO


/*
 * Copyright (C) 2000 Alex Zepeda <zipzi...@sonic.net>
 * Copyright (C) 2001 George Staikos <stai...@kde.org>
 * Copyright (C) 2001 Dawit Alemayehu <ada...@kde.org>
 * Copyright (C) 2007,2008 Andreas Hartmetz <ahartm...@gmail.com>
 *
 * This file is part of the KDE project
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef _TCP_SLAVEBASE_H
#define _TCP_SLAVEBASE_H

#include <sys/types.h>
#include <stdio.h>

#include <kio/slavebase.h>

class QIODevice;

namespace KIO {

/**
 * There are two classes that specifies the protocol between application (job)
 * and kioslave. SlaveInterface is the class to use on the application end,
 * SlaveBase is the one to use on the slave end.
 *
 * Slave implementations should simply inherit SlaveBase
 *
 * A call to foo() results in a call to slotFoo() on the other end.
 */
class KIO_EXPORT TCPSlaveBase : public SlaveBase
{
public:
    /**
     * Constructor.
     *
     * @param autoSsl if true, will automatically invoke startSsl() right after
     *                connecting. In the absence of errors the use of SSL will
     *                therefore be transparent to higher layers.
     */
    TCPSlaveBase(const QByteArray &protocol,
                 const QByteArray &poolSocket, const QByteArray &appSocket,
                 bool autoSsl = false);

    virtual ~TCPSlaveBase();

protected:
    enum SslResultDetail {
        ResultOk = 1,
        ResultOverridden = 2,
        ResultFailed = 4,
        ResultFailedEarly = 8
    };
    friend class QFlags<KIO::TCPSlaveBase::SslResultDetail>;
public:
    Q_DECLARE_FLAGS(SslResult, SslResultDetail)
protected:

    /**
     * Send data to the remote host.
     *
     * @param data data to be sent to remote machine
     * @param len the length (in bytes) of the data to be sent
     *
     * @return the actual size of the data that was sent
     */
    using SlaveBase::write; //Silence incompatible virtual override warning
    ssize_t write(const char *data, ssize_t len);

    /**
     * Read incoming data from the remote host.
     *
     * @param data storage for the data read from server
     * @param len length of the data (in bytes) to read from the server
     *
     * @return the actual size of data that was obtained
     */
    using SlaveBase::read;
    ssize_t read(char *data, ssize_t len);

    /**
     * Same as read() except it reads data one line at a time.
     */
    ssize_t readLine(char *data, ssize_t len);

    /**
     * Performs the initial TCP connection stuff and/or
     * SSL handshaking as necessary.
     *
     * @param protocol the protocol being used
     * @param host hostname
     * @param port port number
     *
     * @return on succes, true is returned.
     *         on failure, false is returned and an appropriate
     *         error message is sent to the application.
     */
    bool connectToHost(const QString &protocol, const QString& host, quint16 port);

    /**
     * the current port for this service
     *
     */
    quint16 port() const;

    /**
     * Will start SSL after connecting?
     *
     * @return if so, true is returned.
     *         if not, false is returned.
     */
    bool isAutoSsl() const;

    /**
     * Is the current connection using SSL?
     *
     * @return if so, true is returned.
     *         if not, false is returned.
     */
    bool isUsingSsl() const;

    /**
     * Start using SSL on the connection. You can use it right after connecting
     * for classic, transparent to the protocol SSL. Calling it later can be
     * used to implement e.g. SMTP's STARTTLS feature.
     *
     * @return on success, true is returned.
     *         on failure, false is returned.
     */
    bool startSsl();

    /**
     * Close the connection and forget non-permanent data like the peer host.
     */
    void disconnectFromHost();

    /**
     * Returns true when end of data is reached.
     */
    bool atEnd() const;

    /**
     * Determines whether or not we are still connected
     * to the remote machine.
     *
     * return @p true if the socket is still active or
     *           false otherwise.
     */
    bool isConnected() const;

    /**
     * Wait for incoming data on the socket
     * for the period specified by @p t.
     *
     * @param t  length of time in seconds that we should monitor the
     *           socket before timing out.
     *
     * @return true if any data arrived on the socket before the
     *              timeout value was reached, false otherwise.
     */
    bool waitForResponse( int t );

    /**
     * Sets the mode of the connection to blocking or non-blocking.
     *
     * Be sure to call this function before calling connectToHost.
     * Otherwise, this setting will not have any effect until the next
     * @p connectToHost.
     *
     * @param b true to make the connection a blocking one, false otherwise.
     */
    void setBlocking( bool b );

    /**
     * Return the socket object, if the class ever needs to do anything to it
     */
    QIODevice *socket() const;

protected:
    virtual void virtual_hook( int id, void* data );

private:
    // For the certificate verification code
    SslResult verifyServerCertificate();

    // For prompting for the client certificate to use
    void selectClientCertificate();

    //we can't include ktcpsocket.h here as it is not exported
    SslResult startTLSInternal(uint KTcpSocket_SslVersion);

    class TcpSlaveBasePrivate;
    TcpSlaveBasePrivate* const d;
};

}

#endif
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to