[gnome-news/wip/jfelder/meson-support: 4/5] build: Do not put version number in a file
- From: Jean Felder <jfelder src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-news/wip/jfelder/meson-support: 4/5] build: Do not put version number in a file
- Date: Tue, 22 Jan 2019 18:05:49 +0000 (UTC)
commit c01a111f03acf97678c4aa4afc2f1b88b4487f1b
Author: Jean Felder <jean felder gmail com>
Date: Fri Jan 11 23:32:24 2019 +0100
build: Do not put version number in a file
Directly use gnome-music.in
Makefile.am | 4 +---
VERSION.in | 1 -
configure.ac | 1 -
data/gnome-news.gresource.xml | 1 -
gnome-news.in | 2 +-
gnomenews/about.py | 14 +++-----------
gnomenews/application.py | 6 ++++--
7 files changed, 9 insertions(+), 20 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 9976ac8..0dd99b7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,7 +4,6 @@ bin_SCRIPTS = gnome-news
EXTRA_DIST = \
gnome-news.in \
- VERSION.in \
$(NULL)
CLEANFILES = \
@@ -30,7 +29,6 @@ GITIGNOREFILES = \
install-sh \
missing \
py-compile \
- VERSION \
gnomenews/__pycache__ \
$(NULL)
@@ -47,7 +45,7 @@ gnome-news: gnome-news.in Makefile
-e s!\@pythondir\@!$(pythondir)! \
-e s!\@pyexecdir\@!$(pyexecdir)! \
-e s!\@PACKAGE\@!$(PACKAGE)! \
- -e s!\@VERSION\@!$(VERSION)! \
+ -e s!\@version\@!$(VERSION)! \
< $< > $@
chmod a+x $@
diff --git a/configure.ac b/configure.ac
index b180a9b..1d2d281 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,7 +30,6 @@ AX_REQUIRE_DEFINED([APPSTREAM_XML])
APPSTREAM_XML
AC_CONFIG_FILES([
- VERSION
Makefile
data/Makefile
data/icons/Makefile
diff --git a/data/gnome-news.gresource.xml b/data/gnome-news.gresource.xml
index f85b773..d235d59 100644
--- a/data/gnome-news.gresource.xml
+++ b/data/gnome-news.gresource.xml
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/News">
- <file compressed="true" alias="VERSION">../VERSION</file>
<file compressed="true" preprocess="xml-stripblanks">gtk/menus.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/empty-view.ui</file>
<file compressed="true" preprocess="xml-stripblanks">ui/headerbar.ui</file>
diff --git a/gnome-news.in b/gnome-news.in
old mode 100644
new mode 100755
index a28d0a2..f5555ae
--- a/gnome-news.in
+++ b/gnome-news.in
@@ -85,7 +85,7 @@ if __name__ == "__main__":
from gnomenews.application import Application
- app = Application()
+ app = Application("@version@")
signal.signal(signal.SIGINT, signal.SIG_DFL)
exit_status = app.run(sys.argv)
sys.exit(exit_status)
diff --git a/gnomenews/about.py b/gnomenews/about.py
index 29d7d9e..d1502b3 100644
--- a/gnomenews/about.py
+++ b/gnomenews/about.py
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-from gi.repository import Gtk, Gio
+from gi.repository import Gtk
AUTHORS = [
"Felipe Borges",
@@ -31,7 +31,7 @@ ARTISTS = [
class AboutDialog(Gtk.AboutDialog):
- def __init__(self, parent):
+ def __init__(self, parent, version):
Gtk.AboutDialog.__init__(self)
self.parent = parent
self.set_modal(True)
@@ -40,14 +40,6 @@ class AboutDialog(Gtk.AboutDialog):
self.set_authors(AUTHORS)
self.set_copyright("Copyright © 2015 GNOME Foundation")
self.set_license_type(Gtk.License.GPL_3_0)
- self.set_version(self._read_file("VERSION")[0])
+ self.set_version(version)
self.set_website("https://wiki.gnome.org/Design/Apps/Potential/News")
self.set_logo_icon_name("gnome-news")
-
- @staticmethod
- def _read_file(fname):
- f = Gio.File.new_for_uri("resource:///org/gnome/News/%s" % fname)
- lines = f.load_contents(None)[1].decode().split("\n")
- # Drop lines which empty or starts with '#'
- lines_filtered = list(filter(lambda k: not k.startswith("#"), filter(None, lines)))
- return lines_filtered
diff --git a/gnomenews/application.py b/gnomenews/application.py
index 91bb63d..a1ea2af 100644
--- a/gnomenews/application.py
+++ b/gnomenews/application.py
@@ -30,7 +30,7 @@ import os.path
class Application(Gtk.Application):
@log
- def __init__(self):
+ def __init__(self, version):
Gtk.Application.__init__(self,
application_id='org.gnome.News',
flags=Gio.ApplicationFlags.FLAGS_NONE)
@@ -38,6 +38,8 @@ class Application(Gtk.Application):
GLib.set_prgname('gnome-news')
self.settings = Gio.Settings.new('org.gnome.News')
+ self._version = version
+
cssProviderFile = Gio.File.new_for_uri('resource:///org/gnome/News/theme/Adwaita.css')
cssProvider = Gtk.CssProvider()
cssProvider.load_from_file(cssProviderFile)
@@ -80,7 +82,7 @@ class Application(Gtk.Application):
self._about_dialog = None
if not self._about_dialog:
- self._about_dialog = AboutDialog(self._window)
+ self._about_dialog = AboutDialog(self._window, self._version)
self._about_dialog.connect("destroy", on_destroy)
self._about_dialog.present()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]