Skip to content

Commit

Permalink
log python warnings and enabled deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jan 24, 2013
1 parent 595a45f commit f2029b4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmake/SIPMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ MACRO(ADD_SIP_PYTHON_MODULE MODULE_NAME MODULE_SIP)
OUTPUT ${_sip_output_files}
COMMAND ${CMAKE_COMMAND} -E echo ${message}
COMMAND ${CMAKE_COMMAND} -E touch ${_sip_output_files}
COMMAND ${SIP_BINARY_PATH} ${_sip_tags} -e ${_sip_x} ${SIP_EXTRA_OPTIONS} -j ${SIP_CONCAT_PARTS} -c ${CMAKE_CURRENT_BINARY_DIR}/${_module_path} ${_sip_includes} ${_abs_module_sip}
COMMAND ${SIP_BINARY_PATH} ${_sip_tags} -w -e ${_sip_x} ${SIP_EXTRA_OPTIONS} -j ${SIP_CONCAT_PARTS} -c ${CMAKE_CURRENT_BINARY_DIR}/${_module_path} ${_sip_includes} ${_abs_module_sip}
DEPENDS ${_abs_module_sip} ${SIP_EXTRA_FILES_DEPEND}
)
# not sure if type MODULE could be uses anywhere, limit to cygwin for now
Expand Down
14 changes: 12 additions & 2 deletions python/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,29 @@
"""

from PyQt4.QtCore import QCoreApplication,QLocale, QString
from qgis.core import QGis, QgsExpression
from PyQt4.QtCore import QCoreApplication, QLocale, QString
from qgis.core import QGis, QgsExpression, QgsMessageLog
from string import Template
import sys
import traceback
import glob
import os.path
import re
import ConfigParser
import warnings

#######################
# ERROR HANDLING

warnings.simplefilter('default')

def showWarning(message, category, filename, lineno, file=None, line=None):
QgsMessageLog.logMessage(
warnings.formatwarning(message, category, filename, lineno),
QCoreApplication.translate( "Python", "Python" )
)
warnings.showwarning = showWarning

def showException(type, value, tb, msg):
lst = traceback.format_exception(type, value, tb)
if msg == None:
Expand Down

0 comments on commit f2029b4

Please sign in to comment.