Пример #1
0
def test_version(version):
    version = version.replace(' ', '_')
    reg='[0-9]+[.][0-9]+(([.][0-9]+([.][0-9]+)?)|(_(beta|alpha|rc)_[0-9]+))?$'
    if re.match(reg, version):
        return version
Пример #2
0
def version_interne(version):
    version = version.replace("alpha", "-3").replace("beta", "-2").replace("rc", "-1").replace(".", " ").replace("_", " ")
    return [int(n) for n in version.split(' ')]
Пример #3
0
    for nom, val in s.__dict__.items():
        if isinstance(val, types.FunctionType):
            setattr(s, nom, eval("lambda s, *args, **kw:print('@%s: ' + s)" %nom))

# Mise à jour de la version et de la date dans param.__init__.py
t=time.localtime()
date = str((t.tm_year, t.tm_mon, t.tm_mday))
contenu = []
with open('version.py', 'r') as f:
    for line in f:
        if line.startswith('date_version = '):
            contenu.append('date_version = ' + date)
        elif line.startswith('version = '):
            version_precedente = line[11:].split('#')[0].strip()[:-1]
            # Changement du numéro de version
            contenu.append('version = ' + repr(version.replace('_', ' ')) + '\n')
        elif line.startswith('git = '):
            contenu.append('git = ' + repr(s.command('git describe')))
        else:
            contenu.append(line)

# Quelques tests sur le numéro de version:
while True:
    modifier = False
    print('\n-------------------')
    print(u"Version précédente: " + version_precedente)
    version = test_version(version)
    if version is None:
        print('Numero de version incorrect: ' + args[0])
        modifier = True
    elif version_interne(version) <= version_interne(version_precedente):
Пример #4
0
def test_version(version):
    version = version.replace(' ', '_')
    reg = '[0-9]+[.][0-9]+(([.][0-9]+([.][0-9]+)?)|(_(beta|alpha|rc)_[0-9]+))?$'
    if re.match(reg, version):
        return version
Пример #5
0
def version_interne(version):
    version = version.replace("alpha", "-3").replace("beta", "-2").replace(
        "rc", "-1").replace(".", " ").replace("_", " ")
    return [int(n) for n in version.split(' ')]
Пример #6
0
        if isinstance(val, types.FunctionType):
            setattr(s, nom,
                    eval("lambda s, *args, **kw:print('@%s: ' + s)" % nom))

# Mise à jour de la version et de la date dans param.__init__.py
t = time.localtime()
date = str((t.tm_year, t.tm_mon, t.tm_mday))
contenu = []
with open('param/version.py', 'r') as f:
    for line in f:
        if line.startswith('date_version = '):
            contenu.append('date_version = ' + date)
        elif line.startswith('version = '):
            version_precedente = line[11:].split('#')[0].strip()[:-1]
            # Changement du numéro de version
            contenu.append('version = ' + repr(version.replace('_', ' ')) +
                           '\n')
        else:
            contenu.append(line)

# Quelques tests sur le numéro de version:
while True:
    modifier = False
    print('\n-------------------')
    print(u"Version précédente: " + version_precedente)
    version = test_version(version)
    if version is None:
        print('Numero de version incorrect: ' + args[0])
        modifier = True
    elif version_interne(version) <= version_interne(version_precedente):
        print('Les numeros de version doivent etre croissants: ' + args[0])