From 4c9989509a268fb1d5c58330a69eb75695a57a51 Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Wed, 13 Apr 2011 19:19:20 +0200 Subject: [PATCH] Replace os.system() with subprocess.check_call(). --- setup.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 62a28eee..0ebc299b 100755 --- a/setup.py +++ b/setup.py @@ -528,14 +528,17 @@ try: def run (self): # First, let py2app do it's work. py2app_build.run(self) - imgPath = os.path.join(self.dist_dir, "LinkChecker.dmg") - tmpImgPath = os.path.join(self.dist_dir, "LinkChecker.tmp.dmg") + dist_dir = self.dist_dir + imgPath = os.path.join(dist_dir, "LinkChecker-%s.dmg" % AppVersion) + tmpImgPath = os.path.join(dist_dir, "LinkChecker.tmp.dmg") print "*** generating temporary DMG image ***" - os.system('hdiutil create -srcfolder "%s" -volname "LinkChecker" -format UDZO "%s"' % - (self.dist_dir, tmpImgPath)) + args = ['hdiutil', 'create', '-srcfolder', dist_dir, + '-volname', 'LinkChecker', '-format', 'UDZO', tmpImgPath] + subprocess.check_call(args) print "*** generating final DMG image ***" - os.system('hdiutil "%s" convert -format UDZO -imagekey zlib-level=9 -o "%s"' % - (tmpImgPath, imgPath)) + args = ['hdiutil', tmpImgPath, 'convert', '-format', 'UDZO', + '-imagekey', 'zlib-level=9', '-o', imgPath] + subprocess.check_call(args) os.remove(tmpImgPath) except ImportError: class MyPy2app: