public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Andreas Sturmlechner" <asturm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-power/nut/files/, sys-power/nut/
Date: Sat, 27 Oct 2018 19:02:49 +0000 (UTC)	[thread overview]
Message-ID: <1540666957.73b9eb1973d6ca6954412dd58b552ef73fe9ae5e.asturm@gentoo> (raw)

commit:     73b9eb1973d6ca6954412dd58b552ef73fe9ae5e
Author:     Michael Perlov <perlovka <AT> gmail <DOT> com>
AuthorDate: Tue Oct 16 12:03:32 2018 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sat Oct 27 19:02:37 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=73b9eb19

sys-power/nut: Add USE gui to install NUT-Monitor

Acked-by: Matthew Thode <prometheanfire <AT> gentoo.org>
Signed-off-by: Michael Perlov <perlovka <AT> gmail.com>
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>
Package-Manager: Portage-2.3.51, Repoman-2.3.11

 sys-power/nut/files/NUT-Monitor-1.3-paths.patch | 48 +++++++++++++++++++++++++
 sys-power/nut/metadata.xml                      |  1 +
 sys-power/nut/nut-2.7.4-r2.ebuild               | 30 ++++++++++++++--
 3 files changed, 77 insertions(+), 2 deletions(-)

diff --git a/sys-power/nut/files/NUT-Monitor-1.3-paths.patch b/sys-power/nut/files/NUT-Monitor-1.3-paths.patch
new file mode 100644
index 00000000000..17bedaead72
--- /dev/null
+++ b/sys-power/nut/files/NUT-Monitor-1.3-paths.patch
@@ -0,0 +1,48 @@
+--- a/scripts/python/app/NUT-Monitor
++++ b/scripts/python/app/NUT-Monitor
+@@ -70,7 +70,7 @@
+         ( cmd_opts, args ) = opt_parser.parse_args()
+ 
+ 
+-        self.__glade_file = os.path.join( os.path.dirname( sys.argv[0] ), "gui-1.3.glade" )
++        self.__glade_file = '/usr/share/nut/gui-1.3.glade'
+ 
+         self.__widgets["interface"]                   = gtk.glade.XML( self.__glade_file, "window1", APP )
+         self.__widgets["main_window"]                 = self.__widgets["interface"].get_widget("window1")
+@@ -103,11 +103,11 @@
+ 
+         # Create the tray icon and connect it to the show/hide method...
+         self.__widgets["status_icon"] = gtk.StatusIcon()
+-        self.__widgets["status_icon"].set_from_file( os.path.join( os.path.dirname( sys.argv[0] ), "pixmaps", "on_line.png" ) )
++        self.__widgets["status_icon"].set_from_file( "/usr/share/nut/pixmaps/on_line.png" )
+         self.__widgets["status_icon"].set_visible( True )
+         self.__widgets["status_icon"].connect( "activate", self.tray_activated )
+ 
+-        self.__widgets["ups_status_image"].set_from_file( os.path.join( os.path.dirname( sys.argv[0] ), "pixmaps", "on_line.png" ) )
++        self.__widgets["ups_status_image"].set_from_file( "/usr/share/nut/pixmaps/on_line.png" )
+ 
+         # Define interface callbacks actions
+         self.__callbacks = { "on_window1_destroy"              : self.quit,
+@@ -265,8 +265,8 @@
+     #-------------------------------------------------------------------
+     # Change the status icon and tray icon
+     def change_status_icon( self, icon="on_line", blink=False ) :
+-        self.__widgets["status_icon"].set_from_file( os.path.join( os.path.dirname( sys.argv[0] ), "pixmaps", "%s.png" % icon ) )
+-        self.__widgets["ups_status_image"].set_from_file( os.path.join( os.path.dirname( sys.argv[0] ), "pixmaps", "%s.png" % icon ) )
++        self.__widgets["status_icon"].set_from_file( "/usr/share/nut/pixmaps/%s.png" % icon )
++        self.__widgets["ups_status_image"].set_from_file( "/usr/share/nut/pixmaps/%s.png" % icon )
+         self.__widgets["status_icon"].set_blinking( blink )
+ 
+     #-------------------------------------------------------------------
+@@ -719,9 +719,9 @@
+ 
+             for k,v in vars.iteritems() :
+                 if ( rwvars.has_key( k ) ) :
+-                    icon_file = os.path.join( os.path.dirname( sys.argv[0] ), "pixmaps", "var-rw.png" )
++                    icon_file = "/usr/share/nut/pixmaps/var-rw.png"
+                 else :
+-                    icon_file = os.path.join( os.path.dirname( sys.argv[0] ), "pixmaps", "var-ro.png" )
++                    icon_file = "/usr/share/nut/pixmaps/var-ro.png"
+ 
+                 icon = gtk.gdk.pixbuf_new_from_file( icon_file )
+                 self.__widgets["ups_vars_tree_store"].append( [ icon, k, v ] )

diff --git a/sys-power/nut/metadata.xml b/sys-power/nut/metadata.xml
index d9ab89aeb36..85d0b12815a 100644
--- a/sys-power/nut/metadata.xml
+++ b/sys-power/nut/metadata.xml
@@ -9,6 +9,7 @@
 		<email>prometheanfire@gentoo.org</email>
 	</maintainer>
 	<use>
+		<flag name="gui">Install NUT-Monitor python gui</flag>
 		<flag name="ipmi">Support IPMI-based UPSes.</flag>
 		<flag name="ups_drivers_al175">Driver for Eltek UPS models with AL175 alarm module</flag>
 		<flag name="ups_drivers_bcmxcp">Driver for UPSes supporting the serial BCM/XCP protocol</flag>

diff --git a/sys-power/nut/nut-2.7.4-r2.ebuild b/sys-power/nut/nut-2.7.4-r2.ebuild
index 5045bf0a37c..031f61d9dd9 100644
--- a/sys-power/nut/nut-2.7.4-r2.ebuild
+++ b/sys-power/nut/nut-2.7.4-r2.ebuild
@@ -3,7 +3,9 @@
 
 EAPI=6
 
-inherit autotools bash-completion-r1 fixheadtails user systemd flag-o-matic toolchain-funcs
+PYTHON_COMPAT=( python2_7 )
+
+inherit autotools bash-completion-r1 desktop fixheadtails flag-o-matic python-single-r1 systemd toolchain-funcs user
 
 MY_P=${P/_/-}
 
@@ -14,11 +16,13 @@ LICENSE="GPL-2"
 SLOT="0"
 KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~x86 ~x86-fbsd"
 
-IUSE="cgi ipmi snmp +usb selinux ssl tcpd xml zeroconf"
+IUSE="cgi gui ipmi snmp +usb selinux ssl tcpd xml zeroconf"
+REQUIRED_USE="gui? ( ${PYTHON_REQUIRED_USE} )"
 
 COMMON_DEPEND="dev-libs/libltdl:*
 	virtual/udev
 	cgi? ( >=media-libs/gd-2[png] )
+	gui? ( dev-python/pygtk[${PYTHON_USEDEP}] )
 	ipmi? ( sys-libs/freeipmi )
 	snmp? ( net-analyzer/net-snmp )
 	ssl? ( >=dev-libs/openssl-1 )
@@ -88,6 +92,7 @@ pkg_setup() {
 	# in some cases on old systems it wasn't in the nut group either!
 	gpasswd -a nut nut 2>/dev/null
 	warningmsg ewarn
+	use gui && python-single-r1_pkg_setup
 }
 
 src_prepare() {
@@ -106,6 +111,8 @@ src_prepare() {
 		-e 's:@LIBSSL_LDFLAGS@:@LIBSSL_LIBS@:' \
 		lib/libupsclient{.pc,-config}.in || die #361685
 
+	use gui && eapply "${FILESDIR}"/NUT-Monitor-1.3-paths.patch
+
 	eautoreconf
 }
 
@@ -169,6 +176,25 @@ src_install() {
 		elog "If you use lighttpd, see lighttpd_nut.conf in the documentation."
 	fi
 
+	if use gui; then
+		python_fix_shebang scripts/python/app
+		python_domodule scripts/python/module/PyNUT.py
+		python_doscript scripts/python/app/NUT-Monitor
+
+		insinto /usr/share/nut
+		doins scripts/python/app/gui-1.3.glade
+
+		dodir /usr/share/nut/pixmaps
+		insinto /usr/share/nut/pixmaps
+		doins scripts/python/app/pixmaps/*
+
+		sed -i -e 's/nut-monitor.png/nut-monitor/' -e 's/Application;//' \
+			scripts/python/app/${PN}-monitor.desktop || die
+
+		doicon scripts/python/app/${PN}-monitor.png
+		domenu scripts/python/app/${PN}-monitor.desktop
+	fi
+
 	# this must be done after all of the install phases
 	for i in "${D}"/etc/nut/*.sample ; do
 		mv "${i}" "${i/.sample/}" || die


             reply	other threads:[~2018-10-27 19:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-27 19:02 Andreas Sturmlechner [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-06-27 17:15 [gentoo-commits] repo/gentoo:master commit in: sys-power/nut/files/, sys-power/nut/ Matthew Thode
2020-01-08 22:27 David Seifert
2023-06-17  3:15 Sam James
2024-05-29 18:56 Robin H. Johnson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1540666957.73b9eb1973d6ca6954412dd58b552ef73fe9ae5e.asturm@gentoo \
    --to=asturm@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox