[PATCH gentoolkit 1/2] eclean: Fix typos

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH gentoolkit 1/2] eclean: Fix typos

Matt Turner-5
Signed-off-by: Matt Turner <[hidden email]>
---
 pym/gentoolkit/eclean/cli.py    | 4 ++--
 pym/gentoolkit/eclean/search.py | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/pym/gentoolkit/eclean/cli.py b/pym/gentoolkit/eclean/cli.py
index 1d2f52b..1a99b3e 100644
--- a/pym/gentoolkit/eclean/cli.py
+++ b/pym/gentoolkit/eclean/cli.py
@@ -304,7 +304,7 @@ def parseArgs(options={}):
  options['size-limit'] = 0
  options['verbose'] = False
  options['ignore-failure'] = False
- # if called by a well-named symlink, set the acction accordingly:
+ # if called by a well-named symlink, set the action accordingly:
  action = None
  # temp print line to ensure it is the svn/branch code running, etc..
  #print(  "###### svn/branch/gentoolkit_eclean ####### ==> ", os.path.basename(sys.argv[0]))
@@ -400,7 +400,7 @@ def doAction(action,options,exclude={}, output=None):
  )
 
  # initialize our cleaner
- cleaner = CleanUp( output.progress_controller)
+ cleaner = CleanUp(output.progress_controller)
 
  # actually clean files if something was found
  if clean_me:
diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py
index ce455a3..58bd97e 100644
--- a/pym/gentoolkit/eclean/search.py
+++ b/pym/gentoolkit/eclean/search.py
@@ -574,7 +574,7 @@ def findPackages(
  del clean_me[cpv]
  continue
  if portage.cpv_getkey(cpv) in cp_all and port_dbapi.cpv_exists(cpv):
- # exlusion because of --package-names
+ # exclusion because of --package-names
  del clean_me[cpv]
 
  # the getname method correctly supports FEATURES=binpkg-multi-instance,
--
2.24.1


Reply | Threaded
Open this post in threaded view
|

[PATCH gentoolkit 2/2] imlate: Dynamically calculate column width in report

Matt Turner-5
Also print categories on the line with the package name for much simpler
consumption by external tools.

Signed-off-by: Matt Turner <[hidden email]>
---
 pym/gentoolkit/imlate/imlate.py | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/pym/gentoolkit/imlate/imlate.py b/pym/gentoolkit/imlate/imlate.py
index 86d1a7e..a5568d7 100755
--- a/pym/gentoolkit/imlate/imlate.py
+++ b/pym/gentoolkit/imlate/imlate.py
@@ -67,11 +67,18 @@ def _fill( width, line, fill = " " ):
 # create a hopefully pretty result
 def show_result( conf, pkgs ):
  # X - len(colX) = space to fill
- col1 = 40
- col2 = 20
+ col1 = -1
+ col2 = -1
+ for cat in pkgs.keys():
+ for pkg in pkgs[cat].keys():
+ col1 = max(col1, len(("%s/%s" % (cat, pkg))))
+ col2 = max(col2, len(pkgs[cat][pkg][1]))
+ col1 += 1
+ col2 += 1
 
  _header = "%s candidates for 'gentoo' on '%s'"
- _helper = "category/package[:SLOT]                 our version         best version"
+ _helper = "%s%s%s" % (_fill(col1, "category/package[:SLOT])"),
+  _fill(col2, "our version"), "best version")
  _cand = ""
  header = ""
 
@@ -102,11 +109,10 @@ def show_result( conf, pkgs ):
  print(_fill( len( _helper ), "", "-" ), file=out)
 
  for cat in sorted( pkgs.keys() ):
- print("%s/" % cat, file=out)
  for pkg in sorted( pkgs[cat].keys() ):
- print("%s%s%s" % ( _fill( col1, ( "  %s" % pkg ) ),
- _fill( col2, pkgs[cat][pkg][1] ),
- pkgs[cat][pkg][0] ), file=out)
+ print("%s%s%s" % (_fill(col1, ("%s/%s" % (cat, pkg))),
+  _fill(col2, pkgs[cat][pkg][1]),
+  pkgs[cat][pkg][0] ), file=out)
 
  if conf["FILE"] != "stdout":
  out.close()
--
2.24.1


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH gentoolkit 1/2] eclean: Fix typos

Michael 'veremitz' Everitt
In reply to this post by Matt Turner-5
On 02/01/20 18:57, Matt Turner wrote:

> Signed-off-by: Matt Turner <[hidden email]>
> ---
>  pym/gentoolkit/eclean/cli.py    | 4 ++--
>  pym/gentoolkit/eclean/search.py | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/pym/gentoolkit/eclean/cli.py b/pym/gentoolkit/eclean/cli.py
> index 1d2f52b..1a99b3e 100644
> --- a/pym/gentoolkit/eclean/cli.py
> +++ b/pym/gentoolkit/eclean/cli.py
> @@ -304,7 +304,7 @@ def parseArgs(options={}):
>   options['size-limit'] = 0
>   options['verbose'] = False
>   options['ignore-failure'] = False
> - # if called by a well-named symlink, set the acction accordingly:
> + # if called by a well-named symlink, set the action accordingly:
>   action = None
>   # temp print line to ensure it is the svn/branch code running, etc..
>   #print(  "###### svn/branch/gentoolkit_eclean ####### ==> ", os.path.basename(sys.argv[0]))
> @@ -400,7 +400,7 @@ def doAction(action,options,exclude={}, output=None):
>   )
>  
>   # initialize our cleaner
> - cleaner = CleanUp( output.progress_controller)
> + cleaner = CleanUp(output.progress_controller)
>  
>   # actually clean files if something was found
>   if clean_me:
> diff --git a/pym/gentoolkit/eclean/search.py b/pym/gentoolkit/eclean/search.py
> index ce455a3..58bd97e 100644
> --- a/pym/gentoolkit/eclean/search.py
> +++ b/pym/gentoolkit/eclean/search.py
> @@ -574,7 +574,7 @@ def findPackages(
>   del clean_me[cpv]
>   continue
>   if portage.cpv_getkey(cpv) in cp_all and port_dbapi.cpv_exists(cpv):
> - # exlusion because of --package-names
> + # exclusion because of --package-names
>   del clean_me[cpv]
>  
>   # the getname method correctly supports FEATURES=binpkg-multi-instance,
LGTM fwiw.


signature.asc (817 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH gentoolkit 2/2] imlate: Dynamically calculate column width in report

Zac Medico-2
In reply to this post by Matt Turner-5
On 1/2/20 10:58 AM, Matt Turner wrote:
> Also print categories on the line with the package name for much simpler
> consumption by external tools.
>
> Signed-off-by: Matt Turner <[hidden email]>
> ---
>  pym/gentoolkit/imlate/imlate.py | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)

Looks good, but you can omit the .keys() calls since direct iteration
over a dictionary yields the keys.
--
Thanks,
Zac


signature.asc (1000 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH gentoolkit 2/2] imlate: Dynamically calculate column width in report

Matt Turner-5
On Thu, Jan 2, 2020 at 12:41 PM Zac Medico <[hidden email]> wrote:

>
> On 1/2/20 10:58 AM, Matt Turner wrote:
> > Also print categories on the line with the package name for much simpler
> > consumption by external tools.
> >
> > Signed-off-by: Matt Turner <[hidden email]>
> > ---
> >  pym/gentoolkit/imlate/imlate.py | 20 +++++++++++++-------
> >  1 file changed, 13 insertions(+), 7 deletions(-)
>
> Looks good, but you can omit the .keys() calls since direct iteration
> over a dictionary yields the keys.

Thank you. Fixed locally.