From 5b637b43fa48f419adc6231ca3ec4aa07eff0250 Mon Sep 17 00:00:00 2001 From: Leonardo Robol Date: Sun, 2 Oct 2011 15:52:20 +0200 Subject: [PATCH] Better names for configuration file. --- bundle.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/bundle.py b/bundle.py index 70cc094..f999dd4 100755 --- a/bundle.py +++ b/bundle.py @@ -41,9 +41,9 @@ class Bundle(): # Create packing information package_info = { - 'appname': self._appname, - 'appcmd': self._appcmd, - 'appdir': os.path.basename (self._appdir), + 'name': self._appname, + 'cmd': self._appcmd, + 'dir': os.path.basename (self._appdir), } # Add the directory that needs to be packed together @@ -113,11 +113,11 @@ class Bundle(): tar.close () package_info = json.load (open ("info.bundle", "r")) - print_msg ("Launching %s" % package_info["appname"]) - os.chdir (package_info["appdir"]) + print_msg ("Launching %s" % package_info["name"]) + os.chdir (package_info["dir"]) # Executing the program - p = subprocess.Popen (package_info["appcmd"], shell = True) + p = subprocess.Popen (package_info["cmd"], shell = True) p.wait () # Remove extracted files @@ -138,9 +138,9 @@ To pack your application, simply create an application.info file similar to this (JSON coded dictionary) { - "appname": "My beatiful application", - "appdir": "/home/me/dev/my_app", - "appcmd": "./src/my_app" + "name": "My beatiful application", + "path": "/home/me/dev/my_app", + "cmd": "./src/my_app" } and then run ./bundle.py application.info @@ -165,9 +165,9 @@ if __name__ == "__main__": else: print_msg ("Entering bundle mode") package_info = json.load (open (sys.argv[1], "r")) - bundle = Bundle (package_info["appname"]) - b_path = bundle.bundle_app (package_info["appdir"], - package_info["appcmd"]) + bundle = Bundle (package_info["name"]) + b_path = bundle.bundle_app (package_info["path"], + package_info["cmd"]) if b_path is not None: print_msg ("Bundle created correctly as %s" % b_path) -- 2.1.4