annotate setup.py @ 525:5431136501ab

core: Triggers can now frobid other triggers execution if a trigger raise SkipOtherTriggers exception, normal behaviour will occure, skipping other triggers
author Goffi <goffi@goffi.org>
date Sun, 21 Oct 2012 19:28:38 +0200
parents 2a072735e459
children 8b5e142354ca
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
225
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
1 #!/usr/bin/env python
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
3
238
83d2bc0abf2a version, README, CHANGELOG and INSTALL updates
Goffi <goffi@goffi.org>
parents: 237
diff changeset
4 """
83d2bc0abf2a version, README, CHANGELOG and INSTALL updates
Goffi <goffi@goffi.org>
parents: 237
diff changeset
5 SAT: a jabber client
83d2bc0abf2a version, README, CHANGELOG and INSTALL updates
Goffi <goffi@goffi.org>
parents: 237
diff changeset
6 Copyright (C) 2009, 2010, 2011 Jérôme Poisson (goffi@goffi.org)
83d2bc0abf2a version, README, CHANGELOG and INSTALL updates
Goffi <goffi@goffi.org>
parents: 237
diff changeset
7
83d2bc0abf2a version, README, CHANGELOG and INSTALL updates
Goffi <goffi@goffi.org>
parents: 237
diff changeset
8 This program is free software: you can redistribute it and/or modify
480
2a072735e459 Licence modification: the full project is now under AGPL v3+ instead of GPL v3+
Goffi <goffi@goffi.org>
parents: 473
diff changeset
9 it under the terms of the GNU Affero General Public License as published by
238
83d2bc0abf2a version, README, CHANGELOG and INSTALL updates
Goffi <goffi@goffi.org>
parents: 237
diff changeset
10 the Free Software Foundation, either version 3 of the License, or
83d2bc0abf2a version, README, CHANGELOG and INSTALL updates
Goffi <goffi@goffi.org>
parents: 237
diff changeset
11 (at your option) any later version.
83d2bc0abf2a version, README, CHANGELOG and INSTALL updates
Goffi <goffi@goffi.org>
parents: 237
diff changeset
12
83d2bc0abf2a version, README, CHANGELOG and INSTALL updates
Goffi <goffi@goffi.org>
parents: 237
diff changeset
13 This program is distributed in the hope that it will be useful,
83d2bc0abf2a version, README, CHANGELOG and INSTALL updates
Goffi <goffi@goffi.org>
parents: 237
diff changeset
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
83d2bc0abf2a version, README, CHANGELOG and INSTALL updates
Goffi <goffi@goffi.org>
parents: 237
diff changeset
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
480
2a072735e459 Licence modification: the full project is now under AGPL v3+ instead of GPL v3+
Goffi <goffi@goffi.org>
parents: 473
diff changeset
16 GNU Affero General Public License for more details.
238
83d2bc0abf2a version, README, CHANGELOG and INSTALL updates
Goffi <goffi@goffi.org>
parents: 237
diff changeset
17
480
2a072735e459 Licence modification: the full project is now under AGPL v3+ instead of GPL v3+
Goffi <goffi@goffi.org>
parents: 473
diff changeset
18 You should have received a copy of the GNU Affero General Public License
238
83d2bc0abf2a version, README, CHANGELOG and INSTALL updates
Goffi <goffi@goffi.org>
parents: 237
diff changeset
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
83d2bc0abf2a version, README, CHANGELOG and INSTALL updates
Goffi <goffi@goffi.org>
parents: 237
diff changeset
20 """
83d2bc0abf2a version, README, CHANGELOG and INSTALL updates
Goffi <goffi@goffi.org>
parents: 237
diff changeset
21
230
b25cbec73c1e distutils: removes build and dist from manifest's prune
Goffi <goffi@goffi.org>
parents: 227
diff changeset
22 from distribute_setup import use_setuptools
b25cbec73c1e distutils: removes build and dist from manifest's prune
Goffi <goffi@goffi.org>
parents: 227
diff changeset
23 use_setuptools()
b25cbec73c1e distutils: removes build and dist from manifest's prune
Goffi <goffi@goffi.org>
parents: 227
diff changeset
24 from setuptools.command.install import install
b25cbec73c1e distutils: removes build and dist from manifest's prune
Goffi <goffi@goffi.org>
parents: 227
diff changeset
25 from setuptools import setup
225
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
26 from distutils.file_util import copy_file
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
27 import os,sys,subprocess
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
28 from stat import ST_MODE
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
29
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
30 NAME = 'sat'
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
31 LAUNCH_DAEMON_COMMAND = 'sat'
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
32
232
0cd5b3c4513f Distutils: added custom wokkel checking/building
Goffi <goffi@goffi.org>
parents: 230
diff changeset
33 class MercurialException(Exception):
0cd5b3c4513f Distutils: added custom wokkel checking/building
Goffi <goffi@goffi.org>
parents: 230
diff changeset
34 pass
225
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
35
235
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
36 def module_installed(module_name):
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
37 """Try to import muc from custom wokkel build
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
38 @param module_name: name of the module to test
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
39 @return: True if successful"""
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
40 try:
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
41 __import__(module_name)
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
42 except:
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
43 return False
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
44 return True
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
45
225
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
46 class custom_install(install):
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
47
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
48 def custom_auto_options(self):
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
49 """Change options for twistd in the shell script
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
50 Mainly change the paths"""
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
51 sh_buffer = ""
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
52 run_dir = os.path.dirname(self.sh_script_path)
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
53 with open(self.sh_script_path,'r') as sh_file:
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
54 for ori_line in sh_file:
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
55 if ori_line.startswith('DAEMON='):
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
56 dest_line = 'DAEMON=""\n' #we want to launch sat as a daemon
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
57 elif ori_line.startswith('TAP_PATH='):
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
58 dest_line = 'TAP_PATH="%s/"\n' % run_dir
473
a11cde0cdf5b misc: Make the shell launcher use the same python interpreter than setup.py.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 472
diff changeset
59 elif ori_line.startswith('PYTHON='):
a11cde0cdf5b misc: Make the shell launcher use the same python interpreter than setup.py.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 472
diff changeset
60 dest_line = 'PYTHON="%s"\n' % sys.executable
225
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
61 else:
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
62 dest_line = ori_line
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
63 sh_buffer += dest_line
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
64
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
65 with open(self.sh_script_path,'w') as sh_file:
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
66 sh_file.write(sh_buffer)
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
67
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
68
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
69 def custom_create_links(self):
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
70 """Create symbolic links to executables"""
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
71 #the script which launch the daemon
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
72 links = [(self.sh_script_path,LAUNCH_DAEMON_COMMAND),]
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
73 for source,dest in links:
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
74 dest_name, copied = copy_file(source, os.path.join(self.install_scripts, dest), link='sym')
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
75 assert (copied)
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
76 #we change the perm in the same way as in the original install_scripts
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
77 mode = ((os.stat(dest_name)[ST_MODE]) | 0555) & 07777
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
78 os.chmod(dest_name, mode)
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
79
232
0cd5b3c4513f Distutils: added custom wokkel checking/building
Goffi <goffi@goffi.org>
parents: 230
diff changeset
80
0cd5b3c4513f Distutils: added custom wokkel checking/building
Goffi <goffi@goffi.org>
parents: 230
diff changeset
81 def custom_wokkel_requirement(self):
0cd5b3c4513f Distutils: added custom wokkel checking/building
Goffi <goffi@goffi.org>
parents: 230
diff changeset
82 """Test if the custom wokkel is present, else get and build it"""
235
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
83 if not module_installed('wokkel.muc'):
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
84 sys.stdout.write ('Custom wokkel is not present, building it\n')
295
5e00f8123001 installation: fixed wokkel hack
Goffi <goffi@goffi.org>
parents: 294
diff changeset
85 sys.stdout.flush()
232
0cd5b3c4513f Distutils: added custom wokkel checking/building
Goffi <goffi@goffi.org>
parents: 230
diff changeset
86 import tempfile
0cd5b3c4513f Distutils: added custom wokkel checking/building
Goffi <goffi@goffi.org>
parents: 230
diff changeset
87 ori_path = os.getcwd()
0cd5b3c4513f Distutils: added custom wokkel checking/building
Goffi <goffi@goffi.org>
parents: 230
diff changeset
88 work_path = tempfile.mkdtemp()
0cd5b3c4513f Distutils: added custom wokkel checking/building
Goffi <goffi@goffi.org>
parents: 230
diff changeset
89 os.chdir(work_path)
235
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
90 hg_path = subprocess.Popen('which hg', stdout=subprocess.PIPE, shell=True).communicate()[0][:-1]
232
0cd5b3c4513f Distutils: added custom wokkel checking/building
Goffi <goffi@goffi.org>
parents: 230
diff changeset
91 #we are now in a temp dir, we can get the repositories
294
9821e3dde550 installation: wokkel hack now use specific revision to avoid merge conflict, and use the same options as for the parent setup.py
Goffi <goffi@goffi.org>
parents: 293
diff changeset
92 commands = ['%s clone http://hg.ik.nu/wokkel -r f9cd8ca1a62d' % hg_path, #XXX: we use specific revision to avoid merge conflict
232
0cd5b3c4513f Distutils: added custom wokkel checking/building
Goffi <goffi@goffi.org>
parents: 230
diff changeset
93 'cd wokkel',
294
9821e3dde550 installation: wokkel hack now use specific revision to avoid merge conflict, and use the same options as for the parent setup.py
Goffi <goffi@goffi.org>
parents: 293
diff changeset
94 '%s pull -f http://hg.ik.nu/ralphm/wokkel-muc-client-support-24-2 -r 1b19c49d30c2' % hg_path,
235
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
95 '%s merge wokkel-muc-client-support-24' % hg_path,
349
3ec237e82aed setup.py update:
Goffi <goffi@goffi.org>
parents: 335
diff changeset
96 '%s commit -u "SaT installation script" -m "Merged wokkel\'s MUC branch"' % hg_path,
295
5e00f8123001 installation: fixed wokkel hack
Goffi <goffi@goffi.org>
parents: 294
diff changeset
97 '%s setup.py %s' % (sys.executable, ' '.join(sys.argv[1:]))] #XXX: we use the same arguments as for this setup.py
232
0cd5b3c4513f Distutils: added custom wokkel checking/building
Goffi <goffi@goffi.org>
parents: 230
diff changeset
98 for command in commands:
233
6a37bc1b0b8c distutils: fixed custom wokkel building
Goffi <goffi@goffi.org>
parents: 232
diff changeset
99 if command.startswith('cd '):
6a37bc1b0b8c distutils: fixed custom wokkel building
Goffi <goffi@goffi.org>
parents: 232
diff changeset
100 os.chdir(command[3:])
6a37bc1b0b8c distutils: fixed custom wokkel building
Goffi <goffi@goffi.org>
parents: 232
diff changeset
101 else:
6a37bc1b0b8c distutils: fixed custom wokkel building
Goffi <goffi@goffi.org>
parents: 232
diff changeset
102 ret = subprocess.call(command, stdout=open('/dev/null', 'w'), shell=True)
6a37bc1b0b8c distutils: fixed custom wokkel building
Goffi <goffi@goffi.org>
parents: 232
diff changeset
103 if ret!=0:
6a37bc1b0b8c distutils: fixed custom wokkel building
Goffi <goffi@goffi.org>
parents: 232
diff changeset
104 os.chdir(ori_path)
235
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
105 sys.stderr.write ("ERROR while building/installing custom wokkel\n")
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
106 sys.stderr.write ('Error happened when executing [%s]\n' % command)
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
107 sys.stderr.write ('tmpdir is [%s]\n' % work_path)
233
6a37bc1b0b8c distutils: fixed custom wokkel building
Goffi <goffi@goffi.org>
parents: 232
diff changeset
108 raise MercurialException
232
0cd5b3c4513f Distutils: added custom wokkel checking/building
Goffi <goffi@goffi.org>
parents: 230
diff changeset
109 os.chdir(ori_path)
235
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
110 sys.stdout.write ("Custom wokkel builded and installed, removing temporary files\n")
232
0cd5b3c4513f Distutils: added custom wokkel checking/building
Goffi <goffi@goffi.org>
parents: 230
diff changeset
111 import shutil
0cd5b3c4513f Distutils: added custom wokkel checking/building
Goffi <goffi@goffi.org>
parents: 230
diff changeset
112 shutil.rmtree(work_path)
235
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
113 sys.stdout.write ("done\n")
232
0cd5b3c4513f Distutils: added custom wokkel checking/building
Goffi <goffi@goffi.org>
parents: 230
diff changeset
114 else:
235
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
115 sys.stdout.write ("Custom wokkel already installed\n")
232
0cd5b3c4513f Distutils: added custom wokkel checking/building
Goffi <goffi@goffi.org>
parents: 230
diff changeset
116
0cd5b3c4513f Distutils: added custom wokkel checking/building
Goffi <goffi@goffi.org>
parents: 230
diff changeset
117
225
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
118 def run(self):
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
119 install.run(self)
235
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
120 sys.stdout.write ('running post installation stuff\n')
349
3ec237e82aed setup.py update:
Goffi <goffi@goffi.org>
parents: 335
diff changeset
121 sys.stdout.flush()
225
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
122 self.sh_script_path = os.path.join(self.install_lib,'sat','sat.sh')
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
123 self.primitivus_path = os.path.join(self.install_lib,'sat_frontends','primitivus')
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
124 self.custom_auto_options()
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
125 self.custom_create_links()
232
0cd5b3c4513f Distutils: added custom wokkel checking/building
Goffi <goffi@goffi.org>
parents: 230
diff changeset
126 self.custom_wokkel_requirement()
225
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
127
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
128
235
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
129 def preinstall_check():
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
130 """Check presence of problematic dependencies, and try to install them with package manager
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
131 This ugly stuff is necessary as distributions are not installed correctly with setuptools/distribute
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
132 Hope to remove this at some point"""
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
133
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
134 #modules_tocheck=['twisted', 'twisted.words', 'twisted.web', 'wx', 'urwid']
237
aae816738314 distutils: added urwid-satext dependency, and gobject in preinstall_check
Goffi <goffi@goffi.org>
parents: 235
diff changeset
135 modules_tocheck=['wx','gobject'] #XXX: wx is the only one to be really difficult to install, python-gobject is not up-to-date in PyPi
235
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
136
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
137 package = {'twisted':'python-twisted-core',
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
138 'twisted.words':'python-twisted-words',
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
139 'twisted.web':'python-twisted-web',
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
140 'wx':'python-wxgtk2.8',
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
141 'urwid':'python-urwid',
237
aae816738314 distutils: added urwid-satext dependency, and gobject in preinstall_check
Goffi <goffi@goffi.org>
parents: 235
diff changeset
142 'gobject':'python-gobject',
235
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
143 'mercurial':'mercurial'} #this dict map dependencies to packages names for debian distributions
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
144
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
145 sys.stdout.write ("Running pre-installation dependencies check\n")
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
146
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
147 #which modules are not installed ?
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
148 modules_toinstall = filter(lambda mod:not module_installed(mod),modules_tocheck)
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
149 """#is mercurial available ?
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
150 hg_installed = subprocess.call('which hg', stdout=open('/dev/null', 'w'), shell=True) == 0
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
151 if not hg_installed:
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
152 modules_toinstall.append('mercurial')""" #hg can be installed from pypi
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
153
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
154 if modules_toinstall:
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
155 #are we on a distribution using apt ?
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
156 apt_path = subprocess.Popen('which apt-get', stdout=subprocess.PIPE, shell=True).communicate()[0][:-1]
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
157 not_installed=set()
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
158 if apt_path:
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
159 #we have apt, we'll try to use it
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
160 for module_name in modules_toinstall:
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
161 package_name = package[module_name]
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
162 sys.stdout.write ("Installing %s\n" % package_name)
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
163 success = subprocess.call('%s -qy install %s' % (apt_path,package_name), shell=True) == 0
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
164 if not success:
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
165 not_installed.add(module_name)
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
166 else:
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
167 not_installed=set(modules_toinstall)
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
168
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
169 if not_installed:
237
aae816738314 distutils: added urwid-satext dependency, and gobject in preinstall_check
Goffi <goffi@goffi.org>
parents: 235
diff changeset
170 #some packages can't be automatically installed, we print their name for manual installation
235
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
171 sys.stdout.write ("You should install the following dependencies with your distribution recommanded tool before installing %s:\n" % NAME)
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
172 for module_name in not_installed:
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
173 sys.stdout.write ("- %s (Debian name: %s)\n" % (module_name,package[module_name]))
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
174 sys.exit(2)
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
175
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
176
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
177 if sys.argv[1].lower() in ['egg_info','install']:
237
aae816738314 distutils: added urwid-satext dependency, and gobject in preinstall_check
Goffi <goffi@goffi.org>
parents: 235
diff changeset
178 #we only check dependencies if egg_info or install is used
349
3ec237e82aed setup.py update:
Goffi <goffi@goffi.org>
parents: 335
diff changeset
179 install_opt = os.environ.get("SAT_INSTALL","")
3ec237e82aed setup.py update:
Goffi <goffi@goffi.org>
parents: 335
diff changeset
180 if not "nopreinstall" in install_opt: #user can force preinstall skipping
3ec237e82aed setup.py update:
Goffi <goffi@goffi.org>
parents: 335
diff changeset
181 preinstall_check()
225
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
182
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
183 setup(name=NAME,
349
3ec237e82aed setup.py update:
Goffi <goffi@goffi.org>
parents: 335
diff changeset
184 version='0.2.0',
225
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
185 description=u'Salut à Toi multi-frontend XMPP client',
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
186 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. ',
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
187 author='Goffi (Jérôme Poisson)',
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
188 author_email='goffi@goffi.org',
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
189 url='http://wiki.goffi.org/wiki/Salut_%C3%A0_Toi',
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
190 classifiers=['Development Status :: 3 - Alpha',
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
191 'Environment :: Console',
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
192 'Environment :: X11 Applications :: GTK',
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
193 'Framework :: Twisted',
480
2a072735e459 Licence modification: the full project is now under AGPL v3+ instead of GPL v3+
Goffi <goffi@goffi.org>
parents: 473
diff changeset
194 'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
225
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
195 'Operating System :: POSIX :: Linux',
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
196 'Topic :: Communications :: Chat'],
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
197 package_dir = {'sat':'src', 'sat_frontends':'frontends/src'},
472
813a869315dc misc: Add the forgotten sat.memory to setup.py.
Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
parents: 373
diff changeset
198 packages=['sat','sat.tools','sat.bridge', 'sat.plugins', 'sat.test', 'sat.core', 'sat.memory',
225
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
199 'sat_frontends', 'sat_frontends.bridge', 'sat_frontends.quick_frontend',
227
533507bb4e32 distutils wix installation
Goffi <goffi@goffi.org>
parents: 225
diff changeset
200 'sat_frontends.primitivus', 'sat_frontends.wix'],
533507bb4e32 distutils wix installation
Goffi <goffi@goffi.org>
parents: 225
diff changeset
201 package_data = {'sat': ['sat.tac','sat.sh'],
373
a3aa4d046914 core: MANIFEST.in and setup.py cleaning
Goffi <goffi@goffi.org>
parents: 349
diff changeset
202 'sat_frontends': ['wix/COPYING']},
225
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
203 data_files=[(os.path.join(sys.prefix,'share/locale/fr/LC_MESSAGES'), ['i18n/fr/LC_MESSAGES/sat.mo']),
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
204 (os.path.join(sys.prefix,'share/locale/fr/LC_MESSAGES'), ['frontends/i18n/fr/LC_MESSAGES/sat_frontend.mo']),
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
205 (os.path.join(sys.prefix,'share/locale/fr/LC_MESSAGES'), ['frontends/src/jp/i18n/fr/LC_MESSAGES/jp.mo']),
227
533507bb4e32 distutils wix installation
Goffi <goffi@goffi.org>
parents: 225
diff changeset
206 ('share/doc/%s' % NAME, ['CHANGELOG', 'COPYING', 'INSTALL', 'README', 'README4TRANSLATORS']),
533507bb4e32 distutils wix installation
Goffi <goffi@goffi.org>
parents: 225
diff changeset
207 ],
533507bb4e32 distutils wix installation
Goffi <goffi@goffi.org>
parents: 225
diff changeset
208 scripts=['frontends/src/jp/jp', 'frontends/src/primitivus/primitivus', 'frontends/src/wix/wix'],
230
b25cbec73c1e distutils: removes build and dist from manifest's prune
Goffi <goffi@goffi.org>
parents: 227
diff changeset
209 zip_safe=False,
293
42438e43104a Plugin XEP-0277: first draft of microblogging over ip /!\ new dependencies added /!\
Goffi <goffi@goffi.org>
parents: 275
diff changeset
210 dependency_links = ['http://www.blarg.net/%7Esteveha/pyfeed-0.7.4.tar.gz','http://www.blarg.net/%7Esteveha/xe-0.7.4.tar.gz'],
42438e43104a Plugin XEP-0277: first draft of microblogging over ip /!\ new dependencies added /!\
Goffi <goffi@goffi.org>
parents: 275
diff changeset
211 install_requires=['twisted', 'progressbar', 'urwid', 'beautifulsoup', 'mercurial', 'urwid-satext','pyfeed','xe'],
225
fd9b7834d98a distutils installation script, draft
Goffi <goffi@goffi.org>
parents:
diff changeset
212 cmdclass=dict(install=custom_install),
296
Goffi <goffi@goffi.org>
parents: 295
diff changeset
213 ) #XXX: The Mercurial dependency is just here to build the custom wokkel (with MUC branch), it must be removed
373
a3aa4d046914 core: MANIFEST.in and setup.py cleaning
Goffi <goffi@goffi.org>
parents: 349
diff changeset
214 # and replaced by wokkel as soon as MUC branch is officially available in wokkel main branch.
235
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
215 # wxpython doesn't work, it's managed with preinstall_check
7a2ef5fe4e8d distutils: added preinstall_check hack + some tuning while testing
Goffi <goffi@goffi.org>
parents: 233
diff changeset
216