[Python-modules-commits] r6924 - in packages/python-uniconvertor/trunk/debian (3 files)

awen-guest at users.alioth.debian.org awen-guest at users.alioth.debian.org
Fri Nov 21 13:42:27 UTC 2008


    Date: Friday, November 21, 2008 @ 13:42:27
  Author: awen-guest
Revision: 6924

Prevent sys.exit on import

Added:
  packages/python-uniconvertor/trunk/debian/patches/04_no_exit_on_import.dpatch
Modified:
  packages/python-uniconvertor/trunk/debian/changelog
  packages/python-uniconvertor/trunk/debian/patches/00list

Modified: packages/python-uniconvertor/trunk/debian/changelog
===================================================================
--- packages/python-uniconvertor/trunk/debian/changelog	2008-11-20 18:59:30 UTC (rev 6923)
+++ packages/python-uniconvertor/trunk/debian/changelog	2008-11-21 13:42:27 UTC (rev 6924)
@@ -1,3 +1,10 @@
+python-uniconvertor (1.1.3-4) unstable; urgency=low
+
+  * Add 04_no_exit_on_import.dpatch to prevent uniconvertor from calling
+    sys.exit() on import exiting the python interpreter. (LP: #300141)
+
+ -- Andreas Wenning <awen at awen.dk>  Fri, 21 Nov 2008 14:32:49 +0100
+
 python-uniconvertor (1.1.3-3) unstable; urgency=low
 
   [ Andreas Wenning ]

Modified: packages/python-uniconvertor/trunk/debian/patches/00list
===================================================================
--- packages/python-uniconvertor/trunk/debian/patches/00list	2008-11-20 18:59:30 UTC (rev 6923)
+++ packages/python-uniconvertor/trunk/debian/patches/00list	2008-11-21 13:42:27 UTC (rev 6924)
@@ -1,3 +1,4 @@
 01_rename_uniconv.dpatch
 02_exec_uniconvertor.dpatch
 03_fontwarning.dpatch
+04_no_exit_on_import.dpatch

Added: packages/python-uniconvertor/trunk/debian/patches/04_no_exit_on_import.dpatch
===================================================================
--- packages/python-uniconvertor/trunk/debian/patches/04_no_exit_on_import.dpatch	                        (rev 0)
+++ packages/python-uniconvertor/trunk/debian/patches/04_no_exit_on_import.dpatch	2008-11-21 13:42:27 UTC (rev 6924)
@@ -0,0 +1,109 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 03_no_exit_on_import.dpatch by Andreas Wenning <awen at awen.dk>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+ at DPATCH@
+diff -urNad python-uniconvertor-1.1.2~/src/__init__.py python-uniconvertor-1.1.2/src/__init__.py
+--- python-uniconvertor-1.1.2~/src/__init__.py	2008-11-21 13:53:03.000000000 +0100
++++ python-uniconvertor-1.1.2/src/__init__.py	2008-11-21 13:53:34.000000000 +0100
+@@ -39,43 +39,47 @@
+ 
+ import sys, os, string
+ 
+-_pkgdir = __path__[0]
+-app_dir = os.path.join(_pkgdir, 'app')
+-app_ver = string.strip(open(os.path.join(app_dir, 'VERSION')).read())
++def main(argv):
++	_pkgdir = __path__[0]
++	app_dir = os.path.join(_pkgdir, 'app')
++	app_ver = string.strip(open(os.path.join(app_dir, 'VERSION')).read())
+ 
+-if len(sys.argv)<2 or sys.argv[1]=='--help':
+-	print '\nUniConvertor',app_ver
+-	print __doc__
+-	sys.exit(0)
+-if not os.path.isfile(sys.argv[1]):
+-	print '\nERROR: %s file is not found!' % sys.argv[1]
+-	print '\nUniConvertor',app_ver
+-	print __doc__
+-	sys.exit(1)
+-if len(sys.argv) != 3:
+-	print '\nERROR: incorrect arguments!'
+-	print '\nUniConvertor',app_ver
+-	print __doc__
+-	sys.exit(1)
++	if len(argv)<2 or argv[1]=='--help':
++		print '\nUniConvertor',app_ver
++		print __doc__
++		sys.exit(0)
++	if not os.path.isfile(argv[1]):
++		print '\nERROR: %s file is not found!' % argv[1]
++		print '\nUniConvertor',app_ver
++		print __doc__
++		sys.exit(1)
++	if len(argv) != 3:
++		print '\nERROR: incorrect arguments!'
++		print '\nUniConvertor',app_ver
++		print __doc__
++		sys.exit(1)
+ 
+ 
+-sys.path.insert(1, _pkgdir)
++	sys.path.insert(1, _pkgdir)
+ 
+-from app.io import load
+-from app.plugins import plugins
+-import app
++	from app.io import load
++	from app.plugins import plugins
++	import app
+ 
+-app.init_lib()
++	app.init_lib()
+ 
+-doc = load.load_drawing(sys.argv[1])
+-extension = os.path.splitext(sys.argv[2])[1]
+-plugins.load_plugin_configuration()
+-fileformat = plugins.guess_export_plugin(extension)
+-if fileformat:
+-	saver = plugins.find_export_plugin(fileformat)
+-	saver(doc, sys.argv[2])
+-else:
+-	sys.stderr.write('ERROR: unrecognized extension %s\n' % extension)
+-	sys.exit(1)
+-doc.Destroy()
+-sys.exit(0)
++	doc = load.load_drawing(argv[1])
++	extension = os.path.splitext(argv[2])[1]
++	plugins.load_plugin_configuration()
++	fileformat = plugins.guess_export_plugin(extension)
++	if fileformat:
++		saver = plugins.find_export_plugin(fileformat)
++		saver(doc, argv[2])
++	else:
++		sys.stderr.write('ERROR: unrecognized extension %s\n' % extension)
++		sys.exit(1)
++	doc.Destroy()
++	sys.exit(0)
++
++if __name__ == "__main__":
++	main(sys.argv)
+diff -urNad python-uniconvertor-1.1.2~/src/uniconv python-uniconvertor-1.1.2/src/uniconv
+--- python-uniconvertor-1.1.2~/src/uniconv	2008-11-21 13:53:03.000000000 +0100
++++ python-uniconvertor-1.1.2/src/uniconv	2008-11-21 13:53:03.000000000 +0100
+@@ -1,4 +1,4 @@
+-#!/bin/sh
++#!/usr/bin/python
+ #
+ # Wrapper script to start a UniConvertor application once it is installed
+ #
+@@ -19,5 +19,5 @@
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ #
+ 
+-
+-exec python -c "import uniconvertor" "$1" "$2"
++import sys, uniconvertor
++uniconvertor.main(sys.argv)


Property changes on: packages/python-uniconvertor/trunk/debian/patches/04_no_exit_on_import.dpatch
___________________________________________________________________
Name: svn:executable
   + *




More information about the Python-modules-commits mailing list