[Python-apps-commits] r2909 - in packages/jokosher/trunk/debian (4 files)

piotr at users.alioth.debian.org piotr at users.alioth.debian.org
Sun May 10 19:17:14 UTC 2009


    Date: Sunday, May 10, 2009 @ 19:17:13
  Author: piotr
Revision: 2909

Add 40_load_extensions_from_unpacked_eggs patch so that extensions in
unzipped Eggs are recognized as well

Added:
  packages/jokosher/trunk/debian/patches/40_load_extensions_from_unpacked_eggs.dpatch
Modified:
  packages/jokosher/trunk/debian/changelog
  packages/jokosher/trunk/debian/patches/00list
  packages/jokosher/trunk/debian/rules

Modified: packages/jokosher/trunk/debian/changelog
===================================================================
--- packages/jokosher/trunk/debian/changelog	2009-05-10 17:47:04 UTC (rev 2908)
+++ packages/jokosher/trunk/debian/changelog	2009-05-10 19:17:13 UTC (rev 2909)
@@ -1,5 +1,6 @@
-jokosher (0.11.1-1) unstable; urgency=low
+jokosher (0.11.1-1) UNRELEASED; urgency=low
 
+  [ Luca Falavigna ]
   * New upstream release (Closes: #517234).
     - Jokosher now appears under Sound & Video (Closes: #443788).
   * New Maintainer (Closes: #523167).
@@ -35,6 +36,10 @@
     - Provide Homepage field in source stanza.
     - Provide debian/README.source to document dpatch usage.
 
+  [ Piotr Ożarowski ]
+  * Add 40_load_extensions_from_unpacked_eggs patch so that extensions in
+    unzipped Eggs are recognized as well
+
  -- Luca Falavigna <dktrkranz at ubuntu.com>  Tue, 28 Apr 2009 08:18:06 +0000
 
 jokosher (0.9-1) unstable; urgency=low

Modified: packages/jokosher/trunk/debian/patches/00list
===================================================================
--- packages/jokosher/trunk/debian/patches/00list	2009-05-10 17:47:04 UTC (rev 2908)
+++ packages/jokosher/trunk/debian/patches/00list	2009-05-10 19:17:13 UTC (rev 2909)
@@ -1,3 +1,4 @@
 10_update_mime_database
 20_LevelList_IOError
 30_desktop_file
+40_load_extensions_from_unpacked_eggs

Added: packages/jokosher/trunk/debian/patches/40_load_extensions_from_unpacked_eggs.dpatch
===================================================================
--- packages/jokosher/trunk/debian/patches/40_load_extensions_from_unpacked_eggs.dpatch	                        (rev 0)
+++ packages/jokosher/trunk/debian/patches/40_load_extensions_from_unpacked_eggs.dpatch	2009-05-10 19:17:13 UTC (rev 2909)
@@ -0,0 +1,73 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 40_load_extensions_from_unpacked_eggs.dpatch by Piotr Ożarowski <piotr at debian.org>
+## DP: add support for unpacked Eggs
+
+ at DPATCH@
+diff -urNad jokosher-0.11.1~/Jokosher/ExtensionManager.py jokosher-0.11.1/Jokosher/ExtensionManager.py
+--- jokosher-0.11.1~/Jokosher/ExtensionManager.py	2009-03-17 04:06:57.000000000 +0100
++++ jokosher-0.11.1/Jokosher/ExtensionManager.py	2009-05-10 21:14:02.517018670 +0200
+@@ -223,6 +223,46 @@
+ 		
+ 	#_____________________________________________________________________
+ 
++	def LoadExtensionsFromEggs(self, directory):
++		"""
++		Tries to load Extensions fron a given directory.
++		
++		Parameters:
++			directory -- full path to the directory containing Eggs.
++		
++		Returns:
++			True -- the Extension was successfully loaded.
++			False -- an error ocurred while trying to load the Extension,
++					or the Extension has been disabled via the ExtensionManagerDialog.
++		"""
++		Globals.debug("\timporting extensions from directory", directory)
++		pkg_resources.working_set.add_entry(directory)
++		dist_generator = pkg_resources.find_distributions(directory)
++		for dist in dist_generator:
++			try:
++				extension_class = dist.load_entry_point("jokosher.extensions", "extension")
++				# create an instance of the class
++				extension = extension_class()
++				filename = dist.egg_name()
++			except Exception, e :
++				Globals.debug("\t\t...failed.")
++				Globals.debug(e)
++				return False
++		
++			# try and register the extension - continue if failed
++			if not self.register(extension, filename, directory, False):
++				Globals.debug("\tcannot register extension ", filename)
++				continue
++			
++			# if we're still here then start the extension, if its not in the extensions_blacklist
++			if extension.EXTENSION_NAME not in Globals.settings.extensions['extensions_blacklist']:
++				if not self.StartExtension(self.loadedExtensions[len(self.loadedExtensions)-1]["filename"]):
++					continue
++		
++		return True
++
++	#_____________________________________________________________________
++
+ 	def StopExtension(self, filename):
+ 		"""
+ 		Stops the given Extension.
+@@ -343,11 +383,16 @@
+ 			if not os.path.isdir(exten_dir):
+ 				continue
+ 			for filename in os.listdir(exten_dir):
+-				if filename.endswith(".egg") or filename.endswith(".py"):
++				if filename.endswith('.py'):
+ 					self.LoadExtensionFromFile(filename, exten_dir)
+ 					# don't block the gui when loading many extensions
+ 					while gtk.events_pending():
+ 						gtk.main_iteration()
++			# handle Eggs (zipped or unpacked) here
++			self.LoadExtensionsFromEggs(exten_dir)
++			# don't block the gui when loading many extensions
++			while gtk.events_pending():
++				gtk.main_iteration()
+ 		
+ 	#_____________________________________________________________________
+ 		


Property changes on: packages/jokosher/trunk/debian/patches/40_load_extensions_from_unpacked_eggs.dpatch
___________________________________________________________________
Added: svn:executable
   + *

Modified: packages/jokosher/trunk/debian/rules
===================================================================
--- packages/jokosher/trunk/debian/rules	2009-05-10 17:47:04 UTC (rev 2908)
+++ packages/jokosher/trunk/debian/rules	2009-05-10 19:17:13 UTC (rev 2909)
@@ -10,5 +10,5 @@
 
 override_dh_auto_install:
 	dh_auto_install -- --install-scripts=/usr/share/jokosher --install-lib=/usr/share/jokosher
-	debian/unpack_eggs.sh
+	sh debian/unpack_eggs.sh
 




More information about the Python-apps-commits mailing list