From ee639ec7da6ec7ecd214d28cd7e2f18bee13f8d7 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Mon, 11 Mar 2013 22:44:15 +0000 Subject: [PATCH] Move VERSION, VERSION_TUPLE, major_version from const.py to version.py As noted in the previous change, importing const into setup.py tried to initialize GrampsLocale and ResourcePath, which won't work. Since all we want is the VERSION string, move that to a new file, gramps/version.py svn: r21614 --- gramps/gen/merge/test/merge_ref_test.py | 3 ++- gramps/gen/plug/_pluginreg.py | 2 +- gramps/gen/plug/utils.py | 3 ++- gramps/grampsapp.py | 5 ++-- gramps/gui/logger/_errorreportassistant.py | 3 ++- gramps/plugins/docgen/htmldoc.py | 3 ++- gramps/plugins/docgen/odfdoc.py | 3 ++- gramps/plugins/export/exportgedcom.py | 2 +- gramps/plugins/export/exportvcard.py | 3 ++- gramps/plugins/export/exportxml.py | 2 +- .../plugins/export/test/exportvcard_test.py | 2 +- gramps/plugins/importer/importxml.py | 2 +- gramps/plugins/webreport/narrativeweb.py | 3 ++- gramps/plugins/webreport/webcal.py | 3 ++- gramps/version.py | 25 +++++++++++++++++++ gramps/webapp/grampsdb/views.py | 2 +- 16 files changed, 50 insertions(+), 16 deletions(-) create mode 100644 gramps/version.py diff --git a/gramps/gen/merge/test/merge_ref_test.py b/gramps/gen/merge/test/merge_ref_test.py index 0a974bfc1..eae2d7255 100644 --- a/gramps/gen/merge/test/merge_ref_test.py +++ b/gramps/gen/merge/test/merge_ref_test.py @@ -37,7 +37,8 @@ import libxml2 import libxslt from libgrampsxml import GRAMPS_XML_VERSION -from ...const import ROOT_DIR, VERSION, USER_PLUGINS +from ...const import ROOT_DIR, USER_PLUGINS +from ....version import VERSION from ...lib import Name, Surname from ...const import GRAMPS_LOCALE as glocale _ = glocale.get_translation().sgettext diff --git a/gramps/gen/plug/_pluginreg.py b/gramps/gen/plug/_pluginreg.py index 9eb3bbe60..db3f55f6a 100644 --- a/gramps/gen/plug/_pluginreg.py +++ b/gramps/gen/plug/_pluginreg.py @@ -43,7 +43,7 @@ import io # GRAMPS modules # #------------------------------------------------------------------------- -from ..const import VERSION as GRAMPSVERSION, VERSION_TUPLE +from ...version import VERSION as GRAMPSVERSION, VERSION_TUPLE from ..const import IMAGE_DIR from ..const import GRAMPS_LOCALE as glocale _ = glocale.get_translation().gettext diff --git a/gramps/gen/plug/utils.py b/gramps/gen/plug/utils.py index 0e8ca6b47..14eb76a67 100644 --- a/gramps/gen/plug/utils.py +++ b/gramps/gen/plug/utils.py @@ -43,7 +43,8 @@ else: # #------------------------------------------------------------------------- from ._pluginreg import make_environment -from ..const import USER_PLUGINS, VERSION_TUPLE +from ..const import USER_PLUGINS +from ...version import VERSION_TUPLE from ..utils.file import get_unicode_path_from_file_chooser from ..const import GRAMPS_LOCALE as glocale _ = glocale.get_translation().gettext diff --git a/gramps/grampsapp.py b/gramps/grampsapp.py index b0844f680..93e1c455a 100644 --- a/gramps/grampsapp.py +++ b/gramps/grampsapp.py @@ -52,7 +52,8 @@ from subprocess import Popen, PIPE # GRAMPS modules # #------------------------------------------------------------------------- -from .gen.const import APP_GRAMPS, USER_DIRLIST, HOME_DIR, VERSION_TUPLE +from .gen.const import APP_GRAMPS, USER_DIRLIST, HOME_DIR +from .version import VERSION_TUPLE from .gen.constfunc import win #------------------------------------------------------------------------- @@ -282,7 +283,7 @@ def show_settings(): bsddb_db_str = 'not found' try: - from .gen.const import VERSION + from .version import VERSION gramps_str = VERSION except: gramps_str = 'not found' diff --git a/gramps/gui/logger/_errorreportassistant.py b/gramps/gui/logger/_errorreportassistant.py index a3733585a..c9ed333df 100644 --- a/gramps/gui/logger/_errorreportassistant.py +++ b/gramps/gui/logger/_errorreportassistant.py @@ -46,7 +46,8 @@ else: # Gramps modules # #------------------------------------------------------------------------- -from gramps.gen.const import VERSION, ICON, SPLASH +from gramps.gen.const import ICON, SPLASH +from gramps.version import VERSION from ..display import display_help, display_url #------------------------------------------------------------------------- diff --git a/gramps/plugins/docgen/htmldoc.py b/gramps/plugins/docgen/htmldoc.py index e027c3c71..acf7a19d6 100644 --- a/gramps/plugins/docgen/htmldoc.py +++ b/gramps/plugins/docgen/htmldoc.py @@ -48,7 +48,8 @@ import time from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.get_translation().gettext from gramps.gen.utils.image import resize_to_jpeg -from gramps.gen.const import DATA_DIR, WEBSTUFF_IMAGE_DIR, PROGRAM_NAME, URL_HOMEPAGE, VERSION +from gramps.gen.const import DATA_DIR, WEBSTUFF_IMAGE_DIR, PROGRAM_NAME, URL_HOMEPAGE +from gramps.version import VERSION from gramps.gen.plug.docgen import BaseDoc, TextDoc, FONT_SANS_SERIF, URL_PATTERN from gramps.plugins.lib.libhtmlbackend import HtmlBackend, process_spaces from gramps.plugins.lib.libhtml import Html diff --git a/gramps/plugins/docgen/odfdoc.py b/gramps/plugins/docgen/odfdoc.py index 832df55f8..afb58e6bf 100644 --- a/gramps/plugins/docgen/odfdoc.py +++ b/gramps/plugins/docgen/odfdoc.py @@ -91,7 +91,8 @@ from gramps.gen.plug.docgen import (BaseDoc, TextDoc, DrawDoc, graphicstyle, LOCAL_HYPERLINK, LOCAL_TARGET) from gramps.gen.plug.docgen.fontscale import string_width from gramps.plugins.lib.libodfbackend import OdfBackend -from gramps.gen.const import PROGRAM_NAME, VERSION +from gramps.gen.const import PROGRAM_NAME +from gramps.version import VERSION from gramps.gen.plug.report import utils as ReportUtils from gramps.gen.utils.image import image_size, image_dpi, image_actual_size from gramps.gen.errors import ReportError diff --git a/gramps/plugins/export/exportgedcom.py b/gramps/plugins/export/exportgedcom.py index 4ae2f1582..795773108 100644 --- a/gramps/plugins/export/exportgedcom.py +++ b/gramps/plugins/export/exportgedcom.py @@ -45,7 +45,7 @@ import io from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.get_translation().gettext from gramps.gen.lib import AttributeType, ChildRefType, Citation, Date, EventRoleType, EventType, LdsOrd, NameType, NoteType, Person, UrlType -from gramps.gen.const import VERSION +from gramps.version import VERSION import gramps.plugins.lib.libgedcom as libgedcom from gramps.gen.errors import DatabaseError from gramps.gui.plug.export import WriterOptionBox diff --git a/gramps/plugins/export/exportvcard.py b/gramps/plugins/export/exportvcard.py index 03cf93718..d5da7804e 100644 --- a/gramps/plugins/export/exportvcard.py +++ b/gramps/plugins/export/exportvcard.py @@ -50,7 +50,8 @@ log = logging.getLogger(".ExportVCard") from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.get_translation().gettext from gramps.gui.plug.export import WriterOptionBox -from gramps.gen.const import PROGRAM_NAME, VERSION +from gramps.gen.const import PROGRAM_NAME +from gramps.version import VERSION from gramps.gen.lib import Date from gramps.gen.lib.urltype import UrlType from gramps.gen.lib.eventtype import EventType diff --git a/gramps/plugins/export/exportxml.py b/gramps/plugins/export/exportxml.py index c97c031e5..86bca0025 100644 --- a/gramps/plugins/export/exportxml.py +++ b/gramps/plugins/export/exportxml.py @@ -61,7 +61,7 @@ LOG = logging.getLogger(".WriteXML") from gramps.gen.lib import Date, Person from gramps.gen.updatecallback import UpdateCallback from gramps.gen.db.exceptions import DbWriteFailure -from gramps.gen.const import VERSION +from gramps.version import VERSION from gramps.gen.constfunc import win from gramps.gui.plug.export import WriterOptionBox import gramps.plugins.lib.libgrampsxml as libgrampsxml diff --git a/gramps/plugins/export/test/exportvcard_test.py b/gramps/plugins/export/test/exportvcard_test.py index a30ae6a03..d0427cb02 100644 --- a/gramps/plugins/export/test/exportvcard_test.py +++ b/gramps/plugins/export/test/exportvcard_test.py @@ -40,7 +40,7 @@ import subprocess import libxml2 from gramps.plugins.lib.libgrampsxml import GRAMPS_XML_VERSION -from gramps.gen.const import VERSION +from gramps.version import VERSION import exportvcard class VCardCheck(unittest.TestCase): diff --git a/gramps/plugins/importer/importxml.py b/gramps/plugins/importer/importxml.py index 6d3bd24f6..93d65ac5f 100644 --- a/gramps/plugins/importer/importxml.py +++ b/gramps/plugins/importer/importxml.py @@ -67,7 +67,7 @@ from gramps.gen.db.dbconst import (PERSON_KEY, FAMILY_KEY, SOURCE_KEY, REPOSITORY_KEY, NOTE_KEY, TAG_KEY, CITATION_KEY) from gramps.gen.updatecallback import UpdateCallback -from gramps.gen.const import VERSION +from gramps.version import VERSION from gramps.gen.config import config #import gramps.plugins.lib.libgrampsxml from gramps.plugins.lib import libgrampsxml diff --git a/gramps/plugins/webreport/narrativeweb.py b/gramps/plugins/webreport/narrativeweb.py index 354733a90..de06ee0c5 100644 --- a/gramps/plugins/webreport/narrativeweb.py +++ b/gramps/plugins/webreport/narrativeweb.py @@ -111,7 +111,8 @@ from gramps.gen.lib import (ChildRefType, Date, EventType, FamilyRelType, Name, EventRoleType, Family, Event, Place, Source, Citation, MediaObject, Repository, Note, Tag) from gramps.gen.lib.date import Today -from gramps.gen.const import PROGRAM_NAME, URL_HOMEPAGE, VERSION +from gramps.gen.const import PROGRAM_NAME, URL_HOMEPAGE +from gramps.version import VERSION from gramps.gen.sort import Sort from gramps.gen.plug.menu import PersonOption, NumberOption, StringOption, \ BooleanOption, EnumeratedListOption, FilterOption, \ diff --git a/gramps/plugins/webreport/webcal.py b/gramps/plugins/webreport/webcal.py index 250604278..ea96b1c52 100644 --- a/gramps/plugins/webreport/webcal.py +++ b/gramps/plugins/webreport/webcal.py @@ -50,7 +50,8 @@ log = logging.getLogger(".WebPage") #------------------------------------------------------------------------ from gramps.gen.lib import Date, Name, NameType, Person from gramps.gen.lib.date import Today -from gramps.gen.const import PROGRAM_NAME, URL_HOMEPAGE, USER_HOME, VERSION +from gramps.gen.const import PROGRAM_NAME, URL_HOMEPAGE, USER_HOME +from gramps.versioin import VERSION from gramps.gen.constfunc import win from gramps.gen.config import config from gramps.gen.plug.report import Report diff --git a/gramps/version.py b/gramps/version.py new file mode 100644 index 000000000..ff5015277 --- /dev/null +++ b/gramps/version.py @@ -0,0 +1,25 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2013 John Ralls +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +# $Id$ + +VERSION_TUPLE = (4, 1, 0) +VERSION = '.'.join(map(str,VERSION_TUPLE)) +major_version = "%s.%s" % (VERSION_TUPLE[0], VERSION_TUPLE[1]) diff --git a/gramps/webapp/grampsdb/views.py b/gramps/webapp/grampsdb/views.py index 099005bd4..0dada8b30 100644 --- a/gramps/webapp/grampsdb/views.py +++ b/gramps/webapp/grampsdb/views.py @@ -59,7 +59,7 @@ from django.utils import simplejson # Gramps Modules # #------------------------------------------------------------------------ -from gramps.gen.const import VERSION +from gramps.version import VERSION # Gramps-connect imports: import gramps.webapp