Author: jannis Date: 2006-09-06 17:03:51 +0000 (Wed, 06 Sep 2006) New Revision: 23094
Modified: installit/trunk/ChangeLog installit/trunk/backends/Source.py installit/trunk/tools/env.py installit/trunk/tools/shell.py Log: * tools/env.py: Log linking errors to i2t.log. Use reversed prefix history for all path expansions (so that the latest used prefix is first in all environment variables). * tools/shell.py: Prepend, not append custom environment variables to the command environment. * backends/Source.py: Fix manual program and library resolving (lambda's caused some problems with wrong variables being passed). Append installation prefix of a package to the prefix history when installation was successful. Modified: installit/trunk/ChangeLog =================================================================== --- installit/trunk/ChangeLog 2006-09-06 16:57:10 UTC (rev 23093) +++ installit/trunk/ChangeLog 2006-09-06 17:03:51 UTC (rev 23094) @@ -1,3 +1,15 @@ +2006-09-06 Jannis Pohlmann <[EMAIL PROTECTED]> + + * tools/env.py: Log linking errors to i2t.log. Use reversed prefix + history for all path expansions (so that the latest used prefix is + first in all environment variables). + * tools/shell.py: Prepend, not append custom environment variables to + the command environment. + * backends/Source.py: Fix manual program and library resolving (lambda's + caused some problems with wrong variables being passed). Append + installation prefix of a package to the prefix history when + installation was successful. + 2006-09-04 Jannis Pohlmann <[EMAIL PROTECTED]> * tools/pkgconfig.py: Move getCompilerFlags and getLinkerFlags methods Modified: installit/trunk/backends/Source.py =================================================================== --- installit/trunk/backends/Source.py 2006-09-06 16:57:10 UTC (rev 23093) +++ installit/trunk/backends/Source.py 2006-09-06 17:03:51 UTC (rev 23094) @@ -663,9 +663,6 @@ # Sets of unresolved programs/libraries self.programs = set() self.libraries = set() - - self.locations = dict() - self.statusButtons = dict() def activate(self, wizard): SourceWizardPage.activate(self, wizard) @@ -680,9 +677,6 @@ self.box.add(container) container.show() - self.locations.clear() - self.statusButtons.clear() - # Determine programs this package depends on self.programs = self.package.dependencies.programs @@ -709,8 +703,9 @@ # Status button status = gtk.Button() - status.connect("clicked", lambda button: - self._locateProgram(program)) + status.connect("clicked", self._locateProgram) + status.program = program + status.status = status status.set_relief(gtk.RELIEF_NONE) if program.isResolved(): status.set_image(gtk.image_new_from_stock(gtk.STOCK_YES, @@ -721,8 +716,6 @@ hbox.pack_start(status, False, True, 0) status.show() - self.statusButtons[program] = status - # Program label label = gtk.Label() label.set_markup("<b>%s</b>" % program.name) @@ -733,8 +726,9 @@ # Locate manually via file chooser if not program.isResolved(): button = gtk.Button(_("Locate manually...")) - button.connect("clicked", lambda button: - self._locateProgram(program)) + button.connect("clicked", self._locateProgram) + button.program = program + button.status = status button.set_image(gtk.image_new_from_stock(gtk.STOCK_FIND, gtk.ICON_SIZE_BUTTON)) table.attach(button, 1, 2, i, i+1, gtk.SHRINK) @@ -768,8 +762,9 @@ # Status button status = gtk.Button() - status.connect("clicked", lambda button: - self._locateLibrary(library)) + status.connect("clicked", self._locateLibrary) + status.library = library + status.status = status status.set_relief(gtk.RELIEF_NONE) if isinstance(library, Package) or \ isinstance(library, PkgConfigModule) or \ @@ -782,8 +777,6 @@ hbox.pack_start(status, False, True, 0) status.show() - self.statusButtons[library] = status - # Library label label = gtk.Label() label.set_markup("<b>%s</b>" % library.name) @@ -796,8 +789,9 @@ not isinstance(library, PkgConfigModule) and \ not library.isResolved(): button = gtk.Button(_("Locate manually...")) - button.connect("clicked", lambda button: - self._locateLibrary(library)) + button.connect("clicked", self._locateLibrary) + button.library = library + button.status = status button.set_image(gtk.image_new_from_stock(gtk.STOCK_FIND, gtk.ICON_SIZE_BUTTON)) table.attach(button, 1, 2, i, i+1, gtk.SHRINK) @@ -816,22 +810,22 @@ return len(self.package.getUnresolvedPrograms()) == 0 and \ len(self.package.getUnresolvedLibraries()) == 0 - def _locateProgram(self, program): - if self.locations.has_key(program): - self.fileChooser.set_filename(self.locations[program]) + def _locateProgram(self, button): + status = button.status + program = button.program - if self.fileChooser.run() == gtk.RESPONSE_ACCEPT: - self.locations[program] = self.fileChooser.get_filename() + self.fileChooser.set_filename(program.path) + if self.fileChooser.run() == gtk.RESPONSE_ACCEPT: # Generate absolute path - fullpath = path.join(self.locations[program], program.name) + fullpath = path.join(program.path, program.name) # Check if program is executable if os.access(fullpath, os.X_OK): # Update status icon image = gtk.image_new_from_stock(gtk.STOCK_YES, gtk.ICON_SIZE_BUTTON) - self.statusButtons[program].set_image(image) + status.set_image(image) # Create new (resolved) program object program.path = self.fileChooser.get_filename() @@ -839,7 +833,7 @@ # Update status icon image = gtk.image_new_from_stock(gtk.STOCK_NO, gtk.ICON_SIZE_BUTTON) - self.statusButtons[program].set_image(image) + status.set_image(image) # Hide the file chooser again self.fileChooser.hide() @@ -847,13 +841,11 @@ if self.validate(): self.wizard.forwardButton.set_sensitive(True) - def _locateLibrary(self, library): - if self.locations.has_key(library): - self.fileChooser.set_filename(self.locations[library]) + def _locateLibrary(self, button): + status = button.status + library = button.library if self.fileChooser.run() == gtk.RESPONSE_ACCEPT: - self.locations[library] = self.fileChooser.get_filename() - # Try to link with library located in this path if Environment.hasLibrary(library, self.fileChooser.get_filename()): library.path = self.fileChooser.get_filename() @@ -862,12 +854,12 @@ # Update status icon image = gtk.image_new_from_stock(gtk.STOCK_YES, gtk.ICON_SIZE_BUTTON) - self.statusButtons[library].set_image(image) + status.set_image(image) else: # Update status icon image = gtk.image_new_from_stock(gtk.STOCK_NO, gtk.ICON_SIZE_BUTTON) - self.statusButtons[library].set_image(image) + status.set_image(image) # Hide the file chooser again self.fileChooser.hide() @@ -1171,7 +1163,13 @@ def _success(self, shell): gtk.gdk.threads_enter() + self.finished = True + + # Update prefix history + Config.get("PrefixHistory").append(self.package.prefix) + Config.write() + self.emit("page-success") gtk.gdk.threads_leave() Modified: installit/trunk/tools/env.py =================================================================== --- installit/trunk/tools/env.py 2006-09-06 16:57:10 UTC (rev 23093) +++ installit/trunk/tools/env.py 2006-09-06 17:03:51 UTC (rev 23094) @@ -112,10 +112,13 @@ Logger.debug("Environment", _("Linking %s with %s") % (source, library)) - if commands.getstatusoutput(command)[0] == os.EX_OK: + status, output = commands.getstatusoutput(command) + + if status == os.EX_OK: return True else: Logger.error("Environment", _("Failed to link %s.") % (source)) + Logger.error("Environment", _("The error was: %s.") % (output)) return False def hasLibrary(self, library, path=None): @@ -156,9 +159,9 @@ def expandPkgConfigPath(self, env): paths = list() - - paths += map(self.buildPkgConfigPath, Config.get("PrefixHistory")) + paths += map(self.buildPkgConfigPath, self.getPrefixHistory()) + if env.has_key("PKG_CONFIG_PATH"): paths += env["PKG_CONFIG_PATH"].split(":") @@ -167,7 +170,7 @@ def expandLibraryPath(self, env): paths = list() - paths += map(self.buildLibraryPath, Config.get("PrefixHistory")) + paths += map(self.buildLibraryPath, self.getPrefixHistory()) if env.has_key("LD_LIBRARY_PATH"): paths += env["LD_LIBRARY_PATH"].split(":") @@ -182,7 +185,7 @@ def expandPath(self, env): paths = list() - paths += map(self.buildBinaryPath, Config.get("PrefixHistory")) + paths += map(self.buildBinaryPath, self.getPrefixHistory()) if env.has_key("PATH"): paths += env["PATH"].split(":") @@ -191,7 +194,7 @@ def expandLibraryFlags(self, env): flags = list() - paths = map(self.buildLibraryPath, Config.get("PrefixHistory")) + paths = map(self.buildLibraryPath, self.getPrefixHistory()) gnuLinker = self.hasGnuLinker() for path in paths: @@ -206,7 +209,7 @@ def expandCppFlags(self, env): flags = list() - paths = map(self.buildIncludePath, Config.get("PrefixHistory")) + paths = map(self.buildIncludePath, self.getPrefixHistory()) for path in paths: flags.append("-I%s" % path) @@ -216,5 +219,10 @@ env["CPPFLAGS"] = " ".join(flags) + def getPrefixHistory(self): + history = copy.copy(Config.get("PrefixHistory")) + history.reverse() + return history + Environment = Environment() Modified: installit/trunk/tools/shell.py =================================================================== --- installit/trunk/tools/shell.py 2006-09-06 16:57:10 UTC (rev 23093) +++ installit/trunk/tools/shell.py 2006-09-06 17:03:51 UTC (rev 23094) @@ -58,7 +58,7 @@ # Expand environment variables for key, value in self.env.items(): if env.has_key(key): - env[key] = env[key] + value + env[key] = value + " " + env[key] else: env[key] = value @@ -71,18 +71,11 @@ #print "Subprocess environment details:" #print "-------------------------------" #print "PKG_CONFIG_PATH=%s" % env["PKG_CONFIG_PATH"] - #print #print "LDFLAGS=%s" % env["LDFLAGS"] - #print #print "LD_LIBRARY_PATH=%s" % env["LD_LIBRARY_PATH"] - #print #print "PATH=%s" % env["PATH"] - #print #print "CPPFLAGS=%s" % env["CPPFLAGS"] - #print - print env["LDFLAGS"] - # Start subprocess process = subprocess.Popen(self.command, bufsize=1, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org http://foo-projects.org/mailman/listinfo/xfce4-commits