Example #1
0
def publish(filename, version):
    u"""Publie le fichier sur sourceforge, et met à jour le fichier distant
    contenant le numéro de la dernière version.
    """
    SOURCEFORGE_CONFIG = 'tools/.sourceforge'
    if isfile(SOURCEFORGE_CONFIG):
        with open(SOURCEFORGE_CONFIG) as _file:
            key = _file.read(1000)
    else:
        key = raw_input('API-key:')
    print(u'\nMise en ligne de la version %s (%s)' % (version, filename))
    remote_dir = '/home/frs/project/geophar/Geophar/version_%s' % version
    s.command('ssh wxgeo,[email protected] create')
    s.command('cat %s | ssh [email protected] "mkdir -p %s;cat > %s/%s"'
                % (filename, remote_dir, remote_dir, filename))
    # http://sourceforge.net/p/forge/community-docs/Using%20the%20Release%20API/
    s.command(('curl -H "Accept: application/json" '
               '-X PUT -d "default=linux&default=bsd&default=solaris&default=others"'
               '-d "api_key=%s" '
               'https://sourceforge.net/projects/geophar/files/Geophar/version_%s/%s')
               % (key, version, filename))
    urlopen('http://wxgeo.free.fr/wordpress/update_geophar_version.php?version=%s' % version)
Example #2
0
        elif rep in 'qQ':
            sys.exit()
        elif rep in 'nN':
            modifier = True
    if modifier:
        version = raw_input(u"Entrez un nouveau numero de version:")

print(u'\nCréation de la version ' + version + '...')

if not options.fake:
    # Mise à jour de param/version.py
    with open('param/version.py', 'w') as f:
        f.write(''.join(contenu).strip())

# Commit correspondant
s.command('git add param/version.py')
s.command('git commit -m %s' %repr('Version ' + version))

archive_tar = "wxgeometrie_%s.tar" %version
archive_gz = archive_tar + '.gz'

print(u'\nCréation du paquet...')

# Nettoyage (inutile, sauf plantage précédent)
s.cd('..')
s.rmdir('build_', quiet=True)
s.rm(archive_gz, quiet=True)
s.mkdir('build_')
s.mkdir('build_/wxgeometrie')

Example #3
0
script_name = join(exec_path, 'geophar')

with open(script_name, 'w') as f:
    f.write('#!/bin/sh\n')
    f.write('exec %s/geophar.pyw $*' % os.getcwd())

if choice == 'root':
    os.chmod(script_name, stat.S_IRWXU|stat.S_IXOTH)
else:
    os.chmod(script_name, stat.S_IRWXU)

# Mise à jour des bases de données.

update_desktop = 'update-desktop-database %s' % locations['desktop_path']
update_mime = 'update-mime-database %s' % locations['mime_root_path']
command(update_desktop)
command(update_mime)

# Création du script de désinstallation.

cd(_module_path)

with open('linux-uninstall.py', 'w') as f:
    f.write('#!/usr/bin/env python\n')
    f.write('# -*- coding: utf-8 -*-\n')
    f.write('from scriptlib import *\n')
    f.write('rm(%s)\n' % repr(join(locations['desktop_path'], 'geophar.desktop')))
    f.write('rm(%s)\n' % repr(join(locations['mime_path'], 'x-geophar.xml')))
    f.write('rm(%s)\n' % repr(join(locations['svg_icon_path'], 'geophar.svg')))
    f.write('rm(%s)\n' % repr(join(locations['png_icon_path'], 'geophar.png')))
    f.write('rm(%s)\n' % repr(script_name))
Example #4
0
        elif rep in 'qQ':
            sys.exit()
        elif rep in 'nN':
            modifier = True
    if modifier:
        version = raw_input(u"Entrez un nouveau numero de version:")

print(u'\nCréation de la version ' + version + '...')

if not options.fake:
    # Mise à jour de param/version.py
    with open('param/version.py', 'w') as f:
        f.write(''.join(contenu).strip())

# Commit correspondant
s.command('git add param/version.py')
s.command('git commit -m %s' %repr('Version ' + version))

archive_tar = "wxgeometrie_%s.tar" %version
archive_gz = archive_tar + '.gz'

print(u'\nCréation du paquet...')

# Nettoyage (inutile, sauf plantage précédent)
s.cd('..')
s.rmdir('build_', quiet=True)
s.rm(archive_gz, quiet=True)

# Création d'un répertoire temporaire build_/
s.mkdir('build_')
s.mkdir('build_/wxgeometrie')
Example #5
0
            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):
        print('Les numeros de version doivent etre croissants: ' + args[0])
        modifier = True
Example #6
0
def compile_and_scan(name):
    command("pdflatex -interaction=nonstopmode %s.tex" % name)
    command("inkscape -f %s.pdf -b white -d 150 -e %s.png" % (name, name))
    return scan.scan_picture("%s.png" % name, "%s.config" % name)
Example #7
0
# Récupération des infos de version puis mise en cache.
# Celles-ci serviront à mettre à jour version.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 = %s\n' % date)
        elif line.startswith('version = '):
            #~ version_precedente = line[11:].split('#')[0].strip()[:-1]
            # Le nouveau numéro de version sera complété plus tard.
            contenu.append('version = %s\n')
        elif line.startswith('git = '):
            contenu.append('git = ' + repr(s.command('git describe').strip()))
        else:
            contenu.append(line)


if options.archive_only:
    last_commit_hash = s.command('git rev-parse --short HEAD').strip()
    date = time.strftime('%d.%m.%Y-%H.%M.%S')
    version = '%s-git-%s-%s' % (version_precedente, last_commit_hash, date)
else:
    if len(args) != 1:
        parser.error("fournir un (et un seul) argument (numero de version).\nVersion actuelle: " + version_precedente)
    version = args[0]
    # Quelques tests sur le numéro de version:
    while True:
        modifier = False
Example #8
0
#!/usr/bin/env python3
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import glob
from scriptlib import command



for filename in glob.iglob('**/*.py', recursive=True):
    if '/sympy/' in filename or filename.startswith('sympy/') or filename.endswith("/conv2to3.py"):
        continue
    output = command('2to3 %s' % filename)
    print(80*'-')
    if "RefactoringTool: No files need to be modified." in output:
        continue
    command('2to3 -w %s' % filename)
    command('meld %s.bak %s' % (filename, filename))