mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-08 01:18:39 +00:00
translations installer
This commit is contained in:
parent
292886c4cc
commit
284ddcf4d2
37 changed files with 17029 additions and 12 deletions
78
setup.py
78
setup.py
|
@ -16,11 +16,15 @@
|
|||
# 51 Franklin Street, Fifth Floor
|
||||
# Boston, MA 02110-1301, USA.
|
||||
|
||||
import platform, os, glob
|
||||
import platform, os, os.path, glob
|
||||
from distutils.core import setup, Extension
|
||||
|
||||
|
||||
from distutils import sysconfig
|
||||
import shutil
|
||||
from distutils import cmd
|
||||
from distutils.command.install import install as _install
|
||||
from distutils.command.install_data import install_data as _install_data
|
||||
from distutils.command.build import build as _build
|
||||
import msgfmt
|
||||
|
||||
pythonVersion = platform.python_version()[0:3]
|
||||
|
||||
|
@ -118,19 +122,11 @@ deluge_core = Extension('deluge_core',
|
|||
'libtorrent/src/kademlia/rpc_manager.cpp',
|
||||
'libtorrent/src/kademlia/traversal_algorithm.cpp'])
|
||||
|
||||
data = [('share/deluge/glade', glob.glob('glade/*.glade')),
|
||||
('share/deluge/pixmaps', glob.glob('pixmaps/*.png')),
|
||||
('share/applications' , ['deluge.desktop']),
|
||||
('share/pixmaps' , ['deluge.xpm'])]
|
||||
|
||||
for plugin in glob.glob('plugins/*'):
|
||||
data.append( ('share/deluge/' + plugin, glob.glob(plugin + '/*')) )
|
||||
|
||||
# Thanks to Iain Nicol for code to save the location for installed prefix
|
||||
# At runtime, we need to know where we installed the data to.
|
||||
import shutil
|
||||
from distutils import cmd
|
||||
from distutils.command.install import install as _install
|
||||
|
||||
|
||||
class write_data_install_path(cmd.Command):
|
||||
description = 'saves the data installation path for access at runtime'
|
||||
|
@ -148,6 +144,7 @@ class write_data_install_path(cmd.Command):
|
|||
)
|
||||
|
||||
def run(self):
|
||||
print self.data_install_dir
|
||||
conf_filename = os.path.join(self.lib_build_dir,
|
||||
'deluge', 'dcommon.py')
|
||||
|
||||
|
@ -176,16 +173,73 @@ class unwrite_data_install_path(cmd.Command):
|
|||
'deluge', 'dcommon.py')
|
||||
shutil.copyfile('src/dcommon.py', dest)
|
||||
|
||||
class build_trans(cmd.Command):
|
||||
description = 'Compile .po files into .mo files'
|
||||
|
||||
def initialize_options(self):
|
||||
pass
|
||||
|
||||
def finalize_options(self):
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
po_dir = os.path.join(os.path.dirname(__file__), 'po')
|
||||
for path, names, filenames in os.walk(po_dir):
|
||||
for f in filenames:
|
||||
if f.endswith('.po'):
|
||||
lang = f[:len(f) - 3]
|
||||
src = os.path.join(path, f)
|
||||
dest_path = os.path.join('build', 'locale', lang, 'LC_MESSAGES')
|
||||
dest = os.path.join(dest_path, 'deluge.mo')
|
||||
if not os.path.exists(dest_path):
|
||||
os.makedirs(dest_path)
|
||||
if not os.path.exists(dest):
|
||||
print 'Compiling %s' % src
|
||||
msgfmt.make(src, dest)
|
||||
else:
|
||||
src_mtime = os.stat(src)[8]
|
||||
dest_mtime = os.stat(dest)[8]
|
||||
if src_mtime > dest_mtime:
|
||||
print 'Compiling %s' % src
|
||||
msgfmt.make(src, dest)
|
||||
|
||||
class build(_build):
|
||||
sub_commands = _build.sub_commands + [('build_trans', None)]
|
||||
def run(self):
|
||||
_build.run(self)
|
||||
|
||||
class install(_install):
|
||||
sub_commands = [('write_data_install_path', None)] + \
|
||||
_install.sub_commands + [('unwrite_data_install_path', None)]
|
||||
def run(self):
|
||||
_install.run(self)
|
||||
|
||||
class install_data(_install_data):
|
||||
def run(self):
|
||||
for lang in os.listdir('build/locale/'):
|
||||
lang_dir = os.path.join('share', 'locale', lang, 'LC_MESSAGES')
|
||||
lang_file = os.path.join('build', 'locale', lang, 'LC_MESSAGES', 'deluge.mo')
|
||||
self.data_files.append( (lang_dir, [lang_file]) )
|
||||
_install_data.run(self)
|
||||
|
||||
|
||||
|
||||
cmdclass = {
|
||||
'build': build,
|
||||
'install': install,
|
||||
'build_trans': build_trans,
|
||||
'install_data': install_data,
|
||||
'write_data_install_path': write_data_install_path,
|
||||
'unwrite_data_install_path': unwrite_data_install_path,
|
||||
}
|
||||
|
||||
data = [('share/deluge/glade', glob.glob('glade/*.glade')),
|
||||
('share/deluge/pixmaps', glob.glob('pixmaps/*.png')),
|
||||
('share/applications' , ['deluge.desktop']),
|
||||
('share/pixmaps' , ['deluge.xpm'])]
|
||||
|
||||
for plugin in glob.glob('plugins/*'):
|
||||
data.append( ('share/deluge/' + plugin, glob.glob(plugin + '/*')) )
|
||||
|
||||
setup(name="deluge", fullname="Deluge BitTorrent Client", version="0.4.90.3",
|
||||
author="Zach Tibbitts, Alon Zakai",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue