fix version handling so setup.py doesn't need to import terminator itself. Also fix gettext to work across imported files

This commit is contained in:
Chris Jones 2008-06-18 14:02:10 +01:00
parent 3297fe011a
commit 0ce3550f6f
4 changed files with 35 additions and 19 deletions

View File

@ -9,15 +9,7 @@ import glob
import os import os
import sys import sys
def import_terminator(): from terminatorlib.version import *
from types import ModuleType
module = ModuleType('terminator')
module_file = open('terminator', 'r')
exec module_file in module.__dict__
return module
TERMINATOR_BUILD = True
APP_VERSION = import_terminator().APP_VERSION
PO_DIR = 'po' PO_DIR = 'po'
MO_DIR = os.path.join('build', 'mo') MO_DIR = os.path.join('build', 'mo')

View File

@ -17,20 +17,21 @@
"""Terminator by Chris Jones <cmsj@tenshu.net>""" """Terminator by Chris Jones <cmsj@tenshu.net>"""
# Global defines
APP_NAME = 'terminator'
APP_VERSION = '0.9'
# import standard python libs # import standard python libs
import os, platform, sys, string, time, math, subprocess import os, platform, sys, string, time, math, subprocess
from optparse import OptionParser from optparse import OptionParser
#import version details
from terminatorlib.version import *
try: try:
import gettext import gettext
gettext.install (APP_NAME) gettext.install (APP_NAME)
except: except:
def _ (text): import __builtin__
def _t (text):
return text return text
__builtin__.__dict__['_'] = _t
# import unix-lib # import unix-lib
import pwd import pwd
@ -65,10 +66,9 @@ else:
try: try:
import gobject, gtk, pango import gobject, gtk, pango
except: except:
if not TERMINATOR_BUILD: err (_("You need to install the python bindings for " \
err (_("You need to install the python bindings for " \ "gobject, gtk and pango to run Terminator."))
"gobject, gtk and pango to run Terminator.")) sys.exit(1)
sys.exit(1)
# import a library for viewing URLs # import a library for viewing URLs
try: try:

View File

@ -105,4 +105,4 @@ class TerminatorEncoding:
def get_list(): def get_list():
return TerminatorEncoding.encodings return TerminatorEncoding.encodings
get_list = staticmethod(get_list) get_list = staticmethod(get_list)

24
terminatorlib/version.py Normal file
View File

@ -0,0 +1,24 @@
#!/usr/bin/python
# TerminatorVersion - version number
# Copyright (C) 2008 cmsj@tenshu.net
#
# 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, version 2 only.
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
"""TerminatorVersion by Chris Jones <cmsj@tenshu.net>
TerminatorEncoding supplies our version number.
"""
APP_NAME='Terminator'
APP_VERSION='0.9'