Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/scripts/install_model
blob: f69979b80098f24d718df208df2b797f013df359 (plain)
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
48
49
50
51
52
53
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# mainfile (path relativo)
# iconfile (path relativo)
# GnomeCat (GTK;GNOME;Juegos;)
# GnomeMimeTypes

import os
import commands

self_path = os.path.abspath(os.path.dirname(__file__))

NAME = self_path.split("/")[-1]

final_path = os.path.join(os.environ["HOME"], NAME)
print "final_path =", final_path

### borrar anterior.
if os.path.exists(final_path):
    print "Eliminando Version Anterior."
    commands.getoutput('rm -r %s' % (final_path))

### Copiar proyecto a destino final.
commands.getoutput('cp -r %s %s' % (self_path, os.environ["HOME"]))
commands.getoutput('chmod 755 -R %s' % final_path)
print "Copiando:", self_path, "En:", os.environ["HOME"]

main_path = os.path.join(final_path, "mainfile")
icon_path = final_path + "iconfile"

desktoptext = """[Desktop Entry]
Encoding=UTF-8
Name=%s
GenericName=%s
Exec=%s
Terminal=false
Type=Application
Icon=%s
Categories=%s
MimeType=%s
StartupNotify=true""" % (NAME, NAME, main_path, icon_path, "GnomeCat", "GnomeMimeTypes")

print "\t Generando Archivo Desktop:"
print desktoptext

desktop = open(os.path.join(os.environ["HOME"], ".local/share/applications/%s.desktop" % NAME), "w")
desktop.write(desktoptext)
desktop.close()

commands.getoutput('chmod 755 %s' % os.path.join(os.environ["HOME"], ".local/share/applications/%s.desktop" % NAME))
commands.getoutput("update-desktop-database %s" % os.path.join(os.environ["HOME"], ".local/share/applications/"))
print "Instalacion Finalizada."