Mercurial > libervia-web
annotate setup.py @ 405:41b8b96f2248
browser_side: display new lines in microblogs (convert '\n' to '<br/>')
author | souliane <souliane@mailoo.org> |
---|---|
date | Sat, 15 Mar 2014 00:33:04 +0100 |
parents | f2c380af7304 |
children | a0256b81d367 |
rev | line source |
---|---|
360
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
1 #!/usr/bin/python |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
2 # -*- coding: utf-8 -*- |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
3 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
4 # Libervia: a Salut à Toi frontend |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
5 # Copyright (C) 2011, 2012, 2013, 2014 Jérôme Poisson <goffi@goffi.org> |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
6 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
7 # This program is free software: you can redistribute it and/or modify |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
8 # it under the terms of the GNU Affero General Public License as published by |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
9 # the Free Software Foundation, either version 3 of the License, or |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
10 # (at your option) any later version. |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
11 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
12 # This program is distributed in the hope that it will be useful, |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
15 # GNU Affero General Public License for more details. |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
16 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
17 # You should have received a copy of the GNU Affero General Public License |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
19 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
20 from distribute_setup import use_setuptools |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
21 use_setuptools() |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
22 from setuptools.command.install import install |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
23 from setuptools import setup |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
24 from distutils.file_util import copy_file |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
25 import os |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
26 import sys |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
27 import subprocess |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
28 from stat import ST_MODE |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
29 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
30 # seen here: http://stackoverflow.com/questions/7275295 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
31 try: |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
32 from setuptools.command import egg_info |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
33 egg_info.write_toplevel_names |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
34 except (ImportError, AttributeError): |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
35 pass |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
36 else: |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
37 def _top_level_package(name): |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
38 return name.split('.', 1)[0] |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
39 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
40 def _hacked_write_toplevel_names(cmd, basename, filename): |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
41 pkgs = dict.fromkeys( |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
42 [_top_level_package(k) |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
43 for k in cmd.distribution.iter_distribution_names() |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
44 if _top_level_package(k) != "twisted" |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
45 ] |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
46 ) |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
47 cmd.write_file("top-level names", filename, '\n'.join(pkgs) + '\n') |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
48 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
49 egg_info.write_toplevel_names = _hacked_write_toplevel_names |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
50 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
51 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
52 NAME = 'libervia' |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
53 LAUNCH_DAEMON_COMMAND = 'libervia' |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
54 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
55 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
56 class MercurialException(Exception): |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
57 pass |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
58 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
59 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
60 def module_installed(module_name): |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
61 """Try to import module_name, and return False if it failed |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
62 @param module_name: name of the module to test |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
63 @return: True if successful""" |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
64 try: |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
65 __import__(module_name) |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
66 except ImportError: |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
67 return False |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
68 return True |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
69 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
70 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
71 class CustomInstall(install): |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
72 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
73 def custom_auto_options(self): |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
74 """Change options for twistd in the shell script |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
75 Mainly change the paths""" |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
76 sh_buffer = "" |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
77 run_dir = os.path.dirname(self.sh_script_path) |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
78 with open(self.sh_script_path, 'r') as sh_file: |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
79 for ori_line in sh_file: |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
80 if ori_line.startswith('DAEMON='): |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
81 dest_line = 'DAEMON=""\n' # we want to launch sat as a daemon |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
82 elif ori_line.startswith('TAP_PATH='): |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
83 dest_line = 'TAP_PATH="%s/"\n' % run_dir |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
84 elif ori_line.startswith('PYTHON='): |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
85 dest_line = 'PYTHON="%s"\n' % sys.executable |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
86 else: |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
87 dest_line = ori_line |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
88 sh_buffer += dest_line |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
89 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
90 with open(self.sh_script_path, 'w') as sh_file: |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
91 sh_file.write(sh_buffer) |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
92 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
93 def custom_create_links(self): |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
94 """Create symbolic links to executables""" |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
95 # the script which launch the daemon |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
96 links = [(self.sh_script_path, LAUNCH_DAEMON_COMMAND)] |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
97 for source, dest in links: |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
98 dest_name, copied = copy_file(source, os.path.join(self.install_scripts, dest), link='sym') |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
99 assert (copied) |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
100 # we change the perm in the same way as in the original install_scripts |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
101 mode = ((os.stat(dest_name)[ST_MODE]) | 0555) & 07777 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
102 os.chmod(dest_name, mode) |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
103 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
104 def pyjs_build(self): |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
105 return subprocess.call('pyjsbuild libervia --no-compile-inplace -m -I %s' % self.install_lib, shell=True) |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
106 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
107 def run(self): |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
108 sys.stdout.write('running pre installation stuff\n') |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
109 sys.stdout.flush() |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
110 build_result = self.pyjs_build() |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
111 if build_result == 127: # TODO: remove magic string |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
112 print "pyjsbuild is not installed or not accessible from the PATH of user '%s'" % os.getenv('USERNAME') |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
113 return |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
114 if build_result != 0: |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
115 print "pyjsbuild failed to build libervia" |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
116 return |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
117 install.run(self) |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
118 sys.stdout.write('running post installation stuff\n') |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
119 sys.stdout.flush() |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
120 self.sh_script_path = os.path.join(self.install_lib, 'libervia_server', 'libervia.sh') |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
121 self.custom_auto_options() |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
122 self.custom_create_links() |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
123 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
124 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
125 def preinstall_check(): |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
126 """Check presence of problematic dependencies, and try to install them with package manager |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
127 This ugly stuff is necessary as distributions are not installed correctly with setuptools/distribute |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
128 Hope to remove this at some point""" |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
129 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
130 modules_tocheck = [] # if empty this method is dummy |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
131 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
132 package = {'twisted': 'python-twisted-core', |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
133 'twisted.words': 'python-twisted-words', |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
134 'twisted.web': 'python-twisted-web', |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
135 'mercurial': 'mercurial'} # this dict map dependencies to packages names for debian distributions |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
136 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
137 sys.stdout.write("Running pre-installation dependencies check\n") |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
138 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
139 # which modules are not installed ? |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
140 modules_toinstall = [mod for mod in modules_tocheck if not module_installed(mod)] |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
141 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
142 if modules_toinstall: |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
143 # are we on a distribution using apt ? |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
144 apt_path = subprocess.Popen('which apt-get', stdout=subprocess.PIPE, shell=True).communicate()[0][:-1] |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
145 not_installed = set() |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
146 if apt_path: |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
147 # we have apt, we'll try to use it |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
148 for module_name in modules_toinstall: |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
149 package_name = package[module_name] |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
150 sys.stdout.write("Installing %s\n" % package_name) |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
151 success = subprocess.call('%s -qy install %s' % (apt_path, package_name), shell=True) == 0 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
152 if not success: |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
153 not_installed.add(module_name) |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
154 else: |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
155 not_installed = set(modules_toinstall) |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
156 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
157 if not_installed: |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
158 # some packages can't be automatically installed, we print their name for manual installation |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
159 sys.stdout.write("You should install the following dependencies with your distribution recommanded tool before installing %s:\n" % NAME) |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
160 for module_name in not_installed: |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
161 sys.stdout.write("- %s (Debian name: %s)\n" % (module_name, package[module_name])) |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
162 sys.exit(2) |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
163 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
164 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
165 if sys.argv[1].lower() in ['egg_info', 'install']: |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
166 # we only check dependencies if egg_info or install is used |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
167 install_opt = os.environ.get("LIBERVIA_INSTALL", "") |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
168 if not "nopreinstall" in install_opt: # user can force preinstall skipping |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
169 preinstall_check() |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
170 |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
171 setup(name=NAME, |
385 | 172 version='0.4.0', |
360
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
173 description=u'Web frontend for Salut à Toi', |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
174 long_description=u'Libervia is a web frontend for Salut à Toi (SàT), a multi-frontends and multi-purposes XMPP client.', |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
175 author='Goffi (Jérôme Poisson)', |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
176 author_email='goffi@goffi.org', |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
177 url='http://sat.goffi.org', |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
178 classifiers=['Development Status :: 3 - Alpha', |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
179 'Environment :: Web Environment', |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
180 'Framework :: Twisted', |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
181 'Framework :: Pyjamas', |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
182 'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)', |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
183 'Operating System :: POSIX :: Linux', |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
184 'Topic :: Communications :: Chat'], |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
185 package_dir={'libervia': '.', 'libervia_server': 'libervia_server'}, |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
186 packages=['libervia', 'libervia.output', 'libervia_server', 'twisted.plugins'], |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
187 package_data={'libervia': ['libervia.py'], 'libervia.output': ['**/*.*'], 'libervia_server': ['libervia.sh']}, |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
188 data_files=[('share/doc/%s' % NAME, ['COPYING', 'README'])], |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
189 scripts=[], |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
190 zip_safe=False, |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
191 dependency_links=['http://www.blarg.net/%7Esteveha/pyfeed-0.7.4.tar.gz', 'http://www.blarg.net/%7Esteveha/xe-0.7.4.tar.gz'], |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
192 install_requires=['sat', 'twisted', 'pyfeed', 'xe', 'txjsonrpc', 'zope'], |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
193 cmdclass={'install': CustomInstall}, |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
194 ) |
9834136b15ed
added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff
changeset
|
195 |