Merge lp:~mvo/click/lp1324853-manifest into lp:click/devel

Proposed by Michael Vogt
Status: Merged
Merged at revision: 494
Proposed branch: lp:~mvo/click/lp1324853-manifest
Merge into: lp:click/devel
Diff against target: 48 lines (+22/-9)
1 file modified
click/commands/info.py (+22/-9)
To merge this branch: bzr merge lp:~mvo/click/lp1324853-manifest
Reviewer Review Type Date Requested Status
Colin Watson Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+224238@code.launchpad.net

Commit message

Add "click info" interface to get manifest corresponding to file in installed package.

Description of the change

This branch implements a CLI interface to get the manifest of the click package that the file given belongs to.

E.g.
$ click info /opt/click.ubuntu.com/com.ubuntu.calendar/0.4/EventListModel.qml
{
    "description": "Calendar application for Ubuntu devices",
...
}

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Colin Watson (cjwatson) :
review: Approve
Revision history for this message
Colin Watson (cjwatson) :
review: Approve
Revision history for this message
Colin Watson (cjwatson) wrote :

Oops, duplicate. Anyway, needs a test, but I can deal with that.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'click/commands/info.py'
--- click/commands/info.py 2014-04-03 08:52:02 +0000
+++ click/commands/info.py 2014-06-24 06:33:04 +0000
@@ -26,6 +26,13 @@
2626
27from click.install import DebFile27from click.install import DebFile
28from click.json_helpers import json_object_to_python28from click.json_helpers import json_object_to_python
29def _load_manifest(manifest_file):
30 manifest = json.load(manifest_file)
31 keys = list(manifest)
32 for key in keys:
33 if key.startswith("_"):
34 del manifest[key]
35 return manifest
2936
3037
31def get_manifest(options, arg):38def get_manifest(options, arg):
@@ -38,15 +45,21 @@
38 if registry.has_package_name(arg):45 if registry.has_package_name(arg):
39 return json_object_to_python(registry.get_manifest(arg))46 return json_object_to_python(registry.get_manifest(arg))
4047
41 with closing(DebFile(filename=arg)) as package:48 if arg.endswith(".click"):
42 with package.control.get_file(49 with closing(DebFile(filename=arg)) as package:
43 "manifest", encoding="UTF-8") as manifest_file:50 with package.control.get_file(
44 manifest = json.load(manifest_file)51 "manifest", encoding="UTF-8") as manifest_file:
45 keys = list(manifest)52 return _load_manifest(manifest_file)
46 for key in keys:53 else:
47 if key.startswith("_"):54 import glob, os
48 del manifest[key]55 pkgdir = Click.find_package_directory(arg)
49 return manifest56 manifest_path = glob.glob(
57 os.path.join(pkgdir, ".click", "info", "*.manifest"))
58 if len(manifest_path) > 1:
59 raise Exception("Multiple manifest files found in '%s'" % (
60 manifest_path))
61 with open(manifest_path[0]) as f:
62 return _load_manifest(f)
5063
5164
52def run(argv):65def run(argv):

Subscribers

People subscribed via source and target branches

to all changes: