mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-18 00:03:05 -04:00
[processing] add function to retrieve Processing version
Initial idea by Etienne Trimaille
This commit is contained in:
parent
687b6fdeaa
commit
9c96be1214
@ -54,6 +54,8 @@ class AlgorithmsTest:
|
|||||||
"""
|
"""
|
||||||
This is the main test function. All others will be executed based on the definitions in testdata/algorithm_tests.yaml
|
This is the main test function. All others will be executed based on the definitions in testdata/algorithm_tests.yaml
|
||||||
"""
|
"""
|
||||||
|
ver = processing.version()
|
||||||
|
print "Processing {}.{}.{}".format(ver / 10000, ver / 100 % 100, ver % 100)
|
||||||
with open(os.path.join(processingTestDataPath(), self.test_definition_file()), 'r') as stream:
|
with open(os.path.join(processingTestDataPath(), self.test_definition_file()), 'r') as stream:
|
||||||
algorithm_tests = yaml.load(stream)
|
algorithm_tests = yaml.load(stream)
|
||||||
|
|
||||||
|
@ -25,6 +25,9 @@ __copyright__ = '(C) 2013, Victor Olaya'
|
|||||||
|
|
||||||
__revision__ = '$Format:%H$'
|
__revision__ = '$Format:%H$'
|
||||||
|
|
||||||
|
import os
|
||||||
|
import ConfigParser
|
||||||
|
|
||||||
from processing.core.Processing import Processing
|
from processing.core.Processing import Processing
|
||||||
from processing.gui.Postprocessing import handleAlgorithmResults
|
from processing.gui.Postprocessing import handleAlgorithmResults
|
||||||
from processing.core.parameters import ParameterSelection
|
from processing.core.parameters import ParameterSelection
|
||||||
@ -75,3 +78,11 @@ def runalg(algOrName, *args, **kwargs):
|
|||||||
|
|
||||||
def runandload(name, *args, **kwargs):
|
def runandload(name, *args, **kwargs):
|
||||||
return Processing.runAlgorithm(name, handleAlgorithmResults, *args, **kwargs)
|
return Processing.runAlgorithm(name, handleAlgorithmResults, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
def version():
|
||||||
|
pluginPath = os.path.split(os.path.dirname(__file__))[0]
|
||||||
|
cfg = ConfigParser.SafeConfigParser()
|
||||||
|
cfg.read(os.path.join(pluginPath, 'metadata.txt'))
|
||||||
|
ver = cfg.get('general', 'version').split('.')
|
||||||
|
return 10000 * int(ver[0]) + 100 * int(ver[1]) + int(ver[2])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user