From 82cfd671d839f315ae3a55cb12d6f79492df69ef Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Fri, 13 May 2005 19:51:17 +0000 Subject: [PATCH] Better error for missing version attr. Better handing of missing run script. --gui --download-only works again. Include test data in distrib. git-svn-id: file:///home/talex/Backups/sf.net/Subversion/zero-install/injector/head/injector/head@195 9f8c893c-44ee-0310-b757-c8ca8341c71e --- 0launch | 4 ++-- MANIFEST.in | 1 + zeroinstall/injector/reader.py | 5 ++++- zeroinstall/injector/run.py | 8 ++++---- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/0launch b/0launch index bbbfb55..eccd3c8 100755 --- a/0launch +++ b/0launch @@ -65,10 +65,10 @@ if options.gui is None and os.environ.get('DISPLAY', None): if options.gui: policy.set_root(namespaces.injector_gui_uri) - prog_args = args[:] + # Options apply to actual program, not GUI if options.download_only: - options.download_only = False + policy.download_only = False prog_args.insert(0, '--download-only') if options.refresh: options.refresh = False diff --git a/MANIFEST.in b/MANIFEST.in index e714339..df86c20 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,4 @@ include COPYING include tests include tests/*.py +include tests/data diff --git a/zeroinstall/injector/reader.py b/zeroinstall/injector/reader.py index aa0a74e..ac6661e 100644 --- a/zeroinstall/injector/reader.py +++ b/zeroinstall/injector/reader.py @@ -188,7 +188,10 @@ def update(interface, source, user_overrides = False, local = False): if user_stability: impl.user_stability = stability_levels[str(user_stability)] else: - impl.version = map(int, item_attrs.version.split('.')) + version = item_attrs.version + if not version: + raise InvalidInterface("Missing version attribute") + impl.version = map(int, version.split('.')) size = item.getAttribute('size') if size: diff --git a/zeroinstall/injector/run.py b/zeroinstall/injector/run.py index b048919..9013db3 100644 --- a/zeroinstall/injector/run.py +++ b/zeroinstall/injector/run.py @@ -33,10 +33,10 @@ def execute(policy, prog_args, verbose = False, dry_run = False): root_impl = policy.get_implementation(iface) prog_path = os.path.join(policy.get_implementation_path(root_impl), iface.main) if not os.path.exists(prog_path): - print >>sys.stderr, "'%s' does not exist." % prog_path - print >>sys.stderr, "(implementation '%s' + program '%s')" % (policy.implementation[iface].id, iface.main) - sys.exit(1) - if verbose: + raise SafeException("File '%s' does not exist.\n" + "(implementation '%s' + program '%s')" % + (prog_path, policy.implementation[iface].id, iface.main)) + if verbose or dry_run: print "Executing:", prog_path if not dry_run: os.execl(prog_path, prog_path, *prog_args) -- 2.11.4.GIT