annotate setup.py @ 1086:2566f17a0e59

server (setup): New setup.py compatible with archlinux PKGBUILD. This file use a new "arch" option in LIBERVIA_INSTALL environment variable (which is set when libervia is installed with PKGBUILD. This setup.py solves the following issues: - os.symlink(os.path.dirname(libervia.__file__), os.path.join(tmp_dir,"libervia")) fails with PKGBUILD because the module libervia is not accessible. - self.custom_create_links() fails with PKGBUILD because the permissions of bin directory is read-only.
author Arnaud Joset <info@agayon.be>
date Mon, 02 Apr 2018 10:39:55 +0200
parents 3bf61858a123
children 1f67b003c312
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
1 #!/usr/bin/env python2
360
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
818
f8a7a046ff9c copyright update
Goffi <goffi@goffi.org>
parents: 791
diff changeset
5 # Copyright (C) 2011-2016 Jérôme Poisson (goffi@goffi.org)
f8a7a046ff9c copyright update
Goffi <goffi@goffi.org>
parents: 791
diff changeset
6 # Copyright (C) 2013-2016 Adrien Cossa (souliane@mailoo.org)
360
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
7
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
8 # 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
9 # 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
10 # 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
11 # (at your option) any later version.
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
12
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
13 # 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
14 # 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
15 # 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
16 # GNU Affero General Public License for more details.
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
17
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
18 # 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
19 # 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
20
560
77bf2654ca0a installation: replaced the deprecated distribute_setup.py by ez_setup.py
Goffi <goffi@goffi.org>
parents: 551
diff changeset
21 from ez_setup import use_setuptools
360
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
22 use_setuptools()
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
23 from setuptools.command.install import install
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
24 from setuptools import setup
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
25 from distutils.file_util import copy_file
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
26 import os
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
27 import sys
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
28 import subprocess
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
29 from stat import ST_MODE
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
30 import shutil
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
31 from src.server.constants import Const as C
563
d888bb2a23a9 installation: pyjamas build fixes:
Goffi <goffi@goffi.org>
parents: 560
diff changeset
32 import tempfile
360
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
33
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
34 # seen here: http://stackoverflow.com/questions/7275295
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
35 try:
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
36 from setuptools.command import egg_info
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
37 egg_info.write_toplevel_names
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
38 except (ImportError, AttributeError):
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
39 pass
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
40 else:
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
41 def _top_level_package(name):
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
42 return name.split('.', 1)[0]
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
43
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
44 def _hacked_write_toplevel_names(cmd, basename, filename):
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
45 pkgs = dict.fromkeys(
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
46 [_top_level_package(k)
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
47 for k in cmd.distribution.iter_distribution_names()
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
48 if _top_level_package(k) != "twisted"
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
49 ]
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 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
52
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
53 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
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 NAME = 'libervia'
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
57 LAUNCH_DAEMON_COMMAND = 'libervia'
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
58
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
59 ENV_LIBERVIA_INSTALL = "LIBERVIA_INSTALL" # environment variable to customise installation
732
9596da27cd7c install: added jsdebug option to use debug mode with pyjsbuild, don't use it by default
Goffi <goffi@goffi.org>
parents: 715
diff changeset
60 JS_DEBUG = "jsdebug" # use debug mode with pyjsbuild
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
61 NO_PREINSTALL_OPT = 'nopreinstall' # skip all preinstallation checks
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
62 AUTO_DEB_OPT = 'autodeb' # automaticaly install debs
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
63 CLEAN_OPT = 'clean' # remove previous installation directories
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
64 PURGE_OPT = 'purge' # remove building and previous installation directories
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
65
360
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
66
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
67 class MercurialException(Exception):
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
68 pass
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 def module_installed(module_name):
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
72 """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
73 @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
74 @return: True if successful"""
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
75 try:
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
76 __import__(module_name)
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
77 except ImportError:
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
78 return False
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
79 return True
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
80
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
81
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
82 class CustomInstall(install):
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
83
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
84 def custom_auto_options(self):
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
85 """Change options for twistd in the shell script
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
86 Mainly change the paths"""
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
87 sh_buffer = ""
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
88 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
89 for ori_line in sh_file:
513
ecec2cc13b33 installation: setup.py update:
Goffi <goffi@goffi.org>
parents: 501
diff changeset
90 if ori_line.startswith('PLUGIN_OPTIONS='):
ecec2cc13b33 installation: setup.py update:
Goffi <goffi@goffi.org>
parents: 501
diff changeset
91 dest_line = 'PLUGIN_OPTIONS="-d %s"\n' % self.install_data_dir
360
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
92 elif ori_line.startswith('PYTHON='):
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
93 dest_line = 'PYTHON="%s"\n' % sys.executable
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
94 else:
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
95 dest_line = ori_line
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
96 sh_buffer += dest_line
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
97
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
98 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
99 sh_file.write(sh_buffer)
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
100
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
101 def custom_create_links(self):
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
102 """Create symbolic links to executables"""
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
103 # the script which launch the daemon
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
104 for source, dest in self.sh_script_links:
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
105 if os.path.islink(dest) and os.readlink(dest) != source:
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
106 os.remove(dest) # copy_file doesn't force the link update
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
107 dest_name, copied = copy_file(source, dest, link='sym')
360
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
108 assert (copied)
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
109 # 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
110 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
111 os.chmod(dest_name, mode)
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
112
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
113 def pyjs_build(self):
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
114 """Build the browser side JS files from Python source."""
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
115 cwd = os.getcwd()
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
116 os.chdir(os.path.join('src', 'browser'))
563
d888bb2a23a9 installation: pyjamas build fixes:
Goffi <goffi@goffi.org>
parents: 560
diff changeset
117 # we must have only certain package in the path, so we create a tmp dir to link only what we need
d888bb2a23a9 installation: pyjamas build fixes:
Goffi <goffi@goffi.org>
parents: 560
diff changeset
118 tmp_dir = tempfile.mkdtemp()
1086
2566f17a0e59 server (setup): New setup.py compatible with archlinux PKGBUILD.
Arnaud Joset <info@agayon.be>
parents: 997
diff changeset
119 import sat, sat_frontends
563
d888bb2a23a9 installation: pyjamas build fixes:
Goffi <goffi@goffi.org>
parents: 560
diff changeset
120 os.symlink(os.path.dirname(sat.__file__), os.path.join(tmp_dir,"sat")) # FIXME: only work on unixes
d888bb2a23a9 installation: pyjamas build fixes:
Goffi <goffi@goffi.org>
parents: 560
diff changeset
121 os.symlink(os.path.dirname(sat_frontends.__file__), os.path.join(tmp_dir,"sat_frontends")) # FIXME: only work on unixes
1086
2566f17a0e59 server (setup): New setup.py compatible with archlinux PKGBUILD.
Arnaud Joset <info@agayon.be>
parents: 997
diff changeset
122 libervia_files = os.path.abspath("../../src")
2566f17a0e59 server (setup): New setup.py compatible with archlinux PKGBUILD.
Arnaud Joset <info@agayon.be>
parents: 997
diff changeset
123 os.symlink(libervia_files, os.path.join(tmp_dir,"libervia")) # FIXME: only work on unixes
602
be3fd3874c3a add very basic test system accessible from <root_url>/test, to be improved:
souliane <souliane@mailoo.org>
parents: 584
diff changeset
124 for module in ('libervia_main', 'libervia_test'):
732
9596da27cd7c install: added jsdebug option to use debug mode with pyjsbuild, don't use it by default
Goffi <goffi@goffi.org>
parents: 715
diff changeset
125 build_args = ['pyjsbuild', module] + (['-d'] if JS_DEBUG in install_opt else []) + ['--no-compile-inplace', '-I', tmp_dir, '-o', self.pyjamas_output_dir]
9596da27cd7c install: added jsdebug option to use debug mode with pyjsbuild, don't use it by default
Goffi <goffi@goffi.org>
parents: 715
diff changeset
126 result = subprocess.call(build_args)
602
be3fd3874c3a add very basic test system accessible from <root_url>/test, to be improved:
souliane <souliane@mailoo.org>
parents: 584
diff changeset
127 if result != 0:
be3fd3874c3a add very basic test system accessible from <root_url>/test, to be improved:
souliane <souliane@mailoo.org>
parents: 584
diff changeset
128 continue
563
d888bb2a23a9 installation: pyjamas build fixes:
Goffi <goffi@goffi.org>
parents: 560
diff changeset
129 shutil.rmtree(tmp_dir)
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
130 os.chdir(cwd)
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
131 return result
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
132
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
133 def copy_data_files(self):
513
ecec2cc13b33 installation: setup.py update:
Goffi <goffi@goffi.org>
parents: 501
diff changeset
134 # XXX: To copy the JS files couldn't be done with the data_files parameter
ecec2cc13b33 installation: setup.py update:
Goffi <goffi@goffi.org>
parents: 501
diff changeset
135 # of setuptools.setup because all the files to be copied must exist before
ecec2cc13b33 installation: setup.py update:
Goffi <goffi@goffi.org>
parents: 501
diff changeset
136 # the call. Also, we need the value of self.install_lib to build the JS
ecec2cc13b33 installation: setup.py update:
Goffi <goffi@goffi.org>
parents: 501
diff changeset
137 # files (it's not easily predictable as it may vary from one system to
ecec2cc13b33 installation: setup.py update:
Goffi <goffi@goffi.org>
parents: 501
diff changeset
138 # another), so we can't call pyjsbuild before setuptools.setup.
ecec2cc13b33 installation: setup.py update:
Goffi <goffi@goffi.org>
parents: 501
diff changeset
139
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
140 html = os.path.join(self.install_data_dir, C.HTML_DIR)
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
141 if os.path.isdir(html):
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
142 shutil.rmtree(html, ignore_errors=True)
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
143 shutil.copytree(self.pyjamas_output_dir, html)
360
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
144
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
145 def run(self):
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
146 self.sh_script_path = os.path.join(self.install_lib, NAME, 'libervia.sh')
493
636b6c477a87 setup: tiny factorisation
souliane <souliane@mailoo.org>
parents: 451
diff changeset
147 self.sh_script_links = [(self.sh_script_path, os.path.join(self.install_scripts, LAUNCH_DAEMON_COMMAND))]
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
148 self.install_data_dir = os.path.join(self.install_data, 'share', NAME)
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
149 self.pyjamas_output_dir = os.path.join(os.getcwd(), 'html')
360
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
150 sys.stdout.write('running pre installation stuff\n')
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
151 sys.stdout.flush()
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
152 if PURGE_OPT in install_opt:
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
153 self.purge()
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
154 elif CLEAN_OPT in install_opt:
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
155 self.clean()
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
156 install.run(self)
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
157 sys.stdout.write('running post installation stuff\n')
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
158 sys.stdout.flush()
905
09b0a968a36a installation (setup): fixed OSError when pyjsbuild is not found
Goffi <goffi@goffi.org>
parents: 903
diff changeset
159 try:
09b0a968a36a installation (setup): fixed OSError when pyjsbuild is not found
Goffi <goffi@goffi.org>
parents: 903
diff changeset
160 build_result = self.pyjs_build() # build after libervia.common is accessible
09b0a968a36a installation (setup): fixed OSError when pyjsbuild is not found
Goffi <goffi@goffi.org>
parents: 903
diff changeset
161 except OSError as e:
09b0a968a36a installation (setup): fixed OSError when pyjsbuild is not found
Goffi <goffi@goffi.org>
parents: 903
diff changeset
162 print "can't run pyjsbuild, are you sure pyjamas is installed?\nexception: {}".format(e)
09b0a968a36a installation (setup): fixed OSError when pyjsbuild is not found
Goffi <goffi@goffi.org>
parents: 903
diff changeset
163 return
09b0a968a36a installation (setup): fixed OSError when pyjsbuild is not found
Goffi <goffi@goffi.org>
parents: 903
diff changeset
164 if build_result == 127: # TODO: remove magic string # FIXME: seems useless as an OSError is raised if pyjsbuild is not accessible
360
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
165 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
166 return
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
167 if build_result != 0:
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
168 print "pyjsbuild failed to build libervia"
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
169 return
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
170 self.copy_data_files()
360
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
171 self.custom_auto_options()
1086
2566f17a0e59 server (setup): New setup.py compatible with archlinux PKGBUILD.
Arnaud Joset <info@agayon.be>
parents: 997
diff changeset
172 if not "arch" in install_opt:
2566f17a0e59 server (setup): New setup.py compatible with archlinux PKGBUILD.
Arnaud Joset <info@agayon.be>
parents: 997
diff changeset
173 self.custom_create_links()
360
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
174
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
175 def confirm(self, message):
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
176 """Ask the user for a confirmation"""
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
177 message += 'Proceed'
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
178 while True:
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
179 res = raw_input("%s (y/n)? " % message)
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
180 if res not in ['y', 'Y', 'n', 'N']:
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
181 print "Your response ('%s') was not one of the expected responses: y, n" % res
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
182 message = 'Proceed'
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
183 continue
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
184 if res in ('y', 'Y'):
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
185 return True
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
186 return False
360
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
187
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
188 def clean(self, message=None, to_remove=None):
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
189 """Clean previous installation directories
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
190
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
191 @param message (str): to use a non-default confirmation message
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
192 @param to_remove (str): extra files/directories to remove
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
193 """
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
194 if message is None:
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
195 message = "Cleaning previous installation directories"
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
196 if to_remove is None:
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
197 to_remove = []
501
b483f1c88b7c setup: cleaning also handles egg filenames not containing the python version
souliane <souliane@mailoo.org>
parents: 493
diff changeset
198 for path in [os.path.join(self.install_lib, NAME),
b483f1c88b7c setup: cleaning also handles egg filenames not containing the python version
souliane <souliane@mailoo.org>
parents: 493
diff changeset
199 self.install_data_dir,
b483f1c88b7c setup: cleaning also handles egg filenames not containing the python version
souliane <souliane@mailoo.org>
parents: 493
diff changeset
200 os.path.join(self.install_data, 'share', 'doc', NAME),
b483f1c88b7c setup: cleaning also handles egg filenames not containing the python version
souliane <souliane@mailoo.org>
parents: 493
diff changeset
201 os.path.join(self.install_lib, "%s.egg-info" % self.config_vars['dist_fullname']),
b483f1c88b7c setup: cleaning also handles egg filenames not containing the python version
souliane <souliane@mailoo.org>
parents: 493
diff changeset
202 os.path.join(self.install_lib, "%s-py%s.egg-info" % (self.config_vars['dist_fullname'], self.config_vars['py_version_short'])),
b483f1c88b7c setup: cleaning also handles egg filenames not containing the python version
souliane <souliane@mailoo.org>
parents: 493
diff changeset
203 ]:
b483f1c88b7c setup: cleaning also handles egg filenames not containing the python version
souliane <souliane@mailoo.org>
parents: 493
diff changeset
204 if os.path.isdir(path):
b483f1c88b7c setup: cleaning also handles egg filenames not containing the python version
souliane <souliane@mailoo.org>
parents: 493
diff changeset
205 to_remove.append(path)
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
206 for source, dest in self.sh_script_links:
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
207 if os.path.islink(dest):
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
208 to_remove.append(dest)
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
209 plugin_file = os.path.join(self.install_lib, 'twisted', 'plugins', NAME)
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
210 if os.path.isfile(plugin_file):
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
211 to_remove.append(plugin_file)
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
212
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
213 message = "%s:\n%s\n" % (message, "\n".join([" %s" % path for path in to_remove]))
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
214 if not self.confirm(message):
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
215 return
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
216 sys.stdout.write('cleaning previous installation directories...\n')
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
217 sys.stdout.flush()
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
218 for path in to_remove:
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
219 if os.path.isdir(path):
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
220 shutil.rmtree(path, ignore_errors=True)
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
221 else:
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
222 os.remove(path)
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
223
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
224 def purge(self):
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
225 """Clean building and previous installation directories"""
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
226 message = "Cleaning building and previous installation directories"
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
227 to_remove = [os.path.join(os.getcwd(), 'build'), self.pyjamas_output_dir]
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
228 self.clean(message, to_remove)
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
229
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
230
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
231 def preinstall_check(install_opt):
360
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
232 """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
233 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
234 Hope to remove this at some point"""
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
235
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
236 modules_tocheck = [] # if empty this method is dummy
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
237
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
238 package = {'twisted': 'python-twisted-core',
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
239 'twisted.words': 'python-twisted-words',
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
240 'twisted.web': 'python-twisted-web',
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
241 '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
242
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
243 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
244
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
245 # which modules are not installed ?
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
246 modules_toinstall = [mod for mod in modules_tocheck if not module_installed(mod)]
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
247 """# is mercurial available ?
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
248 hg_installed = subprocess.call('which hg', stdout=open('/dev/null', 'w'), shell=True) == 0
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
249 if not hg_installed:
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
250 modules_toinstall.append('mercurial')""" # hg can be installed from pypi
360
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
251
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
252 if modules_toinstall:
451
1a0cec9b0f1e better PEP-8 compliance
souliane <souliane@mailoo.org>
parents: 449
diff changeset
253 if AUTO_DEB_OPT in install_opt: # auto debian installation is requested
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
254 # are we on a distribution using apt ?
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
255 apt_path = subprocess.Popen('which apt-get', stdout=subprocess.PIPE, shell=True).communicate()[0][:-1]
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
256 else:
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
257 apt_path = None
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
258
360
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
259 not_installed = set()
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
260 if apt_path:
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
261 # 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
262 for module_name in modules_toinstall:
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
263 package_name = package[module_name]
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
264 sys.stdout.write("Installing %s\n" % package_name)
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
265 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
266 if not success:
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
267 not_installed.add(module_name)
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
268 else:
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
269 not_installed = set(modules_toinstall)
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
270
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
271 if not_installed:
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
272 # 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
273 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
274 for module_name in not_installed:
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
275 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
276 sys.exit(2)
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
277
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
278
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
279 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
280 # we only check dependencies if egg_info or install is used
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
281 install_opt = os.environ.get(ENV_LIBERVIA_INSTALL, "").split()
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
282 if not NO_PREINSTALL_OPT in install_opt: # user can force preinstall skipping
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
283 preinstall_check(install_opt)
360
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
284
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
285 setup(name=NAME,
907
3d372805f60c installation (setup.py): changed version to 0.6.1.1 so new archive with fixed MANIFEST can be uploaded on pypi
Goffi <goffi@goffi.org>
parents: 905
diff changeset
286 version='0.6.1.1',
360
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
287 description=u'Web frontend for Salut à Toi',
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
288 long_description=u'Libervia is a web frontend for Salut à Toi (SàT), a multi-frontends and multi-purposes XMPP client.',
513
ecec2cc13b33 installation: setup.py update:
Goffi <goffi@goffi.org>
parents: 501
diff changeset
289 author='Association « Salut à Toi »',
ecec2cc13b33 installation: setup.py update:
Goffi <goffi@goffi.org>
parents: 501
diff changeset
290 author_email='contact@goffi.org',
411
a0256b81d367 setup.py: update website (it's not http://www.salut-a-toi.org), and removed pyjamas framework which is not standard in pypi
Goffi <goffi@goffi.org>
parents: 385
diff changeset
291 url='http://www.salut-a-toi.org',
360
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
292 classifiers=['Development Status :: 3 - Alpha',
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
293 'Environment :: Web Environment',
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
294 'Framework :: Twisted',
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
295 '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
296 'Operating System :: POSIX :: Linux',
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
297 'Topic :: Communications :: Chat'],
449
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
298 package_dir={'libervia': 'src', 'twisted.plugins': 'src/twisted/plugins'},
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
299 packages=['libervia', 'libervia.common', 'libervia.server', 'twisted.plugins'],
981ed669d3b3 /!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents: 447
diff changeset
300 package_data={'libervia': ['libervia.sh']},
703
1a19ee7d8d8a server_side: add default theme
souliane <souliane@mailoo.org>
parents: 685
diff changeset
301 data_files=[(os.path.join('share', 'doc', NAME), ['COPYING', 'README', 'INSTALL']), ] +
1a19ee7d8d8a server_side: add default theme
souliane <souliane@mailoo.org>
parents: 685
diff changeset
302 [(os.path.join('share', NAME, root),
1a19ee7d8d8a server_side: add default theme
souliane <souliane@mailoo.org>
parents: 685
diff changeset
303 [os.path.join(root, f) for f in files])
1a19ee7d8d8a server_side: add default theme
souliane <souliane@mailoo.org>
parents: 685
diff changeset
304 for root, dirs, files in os.walk(C.THEMES_DIR)],
360
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
305 scripts=[],
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
306 zip_safe=False,
997
3bf61858a123 misc (setup.py): set minimum jinja2 version to 2.9
Goffi <goffi@goffi.org>
parents: 995
diff changeset
307 install_requires=['sat', 'twisted', 'txJSON-RPC==0.3.1', 'zope.interface', 'pyopenssl', 'jinja2>=2.9', 'shortuuid', 'autobahn'],
360
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
308 cmdclass={'install': CustomInstall},
9834136b15ed added setup.py for the installation with setuptools
souliane <souliane@mailoo.org>
parents:
diff changeset
309 )