Python twisted.version() Examples

The following are 2 code examples of twisted.version(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module twisted , or try the search function .
Example #1
Source File: network.py    From Safejumper-for-Desktop with GNU General Public License v2.0 6 votes vote down vote up
def ensure_outgoing_proxy_dependencies():
    """Make sure that we have the necessary dependencies to connect to
    outgoing HTTP/SOCKS proxies.

    Raises OutgoingProxyDepsFailure in case of error.
    """

    # We can't connect to outgoing proxies without txsocksx.
    try:
        import txsocksx
    except ImportError:
        raise OutgoingProxyDepsFailure("We don't have txsocksx. Can't do proxy. Please install txsocksx.")

    # We also need a recent version of twisted ( >= twisted-13.2.0)
    import twisted
    from twisted.python import versions
    if twisted.version < versions.Version('twisted', 13, 2, 0):
        raise OutgoingProxyDepsFailure("Outdated version of twisted (%s). Please upgrade to >= twisted-13.2.0" % twisted.version.short()) 
Example #2
Source File: core.py    From dtella with GNU General Public License v2.0 6 votes vote down vote up
def doWarnings():
    import twisted
    from twisted.python import versions
    if (twisted.version < versions.Version('twisted', 8, 0, 0)):
        LOG.warning("You should get Twisted 8 or later.  Previous versions "
                    "have some bugs that affect Dtella.")

    try:
        import dtella.bridge
    except ImportError:
        # Don't warn about GMP for clients, because verifying a signature
        # is fast enough without it (~1ms on a Core2)
        pass
    else:
        import Crypto.PublicKey
        try:
            import Crypto.PublicKey._fastmath
        except ImportError:
            LOG.warning("Your version of PyCrypto was compiled without "
                        "GMP (fastmath).  Signing messages will be slower.")