| 2 | import sys |
| 3 | |
| 4 | def _get_version(): |
| 5 | chain_path=os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
| 6 | list=[] |
| 7 | list1=[] |
| 8 | list2=[] |
| 9 | tags_path=os.path.join(chain_path,'.git/refs/tags') |
| 10 | for i,j,k in os.walk(tags_path): |
| 11 | tag_files = k |
| 12 | tag_files.remove('upstream') |
| 13 | for i in tag_files: |
| 14 | list.append(i.split(".")[1]) |
| 15 | list.sort() |
| 16 | max1=list[-1] |
| 17 | for i in tag_files: |
| 18 | if(max1==(i.split(".")[1])and (not i.endswith('-doc'))): |
| 19 | list1.append(i.split(".")[2]) |
| 20 | list1.sort() |
| 21 | max2=list1[-1] |
| 22 | for i in tag_files: |
| 23 | str=i.split(".") |
| 24 | if(max1==(i.split(".")[1]) and max2==i.split(".")[2] and len(str)==3): |
| 25 | version="0."+max1+"."+max2 |
| 26 | return version |
| 27 | if(max1==(i.split(".")[1]) and max2==i.split(".")[2] and len(str)==4): |
| 28 | list2.append(i.split(".")[3]) |
| 29 | list2.sort() |
| 30 | max3=list2[-1] |
| 31 | version="0."+max1+"."+max2+"."+max3 |
| 32 | return version |
| 33 | |
| 34 | |
| 35 | def main(): |