2007-07-28 03:37:57 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
from distutils.core import setup
|
2007-12-29 03:01:28 +00:00
|
|
|
from distutils.command.install_data import install_data
|
2008-04-10 16:08:53 +00:00
|
|
|
from distutils.command.build import build
|
2007-12-29 03:01:28 +00:00
|
|
|
from distutils.dep_util import newer
|
|
|
|
from distutils.log import info
|
|
|
|
import glob
|
|
|
|
import os
|
|
|
|
import sys
|
2008-06-18 17:07:15 +00:00
|
|
|
import platform
|
2007-12-29 03:01:28 +00:00
|
|
|
|
2008-06-18 13:02:10 +00:00
|
|
|
from terminatorlib.version import *
|
2008-04-03 04:44:58 +00:00
|
|
|
|
2008-04-10 16:08:53 +00:00
|
|
|
PO_DIR = 'po'
|
|
|
|
MO_DIR = os.path.join('build', 'mo')
|
2008-04-16 20:43:25 +00:00
|
|
|
WITHOUT_NLS = sys.platform == 'win32' or os.environ.has_key("WITHOUT_NLS")
|
2007-12-29 03:01:28 +00:00
|
|
|
|
2008-04-10 16:08:53 +00:00
|
|
|
class BuildData(build):
|
|
|
|
def run (self):
|
|
|
|
build.run (self)
|
2007-12-29 03:01:28 +00:00
|
|
|
|
2008-04-16 20:43:25 +00:00
|
|
|
if WITHOUT_NLS:
|
2008-04-10 16:08:53 +00:00
|
|
|
return
|
2007-12-29 03:01:28 +00:00
|
|
|
|
2008-04-10 16:08:53 +00:00
|
|
|
for po in glob.glob (os.path.join (PO_DIR, '*.po')):
|
2007-12-29 03:01:28 +00:00
|
|
|
lang = os.path.basename(po[:-3])
|
2008-07-06 15:20:53 +00:00
|
|
|
mo = os.path.join(MO_DIR, lang, 'terminator.mo')
|
2007-12-29 03:01:28 +00:00
|
|
|
|
|
|
|
directory = os.path.dirname(mo)
|
|
|
|
if not os.path.exists(directory):
|
|
|
|
info('creating %s' % directory)
|
|
|
|
os.makedirs(directory)
|
|
|
|
|
|
|
|
if newer(po, mo):
|
|
|
|
cmd = 'msgfmt -o %s %s' % (mo, po)
|
|
|
|
info('compiling %s -> %s' % (po, mo))
|
2008-06-10 23:35:53 +00:00
|
|
|
os.system(cmd)
|
|
|
|
|
2008-04-10 16:08:53 +00:00
|
|
|
|
|
|
|
class InstallData(install_data):
|
|
|
|
def run (self):
|
2008-07-06 15:20:53 +00:00
|
|
|
self.data_files.extend (self._find_mo_files ())
|
2008-04-10 16:08:53 +00:00
|
|
|
install_data.run (self)
|
|
|
|
|
2008-07-06 15:20:53 +00:00
|
|
|
def _find_mo_files (self):
|
2008-04-10 16:08:53 +00:00
|
|
|
data_files = []
|
|
|
|
|
2008-04-16 20:43:25 +00:00
|
|
|
if WITHOUT_NLS:
|
2008-04-10 16:08:53 +00:00
|
|
|
return data_files
|
|
|
|
|
2008-07-06 15:20:53 +00:00
|
|
|
for mo in glob.glob (os.path.join (MO_DIR, '*', 'terminator.mo')):
|
|
|
|
lang = os.path.basename(os.path.dirname(mo))
|
|
|
|
dest = os.path.join('share', 'locale', lang, 'LC_MESSAGES')
|
2008-04-10 16:08:53 +00:00
|
|
|
data_files.append((dest, [mo]))
|
2007-12-29 03:01:28 +00:00
|
|
|
|
|
|
|
return data_files
|
|
|
|
|
2007-07-28 03:37:57 +00:00
|
|
|
|
2008-06-18 17:07:15 +00:00
|
|
|
if platform.system() == 'FreeBSD':
|
|
|
|
man_dir = 'man'
|
|
|
|
else:
|
|
|
|
man_dir = 'share/man'
|
|
|
|
|
2007-07-28 03:37:57 +00:00
|
|
|
setup(name='Terminator',
|
2008-03-29 14:57:37 +00:00
|
|
|
version=APP_VERSION,
|
2007-07-28 03:37:57 +00:00
|
|
|
description='Terminator, the robot future of terminals',
|
|
|
|
author='Chris Jones',
|
|
|
|
author_email='cmsj@tenshu.net',
|
2007-07-28 12:10:30 +00:00
|
|
|
url='http://www.tenshu.net/terminator/',
|
2008-03-29 14:57:37 +00:00
|
|
|
license='GNU GPL v2',
|
2007-08-25 14:33:24 +00:00
|
|
|
scripts=['terminator'],
|
2007-12-29 02:27:39 +00:00
|
|
|
data_files=[
|
2008-02-14 23:55:17 +00:00
|
|
|
('share/applications', ['data/terminator.desktop']),
|
2008-06-18 17:07:15 +00:00
|
|
|
(os.path.join(man_dir, 'man1'), ['doc/terminator.1']),
|
|
|
|
(os.path.join(man_dir, 'man5'), ['doc/terminator_config.5']),
|
2008-02-08 10:48:41 +00:00
|
|
|
('share/pixmaps', ['data/icons/48x48/apps/terminator.png']),
|
2008-02-08 10:29:40 +00:00
|
|
|
('share/icons/hicolor/scalable/apps', glob.glob('data/icons/scalable/apps/*.svg')),
|
2008-02-08 10:30:47 +00:00
|
|
|
('share/icons/hicolor/16x16/apps', glob.glob('data/icons/16x16/apps/*.png')),
|
|
|
|
('share/icons/hicolor/22x22/apps', glob.glob('data/icons/22x22/apps/*.png')),
|
|
|
|
('share/icons/hicolor/24x24/apps', glob.glob('data/icons/24x24/apps/*.png')),
|
2008-02-08 10:45:36 +00:00
|
|
|
('share/icons/hicolor/48x48/apps', glob.glob('data/icons/48x48/apps/*.png')),
|
2008-06-04 10:07:25 +00:00
|
|
|
('share/icons/hicolor/16x16/actions', glob.glob('data/icons/16x16/actions/*.png')),
|
2007-12-29 02:27:39 +00:00
|
|
|
],
|
2008-05-21 10:17:55 +00:00
|
|
|
packages=['terminatorlib'],
|
2008-04-10 16:08:53 +00:00
|
|
|
cmdclass={'build': BuildData, 'install_data': InstallData}
|
2007-07-28 03:37:57 +00:00
|
|
|
)
|
|
|
|
|