Skip to content
Permalink
Browse files

[processing] add function to retrieve Processing version

Initial idea by Etienne Trimaille
  • Loading branch information
alexbruy committed Apr 1, 2016
1 parent 687b6fd commit 9c96be1214bd51321c52468c8860387cdb32a806
@@ -54,6 +54,8 @@ def test_algorithms(self):
"""
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:
algorithm_tests = yaml.load(stream)

@@ -25,6 +25,9 @@

__revision__ = '$Format:%H$'

import os
import ConfigParser

from processing.core.Processing import Processing
from processing.gui.Postprocessing import handleAlgorithmResults
from processing.core.parameters import ParameterSelection
@@ -75,3 +78,11 @@ def runalg(algOrName, *args, **kwargs):

def runandload(name, *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])

0 comments on commit 9c96be1

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