-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathversion_number.py
47 lines (41 loc) · 2.05 KB
/
version_number.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# -*- coding: utf-8 -*-
"""
/***************************************************************************
LiDARForestryHeight
A QGIS plugin. LiDAR Forestry Height
generates a DEM with the forest height,
calculated from a classified LiDAR point
cloud using LasPy Library
Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
-------------------
begin : 2018-09-24
copyright : (C) 2019 by PANOimagen S.L.
email : [email protected]
git sha : $Format:%H$
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
"""
import os
def get_version_from_metadata():
""" This function reads the plugin metadata file in txt format and returns
the version number
"""
try:
path = os.path.split(os.path.abspath(__file__))[0]
metadata_file = open(os.path.join(path, 'metadata.txt'), 'rt')
contents = metadata_file.readlines()
metadata_file.close()
for line in contents:
if 'version=' in line:
lin = line.replace('version=', '')
version = lin.replace('\n', '')
return version
except FileNotFoundError:
return 'n.a.'