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 sys
def import_terminator():
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
from terminatorlib.version import *
PO_DIR = 'po'
MO_DIR = os.path.join('build', 'mo')

View File

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

View File

@ -105,4 +105,4 @@ class TerminatorEncoding:
def get_list():
return TerminatorEncoding.encodings
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'