Skip to content

Commit f2029b4

Browse files
committedJan 24, 2013
log python warnings and enabled deprecation warnings
1 parent 595a45f commit f2029b4

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed
 

‎cmake/SIPMacros.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ MACRO(ADD_SIP_PYTHON_MODULE MODULE_NAME MODULE_SIP)
105105
OUTPUT ${_sip_output_files}
106106
COMMAND ${CMAKE_COMMAND} -E echo ${message}
107107
COMMAND ${CMAKE_COMMAND} -E touch ${_sip_output_files}
108-
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}
108+
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}
109109
DEPENDS ${_abs_module_sip} ${SIP_EXTRA_FILES_DEPEND}
110110
)
111111
# not sure if type MODULE could be uses anywhere, limit to cygwin for now

‎python/utils.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,29 @@
2828
2929
"""
3030

31-
from PyQt4.QtCore import QCoreApplication,QLocale, QString
32-
from qgis.core import QGis, QgsExpression
31+
from PyQt4.QtCore import QCoreApplication, QLocale, QString
32+
from qgis.core import QGis, QgsExpression, QgsMessageLog
3333
from string import Template
3434
import sys
3535
import traceback
3636
import glob
3737
import os.path
3838
import re
3939
import ConfigParser
40+
import warnings
4041

4142
#######################
4243
# ERROR HANDLING
4344

45+
warnings.simplefilter('default')
46+
47+
def showWarning(message, category, filename, lineno, file=None, line=None):
48+
QgsMessageLog.logMessage(
49+
warnings.formatwarning(message, category, filename, lineno),
50+
QCoreApplication.translate( "Python", "Python" )
51+
)
52+
warnings.showwarning = showWarning
53+
4454
def showException(type, value, tb, msg):
4555
lst = traceback.format_exception(type, value, tb)
4656
if msg == None:

0 commit comments

Comments
 (0)
Please sign in to comment.