[zeroinstall-injector] updated patch, also tests parsing of old launcher scripts
Michel Alexandre Salim
salimma at fedoraproject.org
Wed Jun 29 13:04:12 UTC 2011
commit c377dbcc934c4d11584443df2a4491e4fbb621ca
Author: Michel Alexandre Salim <michel.salim at cs.fau.de>
Date: Wed Jun 29 15:01:21 2011 +0200
updated patch, also tests parsing of old launcher scripts
zeroinstall-injector-1.1-rm-versions.patch | 65 +++++++++++++++++++--------
1 files changed, 46 insertions(+), 19 deletions(-)
---
diff --git a/zeroinstall-injector-1.1-rm-versions.patch b/zeroinstall-injector-1.1-rm-versions.patch
index 7d37b41..6f1ae0c 100644
--- a/zeroinstall-injector-1.1-rm-versions.patch
+++ b/zeroinstall-injector-1.1-rm-versions.patch
@@ -1,4 +1,4 @@
-From 4eb8b95718db10d8bf6024ad5aeea19ce1f777d3 Mon Sep 17 00:00:00 2001
+From 6cd13b5b860c4edc615f111017fac614e28d9fed Mon Sep 17 00:00:00 2001
From: Michel Alexandre Salim <salimma at fedoraproject.org>
Date: Wed, 29 Jun 2011 14:31:45 +0200
Subject: [PATCH] 0alias: new-style launcher scripts
@@ -9,37 +9,64 @@ alias.py:
testalias.py:
- updated to match new launcher script template
+- also test parsing of old-style launcher scripts
---
- tests/testalias.py | 12 ++----------
+ tests/testalias.py | 27 ++++++++++++++++++++++++++-
zeroinstall/alias.py | 28 +++++++++++++++++++++-------
- 2 files changed, 23 insertions(+), 17 deletions(-)
+ 2 files changed, 47 insertions(+), 8 deletions(-)
diff --git a/tests/testalias.py b/tests/testalias.py
-index a96aea4..7934c96 100755
+index a96aea4..43863a8 100755
--- a/tests/testalias.py
+++ b/tests/testalias.py
-@@ -9,19 +9,11 @@ sys.path.insert(0, '..')
+@@ -9,14 +9,22 @@ sys.path.insert(0, '..')
from zeroinstall import alias
expected_script = """#!/bin/sh
--if [ "$*" = "--versions" ]; then
-- exec 0launch -gd 'http://example.com/foo.xml' "$@"
--else
-- exec 0launch 'http://example.com/foo.xml' "$@"
--fi
+exec 0launch 'http://example.com/foo.xml' "$@"
- """
-
- expected_script_main = """#!/bin/sh
--if [ "$*" = "--versions" ]; then
-- exec 0launch -gd 'http://example.com/foo.xml' "$@"
--else
-- exec 0launch --main 'a'\\'''\\''\\test' 'http://example.com/foo.xml' "$@"
--fi
++"""
++
++old_script = """#!/bin/sh
+ if [ "$*" = "--versions" ]; then
+ exec 0launch -gd 'http://example.com/foo.xml' "$@"
+ else
+ exec 0launch 'http://example.com/foo.xml' "$@"
+ fi
++ """
++
++expected_script_main = """#!/bin/sh
+exec 0launch --main 'a'\\'''\\''\\test' 'http://example.com/foo.xml' "$@"
"""
- class TestAlias(BaseTest):
+-expected_script_main = """#!/bin/sh
++old_script_main = """#!/bin/sh
+ if [ "$*" = "--versions" ]; then
+ exec 0launch -gd 'http://example.com/foo.xml' "$@"
+ else
+@@ -53,6 +61,23 @@ class TestAlias(BaseTest):
+ uri, main = alias.parse_script(tmp.name)
+ self.assertEquals('http://example.com/foo.xml', uri)
+ self.assertEquals('a\'\'\\test', main)
++
++ def testParseOld(self):
++ tmp = tempfile.NamedTemporaryFile()
++ tmp.write(old_script)
++ tmp.flush()
++ tmp.seek(0)
++ uri, main = alias.parse_script(tmp.name)
++ self.assertEquals('http://example.com/foo.xml', uri)
++ self.assertEquals(None, main)
++
++ tmp = tempfile.NamedTemporaryFile()
++ tmp.write(old_script_main)
++ tmp.flush()
++ tmp.seek(0)
++ uri, main = alias.parse_script(tmp.name)
++ self.assertEquals('http://example.com/foo.xml', uri)
++ self.assertEquals('a\'\'\\test', main)
+
+ def testParseException(self):
+ tmp = tempfile.NamedTemporaryFile()
diff --git a/zeroinstall/alias.py b/zeroinstall/alias.py
index a7189ab..9b9fa89 100644
--- a/zeroinstall/alias.py
More information about the scm-commits
mailing list