Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorflavio <fdanesse@gmail.com>2013-08-24 21:43:05 (GMT)
committer flavio <fdanesse@gmail.com>2013-08-24 21:43:05 (GMT)
commit3118e1a51c21f5b4e15a6514e4e8d133b5b80162 (patch)
treeff874e49da8e44202309740a2bf72194bb8288db
parent32a522589f5bcff77e523997d8f769e39acbff71 (diff)
Nuevo Sistema de construcción de instaladores de proyectos.
-rw-r--r--ApiProyecto.py127
-rw-r--r--Widget_Setup.py370
-rw-r--r--plantillabin0 -> 16384 bytes
-rw-r--r--scripts/generar_plantilla.py20
-rw-r--r--scripts/install_model50
5 files changed, 165 insertions, 402 deletions
diff --git a/ApiProyecto.py b/ApiProyecto.py
deleted file mode 100644
index 5cd785f..0000000
--- a/ApiProyecto.py
+++ /dev/null
@@ -1,127 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-# ApiProyecto.py por:
-# Cristian García <cristian99garcia@gmail.com>
-# Ignacio Rodriguez <nachoel01@gmail.com>
-# Flavio Danesse <fdanesse@gmail.com>
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-import os
-
-RECHAZAExtension = [".pyc", ".pyo", ".bak"]
-RECHAZAFiles = ["proyecto.ide", ".gitignore"]
-RECHAZADirs = [".git", "build", "dist"]
-
-def colectdir(direccion, directorios):
- """
- Recolecta todos los directorios en el directorio que recibe.
- tomando en cuenta la lista de directorios a rechazar.
- """
-
- if os.path.exists(direccion) and os.path.isdir(direccion):
-
- for direct in os.listdir(direccion):
- directorio = os.path.join(direccion, direct)
-
- if os.path.isdir(directorio):
-
- leer = True
-
- ### Rechazar Directorios preestablecidos como no distribuibles.
- for dir in RECHAZADirs:
- if dir in directorio:
- leer = False
- break
-
- if leer: directorios.append(directorio)
-
- return directorios
-
-def colectfiles(directorio, manifest_list):
- """
- Recolecta todos los archivos en el directorio que recibe,
- tomando en cuenta la lista de extensiones a rechazar.
- """
-
- for archivo in os.listdir(directorio):
- fil = os.path.join(directorio, archivo)
-
- if os.path.isfile(fil):
-
- agregar = True
-
- ### Rechazar Archivos según nombres preestablecidos como no distribuibles.
- for file in RECHAZAFiles:
- if file in fil:
- agregar = False
- break
-
- if not agregar: continue
-
- ### Rechazar Archivos según extensiones preestablecidos como no distribuibles.
- extension = os.path.splitext(os.path.split(archivo)[1])[1]
-
- for rechazar in RECHAZAExtension:
- if rechazar in extension:
- agregar = False
- break
-
- if agregar:
- manifest_list.append(fil)
-
- return manifest_list
-
-def get_installers_data(directorio):
- """
- Devuelve la lista de archivos a escribir en MANIFEST y
- y la lista de archivos a escribir en el campo data_files de setup.py
- """
-
- raiz = directorio
-
- manifest_list = [] # La lista para MANIFEST.
- data_files = {} # Diccionario.
-
- directorios = [raiz]
-
- ### Todos los directorios en el Proyecto.
- for directorio in directorios:
- directorios = colectdir(directorio, directorios)
-
- ### Todos los archivos en el proyecto.
- manifest_list_temp = []
-
- for directorio in directorios:
- manifest_list_temp = colectfiles(directorio, manifest_list_temp)
-
- ### Construir Lista de Archivos para MANIFEST y
- ### data_files para setup.py.
- for archivo in manifest_list_temp:
-
- filename = os.path.basename(archivo)
- parent = os.path.dirname(archivo)
- directorio = parent.split(raiz)[-1]
-
- if not data_files.get(directorio, False):
- data_files[directorio] = []
-
- item = archivo.replace("%s/" % (raiz), "")
- manifest_list.append(item)
-
- data_files[directorio].append(item)
-
- return (manifest_list, data_files)
diff --git a/Widget_Setup.py b/Widget_Setup.py
index c3c43ac..310e480 100644
--- a/Widget_Setup.py
+++ b/Widget_Setup.py
@@ -30,7 +30,6 @@ from gi.repository import Pango
from gi.repository import GdkPixbuf
from Widgets import My_FileChooser
-from JAMediaTerminal import JAMediaTerminal
def get_boton(stock, tooltip):
"""
@@ -65,7 +64,7 @@ class DialogoSetup(Gtk.Dialog):
def __init__(self, parent_window = None, proyecto = None):
Gtk.Dialog.__init__(self,
- #title = "Chequeo de sintáxis",
+ title = "Construyendo instaladores.",
parent = parent_window,
flags = Gtk.DialogFlags.MODAL,
buttons = ["Cerrar", Gtk.ResponseType.ACCEPT])
@@ -134,10 +133,9 @@ class Notebook_Setup(Gtk.Notebook):
elif tipo == "sugar":
self.sugar_notebook.make()
- dialog = DialogoInstall(
+ dialog = DialogoInfoInstall(
parent_window = self.get_toplevel(),
- dirpath = self.proyecto["path"],
- tipo = tipo)
+ distpath = os.path.join(self.proyecto["path"], "dist"))
respuesta = dialog.run()
@@ -172,69 +170,12 @@ class Gnome_Notebook(Gtk.Notebook):
self.proyecto = proyecto
- self.setupcfg = Setup_SourceView()
- self.setupcfg.get_buffer().set_text("")
-
- self.append_page(
- self.get_scroll(self.setupcfg),
- Gtk.Label("setup.cfg"))
-
- self.setupdesktop = Setup_SourceView()
- self.setupdesktop.get_buffer().set_text("")
-
- self.append_page(
- self.get_scroll(self.setupdesktop),
- Gtk.Label("%s.desktop" % self.proyecto["nombre"]))
-
- self.setupmanifest = Setup_SourceView()
- self.setupmanifest.get_buffer().set_text("")
-
- self.append_page(
- self.get_scroll(self.setupmanifest),
- Gtk.Label("MANIFEST"))
-
- self.setuppy = Setup_SourceView()
- self.setuppy.get_buffer().set_text("")
+ self.install = Setup_SourceView()
+ self.install.get_buffer().set_text("")
self.append_page(
- self.get_scroll(self.setuppy),
- Gtk.Label("setup.py"))
-
- self.lanzador = Setup_SourceView()
- self.lanzador.get_buffer().set_text("")
-
- self.append_page(
- self.get_scroll(self.lanzador),
- Gtk.Label("lanzador"))
-
- self.desinstalador = Setup_SourceView()
- self.desinstalador.get_buffer().set_text("")
-
- self.append_page(
- self.get_scroll(self.desinstalador),
- Gtk.Label("desinstalador"))
-
- ### Generar Archivos Necesarios para Construir Instalador.
- self.archivo_lanzador = "%s/%s_run" % (self.proyecto["path"], self.proyecto["nombre"].lower())
- self.archivo_desinstalador = "%s/%s_uninstall" % (self.proyecto["path"], self.proyecto["nombre"].lower())
- self.archivo_setup_py = "%s/setup.py" % (self.proyecto["path"])
- self.archivo_setup_cfg = "%s/setup.cfg" % (self.proyecto["path"])
- self.archivo_manifest = "%s/MANIFEST" % (self.proyecto["path"])
- self.archivo_desktop = "%s/%s.desktop" % (self.proyecto["path"], self.proyecto["nombre"])
-
- lista = [
- self.archivo_lanzador,
- self.archivo_desinstalador,
- self.archivo_setup_py,
- self.archivo_setup_cfg,
- self.archivo_manifest,
- self.archivo_desktop]
-
- for archivo in lista:
- if not os.path.exists(archivo):
- arch = open(archivo, "w")
- arch.write("")
- arch.close()
+ self.get_scroll(self.install),
+ Gtk.Label("install.py"))
self.show_all()
@@ -245,115 +186,97 @@ class Gnome_Notebook(Gtk.Notebook):
posibles correcciones.
"""
- ### setup.cfg
- cfg = "[install]\ninstall_lib=/usr/local/share/%s\ninstall_data=/usr/local/share/%s\ninstall_scripts=/usr/local/bin""" % (self.proyecto["nombre"], self.proyecto["nombre"])
- self.setupcfg.get_buffer().set_text(cfg)
+ import commands
+ import shutil
+ import shelve
+
+ ### Comenzar a generar el temporal
+ activitydirpath = os.path.join("/tmp", "%s" % self.proyecto["nombre"])
+
+ ### Borrar anteriores
+ if os.path.exists(activitydirpath):
+ commands.getoutput("rm -r %s" % activitydirpath)
+
+ ### Copiar contenido del proyecto.
+ shutil.copytree(self.proyecto["path"], activitydirpath, symlinks=False, ignore=None)
if not self.proyecto["path"] in iconpath:
- newpath = os.path.join(self.proyecto["path"], os.path.basename(iconpath))
- import shutil
+ newpath = os.path.join(activitydirpath, os.path.basename(iconpath))
shutil.copyfile(iconpath, newpath)
iconpath = newpath
-
- iconname = os.path.basename(iconpath)
- iconpath = os.path.join("/usr/local/share", self.proyecto["nombre"], iconname)
- lanzador = "%s_run" % (self.proyecto["nombre"].lower())
- desinstalador = "%s_uninstall" % (self.proyecto["nombre"].lower())
+ archivo = shelve.open("plantilla")
+ text = u"%s" % archivo.get('install', "")
+ archivo.close()
- ### desktop
- desktop = "[Desktop Entry]\nEncoding=UTF-8\nName=%s\nGenericName=%s\nComment=%s\nExec=%s\nTerminal=false\nType=Application\nIcon=%s\nCategories=GTK;GNOME;AudioVideo;Player;Video;\nStartupNotify=true\nMimeType=" % (self.proyecto["nombre"], self.proyecto["nombre"], self.proyecto["descripcion"], os.path.join("/usr/local/bin", lanzador), iconpath)
- self.setupdesktop.get_buffer().set_text(desktop)
+ iconpath = iconpath.split(self.proyecto["path"])[-1]
- ### MANIFEST
- import ApiProyecto
+ text = text.replace('mainfile', self.proyecto["main"])
+ text = text.replace('iconfile', iconpath)
- manifest_list, data_files = ApiProyecto.get_installers_data(self.proyecto["path"])
+ self.install.get_buffer().set_text(text)
- manifest = ""
+ def make(self):
+ """
+ Construye los archivos instaladores para su distribución.
+ """
- for item in manifest_list:
- manifest = "%s\n%s" % (item, manifest)
-
- self.setupmanifest.get_buffer().set_text(manifest)
+ import commands
+ import zipfile
- ### setup.py
- setup_py = "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nfrom distutils.core import setup\n\nsetup(\n\tname = \"%s\",\n\tversion = \"%s\",\n\t" % (self.proyecto["nombre"], self.proyecto["version"])
+ activitydirpath = os.path.join("/tmp", "%s" % self.proyecto["nombre"])
- autores = ""
- mails = ""
+ ### Escribir instalador.
+ archivo_install = "%s/install.py" % (activitydirpath)
+ install = self.__get_text(self.install.get_buffer())
+ self.__escribir_archivo(archivo_install, install)
+
+ ### Generar archivo de distribución "*.zip"
+ zippath = "%s.zip" % (activitydirpath)
- for autor in self.proyecto["autores"]:
- autores = "%s%s - " % (autores, autor[0])
- mails = "%s%s - " % (mails, autor[1])
+ ### Eliminar anterior.
+ if os.path.exists(zippath):
+ commands.getoutput("rm %s" % zippath)
- if autores: autores = str(autores[:-3])
- if mails: mails = str(mails[:-3])
+ zipped = zipfile.ZipFile(zippath, "w")
- setup_py = "%sauthor = \"%s\",\n\tauthor_email = \"%s\",\n\t" % (setup_py, autores, mails)
- setup_py = "%surl = \"%s\",\n\tlicense = \"%s\",\n\n\t" % (setup_py, self.proyecto["url"], self.proyecto["licencia"])
- setup_py = "%sscripts = [\"%s\", \"%s\"],\n\n\tpy_modules = [\"%s\"],\n\n\t" % (setup_py, lanzador, desinstalador, self.proyecto["main"].split(".")[0])
- setup_py = "%sdata_files =[\n\t\t(\"/usr/share/applications/\", [\"%s.desktop\"]),\n\t\t" % (setup_py, self.proyecto["nombre"])
+ RECHAZAExtension = [".pyc", ".pyo", ".bak"]
+ RECHAZAFiles = ["proyecto.ide", ".gitignore"]
+ RECHAZADirs = [".git", "build", "dist"]
- for key in data_files.keys():
- newkey = key
+ ### Forzar eliminacion de dist
+ for dir in os.listdir(activitydirpath):
+ d = os.path.join(activitydirpath, dir)
- if key.startswith("/"):
- newkey = ""
-
- for l in key[1:]:
- newkey = "%s%s" % (newkey, l)
-
- if newkey:
- setup_py = "%s(\"%s/\",[\n\t\t\t" % (setup_py, newkey)
-
- else:
- setup_py = "%s(\"%s\",[\n\t\t\t" % (setup_py, newkey)
+ if os.path.isdir(d):
+ if d.split("/")[-1] in RECHAZADirs:
+ commands.getoutput("rm -r %s" % d)
- for item in data_files[key]:
- setup_py = "%s\"%s\",\n\t\t\t" % (setup_py, item)
-
- setup_py = "%s]),\n\n\t\t" % (str(setup_py[:-5]))
+ for (archiveDirPath, dirNames, fileNames) in os.walk(activitydirpath):
- setup_py = "%s])\n\n" % (str(setup_py[:-5]))
-
- setup_py = "%s%s\n" % (setup_py, "import commands")
- setup_py = "%s%s\n" % (setup_py, "commands.getoutput(\"chmod -R 755 /usr/local/share/%s\")" % self.proyecto["nombre"])
- setup_py = "%s%s\n" % (setup_py, "commands.getoutput(\"chmod 755 /usr/share/applications/%s.desktop\")" % self.proyecto["nombre"])
-
- self.setuppy.get_buffer().set_text(setup_py)
+ if not archiveDirPath.split("/")[-1] in RECHAZADirs:
+ for fileName in fileNames:
+ if not fileName in RECHAZAFiles:
+ filePath = os.path.join(archiveDirPath, fileName)
+ extension = os.path.splitext(os.path.split(filePath)[1])[1]
+
+ if not extension in RECHAZAExtension:
+ zipped.write(filePath, filePath.split(activitydirpath)[1])
- ### lanzador.
- lanzador = "#!/bin/sh\nexec \"/usr/bin/python\" \"/usr/local/share/%s/%s\" \"$@\"" % (self.proyecto["nombre"], self.proyecto["main"])
- self.lanzador.get_buffer().set_text(lanzador)
+ zipped.close()
- ### desinstalador.
- desinstalador = "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport os\nimport commands\n\n"
- desinstalador = "%sprint commands.getoutput(\"rm -r /usr/local/share/%s\")\n" % (desinstalador, self.proyecto["nombre"])
- desinstalador = "%sprint commands.getoutput(\"rm /usr/share/applications/%s.desktop\")\n" % (desinstalador, self.proyecto["nombre"])
- desinstalador = "%sprint commands.getoutput(\"rm /usr/local/bin/%s_run\")\n" % (desinstalador, self.proyecto["nombre"].lower())
- desinstalador = "%sprint commands.getoutput(\"rm /usr/local/bin/%s_uninstall\")\n" % (desinstalador, self.proyecto["nombre"].lower())
-
- self.desinstalador.get_buffer().set_text(desinstalador)
+ distpath = os.path.join(self.proyecto["path"], "dist")
- def make(self):
- """
- Construye los archivos instaladores para su distribución.
- """
+ if not os.path.exists(distpath):
+ os.mkdir(distpath)
+
+ ### Copiar el *.zip a la estructura del proyecto.
+ commands.getoutput("cp %s %s" % (zippath, distpath))
+ os.chmod(os.path.join(distpath, os.path.basename(zippath)), 0755)
- cfg = self.__get_text(self.setupcfg.get_buffer())
- desktop = self.__get_text(self.setupdesktop.get_buffer())
- manifest = self.__get_text(self.setupmanifest.get_buffer())
- setuppy = self.__get_text(self.setuppy.get_buffer())
- lanzador = self.__get_text(self.lanzador.get_buffer())
- desinstalador = self.__get_text(self.desinstalador.get_buffer())
-
- self.__escribir_archivo(self.archivo_setup_cfg, cfg)
- self.__escribir_archivo(self.archivo_desktop, desktop)
- self.__escribir_archivo(self.archivo_manifest, manifest)
- self.__escribir_archivo(self.archivo_setup_py, setuppy)
- self.__escribir_archivo(self.archivo_lanzador, lanzador)
- self.__escribir_archivo(self.archivo_desinstalador, desinstalador)
+ if os.path.exists(zippath):
+ os.remove(zippath)
+ commands.getoutput("rm -r %s" % activitydirpath)
def __get_text(self, buffer):
"""
@@ -433,6 +356,9 @@ class Sugar_Notebook(Gtk.Notebook):
posibles correcciones.
"""
+ import commands
+ import shutil
+
main_path = os.path.join(self.proyecto["path"], self.proyecto["main"])
extension = os.path.splitext(os.path.split(main_path)[1])[1]
main_name = self.proyecto["main"].split(extension)[0]
@@ -448,19 +374,16 @@ class Sugar_Notebook(Gtk.Notebook):
activityinfodirpath = os.path.join(activitydirpath, "activity")
### Borrar anteriores
- import commands
if os.path.exists(activitydirpath):
commands.getoutput("rm -r %s" % activitydirpath)
### Copiar contenido del proyecto.
- import shutil
shutil.copytree(self.proyecto["path"], activitydirpath, symlinks=False, ignore=None)
### Escribir archivos de instalación.
if not os.path.exists(activityinfodirpath): os.mkdir(activityinfodirpath)
newpath = os.path.join(activityinfodirpath, os.path.basename(iconpath))
- import shutil
shutil.copyfile(iconpath, newpath)
self.activity_sourceview.get_buffer().set_text(activity)
@@ -472,6 +395,7 @@ class Sugar_Notebook(Gtk.Notebook):
"""
import commands
+ import zipfile
activitydirpath = os.path.join("/tmp", "%s.activity" % self.proyecto["nombre"])
activityinfodirpath = os.path.join(activitydirpath, "activity")
@@ -487,11 +411,9 @@ class Sugar_Notebook(Gtk.Notebook):
### Borrar archivos innecesarios
nombre = self.proyecto["nombre"]
- ejecutable = ("%s_run" % nombre).lower()
- desinstalador = ("%s_uninstall" % nombre).lower()
desktop = "%s.desktop" % nombre
- borrar = [ejecutable, desinstalador, "MANIFEST", desktop, "setup.cfg"]
+ borrar = ["MANIFEST", desktop, "setup.cfg"]
for file in borrar:
path = os.path.join(activitydirpath, file)
@@ -500,8 +422,6 @@ class Sugar_Notebook(Gtk.Notebook):
os.remove(path)
### Generar archivo de distribución "*.xo"
- import zipfile
-
zippath = "%s.xo" % (activitydirpath)
if os.path.exists(zippath):
@@ -513,8 +433,16 @@ class Sugar_Notebook(Gtk.Notebook):
RECHAZAFiles = ["proyecto.ide", ".gitignore"]
RECHAZADirs = [".git", "build", "dist"]
+ ### Forzar eliminacion de dist
+ for dir in os.listdir(activitydirpath):
+ d = os.path.join(activitydirpath, dir)
+
+ if os.path.isdir(d):
+ if d.split("/")[-1] in RECHAZADirs:
+ commands.getoutput("rm -r %s" % d)
+
for (archiveDirPath, dirNames, fileNames) in os.walk(activitydirpath):
- if not os.path.basename(archiveDirPath) in RECHAZADirs:
+ if not archiveDirPath.split("/")[-1] in RECHAZADirs:
for fileName in fileNames:
if not fileName in RECHAZAFiles:
filePath = os.path.join(archiveDirPath, fileName)
@@ -534,6 +462,10 @@ class Sugar_Notebook(Gtk.Notebook):
commands.getoutput("cp %s %s" % (zippath, distpath))
os.chmod(os.path.join(distpath, os.path.basename(zippath)), 0755)
+ if os.path.exists(zippath):
+ os.remove(zippath)
+ commands.getoutput("rm -r %s" % activitydirpath)
+
def __get_text(self, buffer):
"""
Devuelve el contenido de un text buffer.
@@ -590,7 +522,7 @@ class Widget_icon(Gtk.Frame):
self.set_label(" Selecciona un Icono para Tu Aplicación ")
self.set_border_width(15)
- self.tipo = tipo # FIXME: tipo debe determinar que formato de ico se permite (svg para sugar)
+ self.tipo = tipo
self.proyecto = proyecto
toolbar = Gtk.Toolbar()
@@ -664,119 +596,7 @@ class Widget_icon(Gtk.Frame):
self.aceptar.set_sensitive(True)
self.emit("iconpath", iconpath)
-
-class DialogoInstall(Gtk.Dialog):
- """
- Dialogo para mostrar proceso de construcción de Instaladores.
- """
-
- __gtype_name__ = 'DialogoInstall'
-
- def __init__(self,
- parent_window = None,
- dirpath = None, tipo = "gnome"):
- Gtk.Dialog.__init__(self,
- #title = "Chequeo de sintáxis",
- parent = parent_window,
- flags = Gtk.DialogFlags.MODAL,
- buttons = ["Cerrar", Gtk.ResponseType.ACCEPT])
-
- self.set_size_request(640, 480)
- self.set_border_width(15)
-
- self.dirpath = dirpath
-
- self.terminal = JAMediaTerminal()
-
- self.vbox.pack_start(self.terminal, True, True, 0)
-
- self.terminal.toolbar.hide()
-
- notebook = self.terminal.notebook
- cerrar = notebook.get_tab_label(notebook.get_children()[0]).get_children()[1]
- cerrar.set_sensitive(False)
-
- self.maximize()
-
- self.terminal.connect("reset", self.__end_make)
-
- if tipo == "gnome":
- GObject.idle_add(self.__run_gnome_install)
-
- elif tipo == "sugar":
- GObject.idle_add(self.__run_sugar_install)
-
- def __end_make(self, widget):
- """
- Cuando Finaliza el proceso de construcción del
- instalador, se informa al usuario.
- """
-
- dialog = DialogoInfoInstall(
- parent_window = self.get_toplevel(),
- distpath = os.path.join(self.dirpath, "dist"))
-
- respuesta = dialog.run()
-
- dialog.destroy()
-
- if respuesta == Gtk.ResponseType.ACCEPT:
- pass
-
- def __run_gnome_install(self):
- """
- Ejecuta: python setup.py sdist
- Construyendo el instalador gnome.
- """
-
- python_path = "/usr/bin/python"
-
- if os.path.exists(os.path.join("/bin", "python")):
- python_path = os.path.join("/bin", "python")
-
- elif os.path.exists(os.path.join("/usr/bin", "python")):
- python_path = os.path.join("/usr/bin", "python")
-
- elif os.path.exists(os.path.join("/sbin", "python")):
- python_path = os.path.join("/sbin", "python")
-
- elif os.path.exists(os.path.join("/usr/local", "python")):
- python_path = os.path.join("/usr/local", "python")
-
- self.terminal.ejecute_script(
- self.dirpath,
- python_path,
- os.path.join(self.dirpath, "setup.py"),
- "sdist")
-
- def __run_sugar_install(self):
- """
- Ejecuta: python setup.py sdist
- Construyendo el instalador gnome.
- """
- '''
- python_path = "/usr/bin/python"
-
- if os.path.exists(os.path.join("/bin", "python")):
- python_path = os.path.join("/bin", "python")
-
- elif os.path.exists(os.path.join("/usr/bin", "python")):
- python_path = os.path.join("/usr/bin", "python")
-
- elif os.path.exists(os.path.join("/sbin", "python")):
- python_path = os.path.join("/sbin", "python")
-
- elif os.path.exists(os.path.join("/usr/local", "python")):
- python_path = os.path.join("/usr/local", "python")
-
- self.terminal.ejecute_script(
- self.dirpath,
- python_path,
- os.path.join(self.dirpath, "setup.py"),
- "sdist")'''
- self.__end_make(None)
-
class DialogoInfoInstall(Gtk.Dialog):
"""
Dialogo para informar al usuario donde encontrar el
@@ -788,7 +608,7 @@ class DialogoInfoInstall(Gtk.Dialog):
def __init__(self, parent_window = None, distpath = None):
Gtk.Dialog.__init__(self,
- #title = "Chequeo de sintáxis",
+ title = "Construcción de instaladores.",
parent = parent_window,
flags = Gtk.DialogFlags.MODAL,
buttons = ["Cerrar", Gtk.ResponseType.ACCEPT])
diff --git a/plantilla b/plantilla
new file mode 100644
index 0000000..c37e081
--- /dev/null
+++ b/plantilla
Binary files differ
diff --git a/scripts/generar_plantilla.py b/scripts/generar_plantilla.py
new file mode 100644
index 0000000..8cec2f2
--- /dev/null
+++ b/scripts/generar_plantilla.py
@@ -0,0 +1,20 @@
+import os
+import shelve
+
+arch = open("install_model", "r")
+
+text = ""
+for line in arch.readlines():
+ text=text+line
+
+arch.close()
+
+archivo = shelve.open("plantilla")
+archivo['install'] = text
+archivo.close()
+
+archivo = shelve.open("plantilla")
+items = archivo.items()
+archivo.close()
+
+print items \ No newline at end of file
diff --git a/scripts/install_model b/scripts/install_model
new file mode 100644
index 0000000..e6fd01e
--- /dev/null
+++ b/scripts/install_model
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# mainfile (path relativo)
+# iconfile (path relativo)
+
+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=GTK;GNOME;Juegos;
+StartupNotify=true""" % (NAME, NAME, main_path, icon_path)
+
+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."