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
This commit is contained in:
John Ralls 2013-03-11 22:44:15 +00:00
parent fa0eb6cebe
commit ee639ec7da
16 changed files with 50 additions and 16 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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'

View File

@ -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
#-------------------------------------------------------------------------

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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):

View File

@ -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

View File

@ -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, \

View File

@ -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

25
gramps/version.py Normal file
View File

@ -0,0 +1,25 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2013 John Ralls <jralls@ceridwen.us>
#
# 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])

View File

@ -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