public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/enalyze/
@ 2016-02-25 21:26 Brian Dolbec
  0 siblings, 0 replies; 5+ messages in thread
From: Brian Dolbec @ 2016-02-25 21:26 UTC (permalink / raw
  To: gentoo-commits

commit:     b9de1f7b39a1ce43f22018e4a1c03bef6677360c
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 25 21:23:33 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Feb 25 21:24:55 2016 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=b9de1f7b

enalyze/analyze.py: Sort the flags for the analyze packages output

Feature request from: Fernando Reyes

 pym/gentoolkit/enalyze/analyze.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pym/gentoolkit/enalyze/analyze.py b/pym/gentoolkit/enalyze/analyze.py
index 2d9c85e..ce83ba6 100644
--- a/pym/gentoolkit/enalyze/analyze.py
+++ b/pym/gentoolkit/enalyze/analyze.py
@@ -429,9 +429,10 @@ class Analyse(ModuleBase):
 		for cpv in cpvs:
 			(flag_plus, flag_neg, unset) = flags.analyse_cpv(cpv)
 			if self.options["unset"]:
-				self.printer(cpv, "", (flag_plus, flag_neg, unset))
+				self.printer(cpv, "", (sorted(flag_plus), sorted(flag_neg),
+					sorted(unset)))
 			else:
-				self.printer(cpv, "", (flag_plus, flag_neg, []))
+				self.printer(cpv, "", (sorted(flag_plus), sorted(flag_neg), []))
 		if not self.options['quiet']:
 			print("===================================================")
 			print("Total number of installed ebuilds =",


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/enalyze/
@ 2016-07-08 15:37 Brian Dolbec
  0 siblings, 0 replies; 5+ messages in thread
From: Brian Dolbec @ 2016-07-08 15:37 UTC (permalink / raw
  To: gentoo-commits

commit:     0c2b748b987d629ba7b9f75756db16758ed426bc
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Jul  8 15:20:15 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Jul  8 15:35:38 2016 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=0c2b748b

enalyze: Add width and prepend options

These options are useful for creating preformatted wiki list entries.
Feature request from Fernando Reyes for the livedvd packages list.
This adds a prepend and width setting for any of the analyze keys.

 pym/gentoolkit/enalyze/analyze.py | 32 ++++++++++++++++++++++++++------
 pym/gentoolkit/enalyze/output.py  | 28 ++++++++++++++--------------
 2 files changed, 40 insertions(+), 20 deletions(-)

diff --git a/pym/gentoolkit/enalyze/analyze.py b/pym/gentoolkit/enalyze/analyze.py
index ce83ba6..86f0987 100644
--- a/pym/gentoolkit/enalyze/analyze.py
+++ b/pym/gentoolkit/enalyze/analyze.py
@@ -175,7 +175,9 @@ class Analyse(ModuleBase):
 			"verbose": False,
 			"quiet": False,
 			'prefix': False,
-			'portage': True
+			'portage': True,
+			"width": 80,
+			"prepend": "",
 		}
 		self.module_opts = {
 			"-f": ("flags", "boolean", True),
@@ -188,8 +190,12 @@ class Analyse(ModuleBase):
 			"--verbose": ("verbose", "boolean", True),
 			"-p": ("prefix", "boolean", True),
 			"--prefix": ("prefix", "boolean", True),
+			"-P": ("prepend", "char", None),
+			"--prepend": ("prepend", "char", None),
 			"-G": ("portage", "boolean", False),
 			"--portage": ("portage", "boolean", False),
+			"-W": ("width", "int", 80),
+			"--width": ("width", "int", 80),
 		}
 		self.formatted_options = [
 			("  -h, --help",  "Outputs this useage message"),
@@ -201,9 +207,15 @@ class Analyse(ModuleBase):
 			("  -p, --prefix",
 			"Used for testing purposes only, runs report using " +
 			"a prefix keyword and 'prefix' USE flag"),
+			("  -P, --prepend",
+			"Prepend the string to any list output.  " +
+			"ie: prepend '* ' to the ""front of each package being listed."
+			"This is useful for generating preformatted wiki text."),
 			#(" -G, --portage",
 			#"Use portage directly instead of gentoolkit's Package " +
 			#"object for some operations. Usually a little faster."),
+			("  -W, --width",
+			"Format the output to wrap at 'WIDTH' ie: long line output"),
 		]
 		self.formatted_args = [
 			("  use",
@@ -223,8 +235,9 @@ class Analyse(ModuleBase):
 			("  ",
 			"for those that need to be unmasked")
 		]
-		self.short_opts = "huvpG"
-		self.long_opts = ("help", "unset", "verbose", "prefix") #, "portage")
+		self.short_opts = "huvpGP:W:"
+		self.long_opts = ("help", "unset", "verbose", "prefix", "prepend=",
+						"width=") #, "portage")
 		self.need_queries = True
 		self.arg_spec = "Target"
 		self.arg_options = ['use', 'pkguse','keywords', 'packages', 'unmask']
@@ -262,10 +275,13 @@ class Analyse(ModuleBase):
 		@param target: the target to be analyzed, one of ["use", "pkguse"]
 		"""
 		system_use = portage.settings["USE"].split()
+
 		self.printer = AnalysisPrinter(
 				"use",
 				self.options["verbose"],
-				system_use)
+				system_use,
+				width=self.options["width"],
+				prepend=self.options["prepend"])
 		if self.options["verbose"]:
 			cpvs = portage.db[portage.root]["vartree"].dbapi.cpv_all()
 			#cpvs = get_installed_cpvs()
@@ -326,7 +342,9 @@ class Analyse(ModuleBase):
 		self.printer = AnalysisPrinter(
 				"keywords",
 				self.options["verbose"],
-				system_keywords)
+				system_keywords,
+				width=self.options["width"],
+				prepend=self.options["prepend"])
 		self.analyser = KeywordAnalyser( arch, system_keywords, portage.db[portage.root]["vartree"].dbapi)
 		#self.analyser.set_order(portage.settings["USE"].split())
 		# only for testing
@@ -410,7 +428,9 @@ class Analyse(ModuleBase):
 		self.printer = AnalysisPrinter(
 				"packages",
 				self.options["verbose"],
-				key_width=key_width)
+				key_width=key_width,
+				width=self.options["width"],
+				prepend=self.options["prepend"])
 
 		cpvs = sorted(cpvs)
 		flags = FlagAnalyzer(

diff --git a/pym/gentoolkit/enalyze/output.py b/pym/gentoolkit/enalyze/output.py
index 326ebbc..01a9b98 100644
--- a/pym/gentoolkit/enalyze/output.py
+++ b/pym/gentoolkit/enalyze/output.py
@@ -28,13 +28,15 @@ def nl(lines=1):
 
 class AnalysisPrinter(CpvValueWrapper):
 	"""Printing functions"""
-	def __init__(self, target, verbose=True, references=None, key_width=1, width=None):
+	def __init__(self, target, verbose=True, references=None, key_width=1,
+				width=None, prepend=''):
 		"""@param references: list of accepted keywords or
 				the system use flags
 				"""
 		self.references = references
 		self.key_width = key_width
 		self.width = width
+		self.prepend = prepend
 		CpvValueWrapper.__init__(self, cpv_width=key_width, width=width)
 		self.set_target(target, verbose)
 
@@ -78,8 +80,7 @@ class AnalysisPrinter(CpvValueWrapper):
 		pkgs.sort()
 		self.print_fn(key, active, default, count, pkgs)
 
-	@staticmethod
-	def print_use_verbose(key, active, default, count, pkgs):
+	def print_use_verbose(self, key, active, default, count, pkgs):
 		"""Verbosely prints a set of use flag info. including the pkgs
 		using them.
 		"""
@@ -89,25 +90,24 @@ class AnalysisPrinter(CpvValueWrapper):
 		else:
 			_key = (" " + key)
 		cpv = _pkgs.pop(0)
-		print(_key,'.'*(35-len(key)), default, pp.number(count), pp.cpv(cpv))
+		print(self.prepend + _key,'.'*(35-len(key)), default, pp.number(count),
+			pp.cpv(cpv))
 		while _pkgs:
 			cpv = _pkgs.pop(0)
 			print(' '*52 + pp.cpv(cpv))
 
 	# W0613: *Unused argument %r*
 	# pylint: disable-msg=W0613
-	@staticmethod
-	def print_use_quiet(key, active, default, count, pkgs):
+	def print_use_quiet(self, key, active, default, count, pkgs):
 		"""Quietly prints a subset set of USE flag info..
 		"""
 		if active in ["+", "-"]:
 			_key = pp.useflag((active+key), active=="+")
 		else:
 			_key = (" " + key)
-		print(_key,'.'*(35-len(key)), default, pp.number(count))
+		print(self.prepend + _key,'.'*(35-len(key)), default, pp.number(count))
 
-	@staticmethod
-	def print_keyword_verbose(key, stability, default, count, pkgs):
+	def print_keyword_verbose(self, key, stability, default, count, pkgs):
 		"""Verbosely prints a set of keywords info. including the pkgs
 		using them.
 		"""
@@ -115,20 +115,20 @@ class AnalysisPrinter(CpvValueWrapper):
 		_key = (pp.keyword((stability+key),stable=(stability==" "),
 			hard_masked=stability=="-"))
 		cpv = _pkgs.pop(0)
-		print(_key,'.'*(20-len(key)), default, pp.number(count), pp.cpv(cpv))
+		print(self.prepend + _key,'.'*(20-len(key)), default, pp.number(count),
+			pp.cpv(cpv))
 		while _pkgs:
 			cpv = _pkgs.pop(0)
 			print(' '*37 + pp.cpv(cpv))
 
 	# W0613: *Unused argument %r*
 	# pylint: disable-msg=W0613
-	@staticmethod
-	def print_keyword_quiet(key, stability, default, count, pkgs):
+	def print_keyword_quiet(self, key, stability, default, count, pkgs):
 		"""Quietly prints a subset set of USE flag info..
 		"""
 		_key = (pp.keyword((stability+key), stable=(stability==" "),
 			hard_masked=stability=="-"))
-		print(_key,'.'*(20-len(key)), default, pp.number(count))
+		print(self.prepend + _key,'.'*(20-len(key)), default, pp.number(count))
 
 	# W0613: *Unused argument %r*
 	# pylint: disable-msg=W0613
@@ -153,7 +153,7 @@ class AnalysisPrinter(CpvValueWrapper):
 			if _flag:
 				_cleaned.append(_flag)
 		#print("cpv=", key, "_plus=", _plus, "_minus=", _minus)
-		self.print_fn(key, (plus, minus, cleaned))
+		self.print_fn(self.prepend + key, (plus, minus, cleaned))
 
 	def print_pkg_verbose(self, cpv, flags):
 		"""Verbosely prints the pkg's use flag info.


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/enalyze/
@ 2022-07-09 23:55 Brian Dolbec
  0 siblings, 0 replies; 5+ messages in thread
From: Brian Dolbec @ 2022-07-09 23:55 UTC (permalink / raw
  To: gentoo-commits

commit:     0db35305e9ff05ef792ae18b9721772f4bdd3efb
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Jul  9 23:44:44 2022 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jul  9 23:44:44 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=0db35305

enalyze: Fix missing newline at end of saved rebuild files

Bug: https://bugs.gentoo.org/626308

Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>

 pym/gentoolkit/enalyze/rebuild.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pym/gentoolkit/enalyze/rebuild.py b/pym/gentoolkit/enalyze/rebuild.py
index f341680..e3396f3 100644
--- a/pym/gentoolkit/enalyze/rebuild.py
+++ b/pym/gentoolkit/enalyze/rebuild.py
@@ -401,6 +401,7 @@ class Rebuild(ModuleBase):
             encoding=_encodings["content"],
         ) as output:
             output.write("\n".join(data))
+            output.write("\n")
         print("   - Done")
 
 


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/enalyze/
@ 2023-06-04 19:01 Mike Gilbert
  0 siblings, 0 replies; 5+ messages in thread
From: Mike Gilbert @ 2023-06-04 19:01 UTC (permalink / raw
  To: gentoo-commits

commit:     6e285a2416d5616cc672b5cf15a468e6e4c9de75
Author:     Diego Viola <diego.viola <AT> gmail <DOT> com>
AuthorDate: Tue Mar 21 19:44:16 2023 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Sun Jun  4 19:01:12 2023 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=6e285a24

enalyze/analyze.py: fix typos

Signed-off-by: Diego Viola <diego.viola <AT> gmail.com>
Closes: https://github.com/gentoo/gentoolkit/pull/27
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 pym/gentoolkit/enalyze/analyze.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pym/gentoolkit/enalyze/analyze.py b/pym/gentoolkit/enalyze/analyze.py
index 3a09145..553ba5e 100644
--- a/pym/gentoolkit/enalyze/analyze.py
+++ b/pym/gentoolkit/enalyze/analyze.py
@@ -158,7 +158,7 @@ def gather_keywords_info(
 
 
 class Analyse(ModuleBase):
-    """Installed db analysis tool to query the installed databse
+    """Installed db analysis tool to query the installed database
     and produce/output stats for USE flags or keywords/mask.
     The 'rebuild' action output is in the form suitable for file type output
     to create a new package.use, package.keywords, package.unmask
@@ -201,7 +201,7 @@ class Analyse(ModuleBase):
             "--width": ("width", "int", 80),
         }
         self.formatted_options = [
-            ("  -h, --help", "Outputs this useage message"),
+            ("  -h, --help", "Outputs this usage message"),
             (
                 "  -u, --unset",
                 "Additionally include any unset USE flags and the packages",
@@ -265,7 +265,7 @@ class Analyse(ModuleBase):
         self.warning = (
             "   CAUTION",
             "This is beta software and some features/options are incomplete,",
-            "some features may change in future releases includig its name.",
+            "some features may change in future releases including its name.",
             "Feedback will be appreciated, http://bugs.gentoo.org",
         )
 


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/enalyze/
@ 2024-02-17  0:00 Sam James
  0 siblings, 0 replies; 5+ messages in thread
From: Sam James @ 2024-02-17  0:00 UTC (permalink / raw
  To: gentoo-commits

commit:     f7a80ce2b93f9a65ab7d3383a771d532445c1279
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 16 23:58:53 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Feb 16 23:58:53 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=f7a80ce2

enalyze: placate black

Signed-off-by: Sam James <sam <AT> gentoo.org>

 pym/gentoolkit/enalyze/rebuild.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pym/gentoolkit/enalyze/rebuild.py b/pym/gentoolkit/enalyze/rebuild.py
index 074e2f5..f4a348a 100644
--- a/pym/gentoolkit/enalyze/rebuild.py
+++ b/pym/gentoolkit/enalyze/rebuild.py
@@ -167,7 +167,7 @@ class Rebuild(ModuleBase):
             "pretend": False,
             "prefix": False,
             "portage": True,
-            "slot": False
+            "slot": False,
             # "unset": False
         }
         self.module_opts = {


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-02-17  0:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-25 21:26 [gentoo-commits] proj/gentoolkit:master commit in: pym/gentoolkit/enalyze/ Brian Dolbec
  -- strict thread matches above, loose matches on Subject: below --
2016-07-08 15:37 Brian Dolbec
2022-07-09 23:55 Brian Dolbec
2023-06-04 19:01 Mike Gilbert
2024-02-17  0:00 Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox