Revert change to const.py

svn: r21673
This commit is contained in:
Nick Hall 2013-03-17 12:29:17 +00:00
parent d643dde344
commit 71c2655976

View File

@ -4,6 +4,7 @@
#
# Copyright (C) 2000-2006 Donald N. Allingham
# Copyright (C) 2012 Doug Blank
# 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
@ -50,21 +51,7 @@ from .svn_revision import get_svn_revision
#
#-------------------------------------------------------------------------
PROGRAM_NAME = "Gramps"
VERSION = "4.1.0"
if VERSION == "@" + "VERSIONSTRING" + "@":
raise Exception("Please run 'python setup.py build'")
def get_version_tuple(v):
""" Get the numeric-dotted part of version number"""
retval = ""
for c in v:
if c.isdigit() or (c == "." and retval.count(".") <= 1):
retval += c
else:
break
return tuple(map(int, retval.split(".")))
VERSION_TUPLE = get_version_tuple(VERSION)
major_version = "%s.%s" % (VERSION_TUPLE[0], VERSION_TUPLE[1])
from ..version import VERSION, VERSION_TUPLE, major_version
#-------------------------------------------------------------------------
#
# Standard GRAMPS Websites
@ -93,23 +80,6 @@ APP_GRAMPS_PKG = "application/x-gramps-package"
APP_GENEWEB = "application/x-geneweb"
APP_VCARD = ["text/x-vcard", "text/x-vcalendar"]
#-------------------------------------------------------------------------
#
# system paths
#
#-------------------------------------------------------------------------
LOCALE_DIR = "/Users/tim/gramps/trunk/build/mo"
#-------------------------------------------------------------------------
#
# Platforms
# Never test on LINUX, handle Linux in the else statement as default
#
#-------------------------------------------------------------------------
LINUX = ["Linux", "linux", "linux2"]
MACOS = ["Darwin", "darwin"]
WINDOWS = ["Windows", "win32"]
#-------------------------------------------------------------------------
#
# Determine the home directory. According to Wikipedia, most UNIX like
@ -195,7 +165,7 @@ WEBSTUFF_IMAGE_DIR = os.path.join(WEBSTUFF_DIR, "images")
USE_TIPS = False
if os.sys.platform in WINDOWS:
if sys.platform == 'win32':
USE_THUMBNAILER = False
else:
USE_THUMBNAILER = True
@ -205,10 +175,10 @@ else:
# Paths to data files.
#
#-------------------------------------------------------------------------
LOCALE_DIR = "/Users/tim/gramps/trunk/build/mo"
DATA_DIR = "/Users/tim/gramps/trunk/data"
IMAGE_DIR = "/Users/tim/gramps/trunk/images"
DOC_DIR = "/Users/tim/gramps/trunk"
from gramps.gen.utils.resourcepath import ResourcePath
_resources = ResourcePath()
DATA_DIR = _resources.data_dir
IMAGE_DIR = _resources.image_dir
TIP_DATA = os.path.join(DATA_DIR, "tips.xml")
PAPERSIZE = os.path.join(DATA_DIR, "papersize.xml")
@ -217,14 +187,14 @@ ICON = os.path.join(IMAGE_DIR, "gramps.png")
LOGO = os.path.join(IMAGE_DIR, "logo.png")
SPLASH = os.path.join(IMAGE_DIR, "splash.jpg")
LICENSE_FILE = os.path.join(DOC_DIR, 'COPYING')
LICENSE_FILE = os.path.join(_resources.doc_dir, 'COPYING')
#-------------------------------------------------------------------------
#
# Init Localization
#
#-------------------------------------------------------------------------
from .utils.grampslocale import GrampsLocale
GRAMPS_LOCALE = GrampsLocale()
from gramps.gen.utils.grampslocale import GrampsLocale
GRAMPS_LOCALE = GrampsLocale(localedir=_resources.locale_dir)
_ = GRAMPS_LOCALE.get_translation().sgettext
#-------------------------------------------------------------------------
@ -247,6 +217,7 @@ AUTHORS = [
"Martin Hawlisch",
"Richard Taylor",
"Tim Waugh",
"John Ralls"
]
AUTHORS_FILE = os.path.join(DATA_DIR, "authors.xml")
@ -338,29 +309,3 @@ LONGOPTS = [
SHORTOPTS = "O:C:i:e:f:a:p:d:c:lLhuv?s"
GRAMPS_UUID = uuid.UUID('516cd010-5a41-470f-99f8-eb22f1098ad6')
def need_to_update_const():
""" Check to see if this file is older than
setup.py or const.py.in """
this_file = os.path.join(ROOT_DIR, "gen", "const.py")
in_file = os.path.join(ROOT_DIR, "gen", "const.py.in")
setup_file = os.path.join(ROOT_DIR, "..", "setup.py")
if (os.path.exists(this_file) and
os.path.exists(in_file) and
os.path.exists(setup_file)):
this_file_time = os.path.getmtime(this_file)
in_file_time = os.path.getmtime(in_file)
setup_file_time = os.path.getmtime(setup_file)
# Is this file older than others? If so,
# need to run setup
return (this_file_time < in_file_time or
this_file_time < setup_file_time)
else:
# Can't tell because can't find the files
return False
if need_to_update_const():
print("Outdated gramps.gen.const; please run 'python setup.py build'")