Merge lp:~snappy-dev/click/snappyprogress2 into lp:~snappy-dev/click/snappy

Proposed by Barry Warsaw
Status: Superseded
Proposed branch: lp:~snappy-dev/click/snappyprogress2
Merge into: lp:~snappy-dev/click/snappy
Diff against target: 118 lines (+27/-6)
3 files modified
click/commands/install.py (+14/-5)
click/commands/update.py (+7/-1)
debian/changelog (+6/-0)
To merge this branch: bzr merge lp:~snappy-dev/click/snappyprogress2
Reviewer Review Type Date Requested Status
Michael Vogt Pending
James Hunt Pending
Snappy Developers Pending
Review via email: mp+243739@code.launchpad.net

This proposal has been superseded by a proposal from 2014-12-05.

Description of the change

ubuntu-core-snappy (0.2~ppa28) vivid; urgency=medium

  * Call `click update` and `click install` with the `--meter` flag to use
    a textual progress meter.

 -- Barry Warsaw <email address hidden> Thu, 04 Dec 2014 17:23:12 -0500

To post a comment you must log in.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'click/commands/install.py'
--- click/commands/install.py 2014-12-03 12:44:56 +0000
+++ click/commands/install.py 2014-12-04 22:58:01 +0000
@@ -30,16 +30,20 @@
30from click.acquire import (30from click.acquire import (
31 ClickAcquire,31 ClickAcquire,
32 ClickAcquireStatusMeter,32 ClickAcquireStatusMeter,
33 ClickAcquireStatusText,
33)34)
34from click.install import ClickInstaller, ClickInstallerError35from click.install import ClickInstaller, ClickInstallerError
35from click.repository import (36from click.repository import (
36 get_repository,37 get_repository,
37)38)
3839
39def download_click(package_uri):40def download_click(package_uri, progress_class=None):
41 if progress_class is None:
42 # For backward compatibility.
43 progress_class = ClickAcquireStatusText
40 t = tempfile.NamedTemporaryFile()44 t = tempfile.NamedTemporaryFile()
41 package_path = t.name45 package_path = t.name
42 log = ClickAcquireStatusMeter()46 log = progress_class()
43 acq = ClickAcquire(log)47 acq = ClickAcquire(log)
44 acq.fetch(package_uri, package_path)48 acq.fetch(package_uri, package_path)
45 # return the tempfile so that it does not get deleted when we49 # return the tempfile so that it does not get deleted when we
@@ -68,11 +72,16 @@
68 "--allow-unauthenticated", default=False, action="store_true",72 "--allow-unauthenticated", default=False, action="store_true",
69 help="allow installing packages with no signatures")73 help="allow installing packages with no signatures")
70 parser.add_option(74 parser.add_option(
75 '--meter', default=False, action='store_true',
76 help='display progress with a text meter')
77 parser.add_option(
71 "--verbose", default=False, action="store_true",78 "--verbose", default=False, action="store_true",
72 help="be more verbose on install")79 help="be more verbose on install")
73 options, args = parser.parse_args(argv)80 options, args = parser.parse_args(argv)
74 if len(args) < 1:81 if len(args) < 1:
75 parser.error("need package file name")82 parser.error("need package file name")
83 progress_class = (ClickAcquireStatusMeter
84 if options.meter else ClickAcquireStatusText)
76 db = Click.DB()85 db = Click.DB()
77 db.read(db_dir=None)86 db.read(db_dir=None)
78 if options.root is not None:87 if options.root is not None:
@@ -83,7 +92,7 @@
83 allow_unauthenticated=options.allow_unauthenticated)92 allow_unauthenticated=options.allow_unauthenticated)
84 parsed_uri = urlparse(package_uri)93 parsed_uri = urlparse(package_uri)
85 if parsed_uri.scheme != "":94 if parsed_uri.scheme != "":
86 t = download_click(package_uri)95 t = download_click(package_uri, progress_class)
87 package_path = t.name96 package_path = t.name
88 elif os.path.exists(package_uri):97 elif os.path.exists(package_uri):
89 package_path = package_uri98 package_path = package_uri
@@ -91,9 +100,9 @@
91 repo = get_repository()100 repo = get_repository()
92 details = repo.details(package_uri)101 details = repo.details(package_uri)
93 if repo.credentials:102 if repo.credentials:
94 t = download_click(details["download_url"])103 t = download_click(details["download_url"], progress_class)
95 else:104 else:
96 t = download_click(details["anon_download_url"])105 t = download_click(details["anon_download_url"], progress_class)
97 package_path = t.name106 package_path = t.name
98 try:107 try:
99 installer.install(108 installer.install(
100109
=== modified file 'click/commands/update.py'
--- click/commands/update.py 2014-11-24 16:20:13 +0000
+++ click/commands/update.py 2014-12-04 22:58:01 +0000
@@ -27,6 +27,7 @@
27from gi.repository import Click27from gi.repository import Click
28from click.acquire import (28from click.acquire import (
29 ClickAcquire,29 ClickAcquire,
30 ClickAcquireStatusMeter,
30 ClickAcquireStatusText,31 ClickAcquireStatusText,
31)32)
32from click.install import ClickInstaller33from click.install import ClickInstaller
@@ -53,6 +54,9 @@
53 parser.add_option(54 parser.add_option(
54 "--all-users", default=False, action="store_true",55 "--all-users", default=False, action="store_true",
55 help="register package for all users")56 help="register package for all users")
57 parser.add_option(
58 '--meter', default=False, action='store_true',
59 help='display progress with a text meter')
56 options, args = parser.parse_args(argv)60 options, args = parser.parse_args(argv)
57 repo = get_repository()61 repo = get_repository()
58 try:62 try:
@@ -68,6 +72,8 @@
68 else:72 else:
69 updates = all_updates73 updates = all_updates
7074
75 progress_class = (ClickAcquireStatusMeter
76 if options.meter else ClickAcquireStatusText)
71 if options.machine_readable:77 if options.machine_readable:
72 for (current, new) in updates:78 for (current, new) in updates:
73 print("%s|%s|%s" % (79 print("%s|%s|%s" % (
@@ -92,7 +98,7 @@
92 # FIXME: duplication from commands/install.py98 # FIXME: duplication from commands/install.py
93 t = tempfile.NamedTemporaryFile()99 t = tempfile.NamedTemporaryFile()
94 package_path = t.name100 package_path = t.name
95 log = ClickAcquireStatusText()101 log = progress_class()
96 acq = ClickAcquire(log)102 acq = ClickAcquire(log)
97 acq.fetch(package_uri, package_path)103 acq.fetch(package_uri, package_path)
98 installer.install(104 installer.install(
99105
=== modified file 'debian/changelog'
--- debian/changelog 2014-12-04 14:24:39 +0000
+++ debian/changelog 2014-12-04 22:58:01 +0000
@@ -1,3 +1,9 @@
1click (0.4.35+ppa22) vivid; urgency=medium
2
3 * Use a textual progress meter when `click update --meter` is given.
4
5 -- Barry Warsaw <barry@ubuntu.com> Thu, 04 Dec 2014 17:56:15 -0500
6
1click (0.4.35+ppa21) vivid; urgency=low7click (0.4.35+ppa21) vivid; urgency=low
28
3 * merged lp:~snappy-dev/click/default-apparmor (thanks Barry!)9 * merged lp:~snappy-dev/click/default-apparmor (thanks Barry!)

Subscribers

People subscribed via source and target branches

to all changes: