Merge lp:~cjwatson/click/info-extension into lp:click/devel

Proposed by Colin Watson on 2014-10-07
Status: Merged
Merged at revision: 532
Proposed branch: lp:~cjwatson/click/info-extension
Merge into: lp:click/devel
Diff against target: 59 lines (+16/-3)
3 files modified
click/commands/info.py (+2/-2)
click/tests/integration/test_info.py (+9/-1)
debian/changelog (+5/-0)
To merge this branch: bzr merge lp:~cjwatson/click/info-extension
Reviewer Review Type Date Requested Status
Michael Vogt 2014-10-07 Approve on 2014-10-07
PS Jenkins bot (community) continuous-integration Approve on 2014-10-07
Review via email: mp+237385@code.launchpad.net

This proposal supersedes a proposal from 2014-10-07.

Commit message

Make "click info" always try opening the input file as a package and only try to interpret it as a file in an installed package if that fails, rather than guessing by the input file extension.

Description of the change

Make "click info" always try opening the input file as a package and only try to interpret it as a file in an installed package if that fails, rather than guessing by the input file extension.

This fixes attempts to install packages that don't end with ".click" via "pkcon install-local", broken by the fix for bug 1324853.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'click/commands/info.py'
2--- click/commands/info.py 2014-08-08 10:13:30 +0000
3+++ click/commands/info.py 2014-10-07 09:15:31 +0000
4@@ -49,12 +49,12 @@
5 if registry.has_package_name(arg):
6 return json_object_to_python(registry.get_manifest(arg))
7
8- if arg.endswith(".click"):
9+ try:
10 with closing(DebFile(filename=arg)) as package:
11 with package.control.get_file(
12 "manifest", encoding="UTF-8") as manifest_file:
13 return _load_manifest(manifest_file)
14- else:
15+ except Exception:
16 pkgdir = Click.find_package_directory(arg)
17 manifest_path = glob.glob(
18 os.path.join(pkgdir, ".click", "info", "*.manifest"))
19
20=== modified file 'click/tests/integration/test_info.py'
21--- click/tests/integration/test_info.py 2014-09-05 09:08:31 +0000
22+++ click/tests/integration/test_info.py 2014-10-07 09:15:31 +0000
23@@ -30,7 +30,6 @@
24 self.click_binary, "info", path_to_click], universal_newlines=True)
25 self.assertEqual(name, json.loads(output)["name"])
26
27-
28 def test_info_installed_click(self):
29 name = "com.example.foo"
30 user = os.environ.get("USER", "root")
31@@ -55,3 +54,12 @@
32 "/opt/click.ubuntu.com/%s/%s/README" % (name, version)],
33 universal_newlines=True)
34 self.assertEqual(name, json.loads(output)["name"])
35+
36+ def test_info_different_extension(self):
37+ name = "org.example.info"
38+ raw_path = self._make_click(name)
39+ path = "%s.extra" % raw_path
40+ os.rename(raw_path, path)
41+ output = subprocess.check_output([
42+ self.click_binary, "info", path], universal_newlines=True)
43+ self.assertEqual(name, json.loads(output)["name"])
44
45=== modified file 'debian/changelog'
46--- debian/changelog 2014-10-01 11:29:49 +0000
47+++ debian/changelog 2014-10-07 09:15:31 +0000
48@@ -4,6 +4,11 @@
49 * Demote ubuntu-app-launch-tools from a click recommends to a suggests,
50 since they are not needed on server installs.
51
52+ [ Colin Watson ]
53+ * Make "click info" always try opening the input file as a package and
54+ only try to interpret it as a file in an installed package if that
55+ fails, rather than guessing by the input file extension.
56+
57 -- Colin Watson <cjwatson@ubuntu.com> Wed, 01 Oct 2014 12:28:42 +0100
58
59 click (0.4.33) utopic; urgency=medium

Subscribers

People subscribed via source and target branches

to all changes: