Skip to content
Permalink
Browse files

py2/py3 compat patches

  • Loading branch information
m-kuhn committed Mar 22, 2016
1 parent 83d729c commit 02c56371555675aad012a903f9c8d79e913a9c5c
@@ -49,19 +49,19 @@ matrix:
git:
depth: 30

# notifications:
# irc: "chat.freenode.net#qgis-test"
# on_failure: change
# on_success: change
# skip_join: true
#
# notifications:
# webhooks:
# urls:
# - https://webhooks.gitter.im/e/467e3aff72e344d1dae3
# on_success: change # options: [always|never|change] default: always
# on_failure: always # options: [always|never|change] default: always
# on_start: never # default: never
notifications:
irc: "chat.freenode.net#qgis-test"
on_failure: change
on_success: change
skip_join: true

notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/467e3aff72e344d1dae3
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: never # default: never

before_install:
- ./ci/travis/${TRAVIS_OS_NAME}/before_install.sh
@@ -66,7 +66,7 @@ sudo apt-get install --force-yes --no-install-recommends --no-install-suggests \
postgresql-9.1-postgis-2.1/precise # from ubuntugis-unstable, not pgdg

sudo -H pip install autopep8 # TODO when switching to trusty or above: replace python-pip with python-autopep8
sudo -H pip install nose2 pyyaml mock
sudo -H pip install nose2 pyyaml mock future

#update clang
sudo apt-get install --force-yes llvm-3.8 llvm-3.8-dev clang-3.8 libstdc++-4.9-dev
@@ -24,7 +24,6 @@ PyQgsDelimitedTextProvider
PyQgsDistanceArea
PyQgsDocCoverage
PyQgsEditWidgets
PyQgsExpression
PyQgsFeature
PyQgsFeatureIterator
PyQgsField
@@ -18,4 +18,4 @@ mkdir -p ${HOME}/Library/Python/2.7/lib/python/site-packages
echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> ${HOME}/Library/Python/2.7/lib/python/site-packages/homebrew.pth

# Needed for Processing
pip install psycopg2 numpy nose2 pyyaml mock
pip install psycopg2 numpy nose2 pyyaml mock future
@@ -16,6 +16,10 @@
* *
***************************************************************************
"""
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import str

__author__ = 'Martin Dobias'
__date__ = 'November 2009'
@@ -37,7 +41,10 @@
import traceback
import glob
import os.path
import ConfigParser
try:
import configparser
except ImportError:
import ConfigParser as configparser
import warnings
import codecs
import time
@@ -237,7 +244,7 @@ def findPlugins(path):
if not os.path.exists(metadataFile):
continue

cp = ConfigParser.ConfigParser()
cp = configparser.ConfigParser()

try:
f = codecs.open(metadataFile, "r", "utf8")
@@ -476,7 +483,7 @@ def reloadProjectMacros():
mod = imp.new_module("proj_macros_mod")

# set the module code and store it sys.modules
exec(unicode(code), mod.__dict__)
exec(str(code), mod.__dict__)
sys.modules["proj_macros_mod"] = mod

# load new macros
@@ -574,9 +581,15 @@ def startServerPlugin(packageName):
#######################
# IMPORT wrapper

import __builtin__
try:
import builtins

_builtin_import = builtins.__import__
except AttributeError:
import __builtin__

_builtin_import = __builtin__.__import__

_builtin_import = __builtin__.__import__
_plugin_modules = {}


@@ -603,5 +616,7 @@ def _import(name, globals={}, locals={}, fromlist=[], level=None):

return mod


__builtin__.__import__ = _import
try:
builtins.__import__ = _import
except AttributeError:
__builtin__.__import__ = _import
@@ -32,6 +32,7 @@
#include <QMessageBox>
#include <QStringList>
#include <QDir>
#include <QDebug>

#if (PY_VERSION_HEX < 0x03000000)
#define PYOBJ2QSTRING(obj) PyString_AsString( obj )
@@ -335,6 +336,7 @@ bool QgsPythonUtilsImpl::runString( const QString& command, QString msgOnError,
+ QObject::tr( "Python path:" ) + "<br>" + path;
str.replace( '\n', "<br>" ).replace( " ", "&nbsp; " );

qDebug() << str;
QgsMessageOutput* msg = QgsMessageOutput::createMessageOutput();
msg->setTitle( QObject::tr( "Python error" ) );
msg->setMessage( str, QgsMessageOutput::MessageHtml );
@@ -150,7 +150,7 @@ def testBlockComment(self):
comment
**/""": 'test*/'
}
for e, exp_res in expressions.iteritems():
for e, exp_res in expressions.items():
exp = QgsExpression(e)
result = exp.evaluate()
self.assertEqual(exp_res, result)
@@ -164,7 +164,7 @@ def testComment(self):
"'test--'": 'test--',
"'--test'": '--test',
}
for e, exp_res in expressions.iteritems():
for e, exp_res in expressions.items():
exp = QgsExpression(e)
result = exp.evaluate()
self.assertEqual(exp_res, result)

0 comments on commit 02c5637

Please sign in to comment.
You can’t perform that action at this time.