diff mbox

[v2,1/2] pwclient: Unhardcode prints to ~/.pwclientrc

Message ID 1472519535-32188-1-git-send-email-f.fainelli@gmail.com
State Accepted
Headers show

Commit Message

Florian Fainelli Aug. 30, 2016, 1:12 a.m. UTC
Even though the default location is ~/.pwclientrc, we can change it, so
use CONFIG_FILE wherever we can to make the prints match the actual file
location.

While at it, use .format() when printing CONFIG_FILE.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 patchwork/bin/pwclient | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Florian Fainelli Aug. 30, 2016, 9:10 p.m. UTC | #1
On 08/29/2016 06:12 PM, Florian Fainelli wrote:
> Even though the default location is ~/.pwclientrc, we can change it, so
> use CONFIG_FILE wherever we can to make the prints match the actual file
> location.
> 
> While at it, use .format() when printing CONFIG_FILE.

That description does not quite fit, let me know if you want me to
resubmit with just that fixed (provided that the actual patch contents
are good).

Cheers
Stephen Finucane Sept. 1, 2016, 6:10 p.m. UTC | #2
On 30 Aug 14:10, Florian Fainelli wrote:
> On 08/29/2016 06:12 PM, Florian Fainelli wrote:
> > Even though the default location is ~/.pwclientrc, we can change it, so
> > use CONFIG_FILE wherever we can to make the prints match the actual file
> > location.
> > 
> > While at it, use .format() when printing CONFIG_FILE.
> 
> That description does not quite fit, let me know if you want me to
> resubmit with just that fixed (provided that the actual patch contents
> are good).

I'll just drop the last sentence.

Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>
Stephen Finucane Sept. 1, 2016, 6:13 p.m. UTC | #3
On 01 Sep 19:10, Stephen Finucane wrote:
> On 30 Aug 14:10, Florian Fainelli wrote:
> > On 08/29/2016 06:12 PM, Florian Fainelli wrote:
> > > Even though the default location is ~/.pwclientrc, we can change it, so
> > > use CONFIG_FILE wherever we can to make the prints match the actual file
> > > location.
> > > 
> > > While at it, use .format() when printing CONFIG_FILE.
> > 
> > That description does not quite fit, let me know if you want me to
> > resubmit with just that fixed (provided that the actual patch contents
> > are good).
> 
> I'll just drop the last sentence.
> 
> Reviewed-by: Stephen Finucane <stephenfinucane@hotmail.com>

...and merged both. Thanks, Florian :)
diff mbox

Patch

diff --git a/patchwork/bin/pwclient b/patchwork/bin/pwclient
index a931dc904a39..791c5119a075 100755
--- a/patchwork/bin/pwclient
+++ b/patchwork/bin/pwclient
@@ -616,7 +616,7 @@  def main():
     config.read([CONFIG_FILE])
 
     if not config.has_section('options') and os.path.exists(CONFIG_FILE):
-        sys.stderr.write('~/.pwclientrc is in the old format. Migrating it...')
+        sys.stderr.write('%s is in the old format. Migrating it...' % CONFIG_FILE)
 
         old_project = config.get('base', 'project')
 
@@ -642,7 +642,7 @@  def main():
 
         sys.stderr.write(' Done.\n')
         sys.stderr.write(
-            'Your old ~/.pwclientrc was saved to %s\n' % old_config_file)
+            'Your old %s was saved to %s\n' % (CONFIG_FILE, old_config_file))
         sys.stderr.write(
             'and was converted to the new format. You may want to\n')
         sys.stderr.write('inspect it before continuing.\n')
@@ -653,15 +653,15 @@  def main():
             project_str = config.get('options', 'default')
         except:
             action_parser.error(
-                "No default project configured in ~/.pwclientrc")
+                "No default project configured in %s\n" % CONFIG_FILE)
 
     if not config.has_section(project_str):
         sys.stderr.write(
-            'No section for project %s in ~/.pwclientrc\n' % project_str)
+            'No section for project %s in %s\n' % (CONFIG_FILE, project_str))
         sys.exit(1)
     if not config.has_option(project_str, 'url'):
         sys.stderr.write(
-            'No URL for project %s in ~/.pwclientrc\n' % project_str)
+            'No URL for project %s in %s\n' % (CONFIG_FILE, project_str))
         sys.exit(1)
     if not do_signoff and config.has_option('options', 'signoff'):
         do_signoff = config.getboolean('options', 'signoff')