#!/usr/bin/python -W ignore::DeprecationWarning
# -*- coding: utf-8 -*-
# vim: set fileencoding=utf-8 :

import os
import sys
import subprocess

# LINEBASES
versiones = [
                ("0.95", 1),
                ("0.96", 3),
                ("0.97", 5),
                ("0.98", 6),
                ("1.00",  7),
                ("1.10", 198),
                ("1.20", 384),
                ("1.21", 388),
                ("1.22", 496),
                ("1.25", 499),
                ("1.26", 502),
                ("1.3", 507),
                ("1.31", 510),
            ]

def getSTDOUT(comando):
    p = subprocess.Popen(comando , shell=True , stdout=subprocess.PIPE , stderr=open("/dev/null" , "w"))
    out = p.stdout.readlines()
    salida = ""
    for linea in out:
        salida = salida + linea.strip()
    return salida

def getVersion(rev):
    i = 0
    version = "?.?"
    while i<len(versiones):
        if versiones[i][1] < rev:
            version = "%s-%s" % (versiones[i][0], rev)
        elif versiones[i][1] == rev:
            version = versiones[i][0]
        i += 1
    return version

if __name__ == '__main__':
    
    try:
        rev = int(sys.argv[1])
    except:            
        rev = 0

    print getVersion(rev)
