← Back to team overview

zim-wiki team mailing list archive

Add --skip-cmd option to 'setup.py install'

 

Hello!

When running 'python setup.py install' with '--skip-cmd' option added by this patch, the external commands like update-desktop-database will be skipped. This will benefit our packagers.

Hope for merging.

Cheers


Robin

=== modified file 'README.txt'
--- README.txt	2010-02-12 19:10:28 +0000
+++ README.txt	2010-05-15 12:31:53 +0000
@@ -145,15 +145,13 @@
 
 To build a tree in a target directory you can use:
 
-	./setup.py install --root=/path/to/package/build/dir
+	./setup.py install --root=/path/to/package/build/dir --skip-cmd
 
 Special attention may be needed to run xdg update commands in a post-install
 script. Recommended commands are:
 
 	update-desktop-database
 	update-mime-database /usr/share/mime
-	xdg-icon-resource install --context mimetypes \
-		--size 64 zim.png application-x-zim-notebook
 
 
 

=== modified file 'setup.py'
--- setup.py	2010-03-24 22:06:16 +0000
+++ setup.py	2010-05-15 12:30:54 +0000
@@ -184,9 +184,20 @@
 
 class zim_install_class(install_class):
 
+	boolean_options = install_class.boolean_options + ['skip-cmd']
+
+	user_options = install_class.user_options + [('skip-cmd', None, "don't run external commands (for packaging)")]
+
+	def initialize_options(self):
+		install_class.initialize_options(self)
+		self.skip_cmd = 0
+	
 	def run(self):
 		install_class.run(self)
 
+		if self.skip_cmd:
+			return
+		
 		# Try XDG tools
 		icon = os.path.join('data', 'zim.png')
 		mimedir = os.path.join(self.install_data, 'share', 'mime')



Follow ups