Mercurial > libervia-backend
comparison setup.py @ 225:fd9b7834d98a
distutils installation script, draft
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 05 Jan 2011 01:56:36 +0100 |
parents | |
children | 533507bb4e32 |
comparison
equal
deleted
inserted
replaced
224:9c6ee3f9ab29 | 225:fd9b7834d98a |
---|---|
1 #!/usr/bin/env python | |
2 # -*- coding: utf-8 -*- | |
3 | |
4 from distutils.command.install import install | |
5 from distutils.core import setup | |
6 from distutils.file_util import copy_file | |
7 import os,sys,subprocess | |
8 from stat import ST_MODE | |
9 from glob import glob | |
10 | |
11 NAME = 'sat' | |
12 LAUNCH_DAEMON_COMMAND = 'sat' | |
13 | |
14 | |
15 class custom_install(install): | |
16 | |
17 def custom_auto_options(self): | |
18 """Change options for twistd in the shell script | |
19 Mainly change the paths""" | |
20 sh_buffer = "" | |
21 run_dir = os.path.dirname(self.sh_script_path) | |
22 with open(self.sh_script_path,'r') as sh_file: | |
23 for ori_line in sh_file: | |
24 if ori_line.startswith('DAEMON='): | |
25 dest_line = 'DAEMON=""\n' #we want to launch sat as a daemon | |
26 elif ori_line.startswith('TAP_PATH='): | |
27 dest_line = 'TAP_PATH="%s/"\n' % run_dir | |
28 else: | |
29 dest_line = ori_line | |
30 sh_buffer += dest_line | |
31 | |
32 with open(self.sh_script_path,'w') as sh_file: | |
33 sh_file.write(sh_buffer) | |
34 | |
35 | |
36 def custom_create_links(self): | |
37 """Create symbolic links to executables""" | |
38 #the script which launch the daemon | |
39 links = [(self.sh_script_path,LAUNCH_DAEMON_COMMAND),] | |
40 for source,dest in links: | |
41 dest_name, copied = copy_file(source, os.path.join(self.install_scripts, dest), link='sym') | |
42 assert (copied) | |
43 #we change the perm in the same way as in the original install_scripts | |
44 mode = ((os.stat(dest_name)[ST_MODE]) | 0555) & 07777 | |
45 os.chmod(dest_name, mode) | |
46 | |
47 def run(self): | |
48 install.run(self) | |
49 print ('running post installation stuff') | |
50 self.sh_script_path = os.path.join(self.install_lib,'sat','sat.sh') | |
51 self.primitivus_path = os.path.join(self.install_lib,'sat_frontends','primitivus') | |
52 self.custom_auto_options() | |
53 self.custom_create_links() | |
54 | |
55 | |
56 | |
57 setup(name=NAME, | |
58 version='0.1.0', | |
59 description=u'Salut à Toi multi-frontend XMPP client', | |
60 long_description=u'Salut à Toi (SàT) is a XMPP client based on a daemon/frontend architecture. You can use it with the desktop frontend (wix - WxPython based), console ui frontend (Primitivus, Urwid based), or command line frontend (jp), and others are coming. ', | |
61 author='Goffi (Jérôme Poisson)', | |
62 author_email='goffi@goffi.org', | |
63 url='http://wiki.goffi.org/wiki/Salut_%C3%A0_Toi', | |
64 classifiers=['Development Status :: 3 - Alpha', | |
65 'Environment :: Console', | |
66 'Environment :: X11 Applications :: GTK', | |
67 'Framework :: Twisted', | |
68 'License :: OSI Approved :: GNU General Public License (GPL)', | |
69 'Operating System :: POSIX :: Linux', | |
70 'Topic :: Communications :: Chat'], | |
71 package_dir = {'sat':'src', 'sat_frontends':'frontends/src'}, | |
72 packages=['sat','sat.tools','sat.bridge', 'sat.plugins', | |
73 'sat_frontends', 'sat_frontends.bridge', 'sat_frontends.quick_frontend', | |
74 'sat_frontends.primitivus'], | |
75 package_data = {'sat': ['sat.tac','sat.sh']}, | |
76 data_files=[(os.path.join(sys.prefix,'share/locale/fr/LC_MESSAGES'), ['i18n/fr/LC_MESSAGES/sat.mo']), | |
77 (os.path.join(sys.prefix,'share/locale/fr/LC_MESSAGES'), ['frontends/i18n/fr/LC_MESSAGES/sat_frontend.mo']), | |
78 (os.path.join(sys.prefix,'share/locale/fr/LC_MESSAGES'), ['frontends/src/jp/i18n/fr/LC_MESSAGES/jp.mo']), | |
79 ('share/doc/%s' % NAME, ['CHANGELOG', 'COPYING', 'INSTALL', 'README', 'README4TRANSLATORS'])], | |
80 scripts=['frontends/src/jp/jp', 'frontends/src/primitivus/primitivus'], | |
81 cmdclass=dict(install=custom_install), | |
82 ) | |
83 |