Show More
@@ -1,36 +1,36 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | |
|
3 | 3 | """ |
|
4 | 4 | Kallithea wrapper of Celery |
|
5 | 5 | |
|
6 | 6 | The Celery configuration is in the normal Pylons ini file. We thus have to set |
|
7 | 7 | the `CELERY_LOADER` environment variable to point at a custom "loader" that can |
|
8 | 8 | read it. That environment variable must be set *before* importing celery. To |
|
9 | 9 | ensure that, we wrap celery in this module. |
|
10 | 10 | |
|
11 | 11 | Also, the loader depends on Pylons being configured to it can read the Celery |
|
12 | 12 | configuration out of it. To make sure that really is the case and give an early |
|
13 | 13 | warning, we check one of the mandatory settings. |
|
14 | 14 | |
|
15 | 15 | This module must thus not be imported in global scope but must be imported on |
|
16 | 16 | demand in function scope. |
|
17 | 17 | """ |
|
18 | 18 | |
|
19 | 19 | import os |
|
20 | 20 | import warnings |
|
21 | 21 | |
|
22 | 22 | # Verify Pylons configuration has been loaded |
|
23 | 23 | from pylons import config |
|
24 | 24 | assert config['celery.imports'] == 'kallithea.lib.celerylib.tasks', 'Kallithea Celery configuration has not been loaded' |
|
25 | 25 | |
|
26 | 26 | # Prepare environment to point at Kallithea Pylons loader |
|
27 | 27 | CELERYPYLONS_LOADER = 'kallithea.lib.celerypylons.loader.PylonsLoader' |
|
28 | 28 | if os.environ.get('CELERY_LOADER', CELERYPYLONS_LOADER) != CELERYPYLONS_LOADER: |
|
29 | 29 | warnings.warn("'CELERY_LOADER' environment variable will be overridden by celery-pylons.") |
|
30 | 30 | os.environ['CELERY_LOADER'] = CELERYPYLONS_LOADER |
|
31 | 31 | |
|
32 | 32 | # Import (and expose) celery, thus immediately triggering use of the custom Pylons loader |
|
33 | 33 | import celery.app as app |
|
34 | 34 | import celery.result as result |
|
35 | 35 | from celery.task import task |
|
36 |
from celery.bin import |
|
|
36 | from celery.bin import worker |
@@ -1,46 +1,46 b'' | |||
|
1 | 1 | # -*- coding: utf-8 -*- |
|
2 | 2 | |
|
3 | 3 | import kallithea |
|
4 | 4 | from kallithea.lib.paster_commands.common import BasePasterCommand |
|
5 | 5 | from kallithea.lib.utils import load_rcextensions |
|
6 | 6 | from kallithea.lib.utils2 import str2bool |
|
7 | 7 | |
|
8 | 8 | __all__ = ['Command'] |
|
9 | 9 | |
|
10 | 10 | |
|
11 | 11 | class Command(BasePasterCommand): |
|
12 | 12 | """Start the celery worker |
|
13 | 13 | |
|
14 | 14 | Starts the celery worker that uses a paste.deploy configuration |
|
15 | 15 | file. |
|
16 | 16 | """ |
|
17 | 17 | |
|
18 | 18 | usage = 'CONFIG_FILE [celeryd options...]' |
|
19 | 19 | summary = __doc__.splitlines()[0] |
|
20 | 20 | description = "".join(__doc__.splitlines()[2:]) |
|
21 | 21 | group_name = "Kallithea" |
|
22 | 22 | |
|
23 | 23 | parser = BasePasterCommand.standard_parser(quiet=True) |
|
24 | 24 | |
|
25 | 25 | def update_parser(self): |
|
26 | 26 | from kallithea.lib import celerypylons |
|
27 |
cmd = celerypylons. |
|
|
27 | cmd = celerypylons.worker.worker(celerypylons.app.app_or_default()) | |
|
28 | 28 | for x in cmd.get_options(): |
|
29 | 29 | self.parser.add_option(x) |
|
30 | 30 | |
|
31 | 31 | def command(self): |
|
32 | 32 | from kallithea.lib import celerypylons |
|
33 | 33 | from pylons import config |
|
34 | 34 | try: |
|
35 | 35 | CELERY_ON = str2bool(config['app_conf'].get('use_celery')) |
|
36 | 36 | except KeyError: |
|
37 | 37 | CELERY_ON = False |
|
38 | 38 | |
|
39 | 39 | if not CELERY_ON: |
|
40 | 40 | raise Exception('Please set use_celery = true in .ini config ' |
|
41 | 41 | 'file before running celeryd') |
|
42 | 42 | kallithea.CELERY_ON = CELERY_ON |
|
43 | 43 | |
|
44 | 44 | load_rcextensions(config['here']) |
|
45 |
cmd = celerypylons. |
|
|
45 | cmd = celerypylons.worker.worker(celerypylons.app.app_or_default()) | |
|
46 | 46 | return cmd.run(**vars(self.options)) |
@@ -1,172 +1,172 b'' | |||
|
1 | 1 | #!/usr/bin/env python2 |
|
2 | 2 | # -*- coding: utf-8 -*- |
|
3 | 3 | import os |
|
4 | 4 | import sys |
|
5 | 5 | import platform |
|
6 | 6 | |
|
7 | 7 | if sys.version_info < (2, 6) or sys.version_info >= (3,): |
|
8 | 8 | raise Exception('Kallithea requires python 2.6 or 2.7') |
|
9 | 9 | |
|
10 | 10 | |
|
11 | 11 | here = os.path.abspath(os.path.dirname(__file__)) |
|
12 | 12 | |
|
13 | 13 | |
|
14 | 14 | def _get_meta_var(name, data, callback_handler=None): |
|
15 | 15 | import re |
|
16 | 16 | matches = re.compile(r'(?:%s)\s*=\s*(.*)' % name).search(data) |
|
17 | 17 | if matches: |
|
18 | 18 | if not callable(callback_handler): |
|
19 | 19 | callback_handler = lambda v: v |
|
20 | 20 | |
|
21 | 21 | return callback_handler(eval(matches.groups()[0])) |
|
22 | 22 | |
|
23 | 23 | _meta = open(os.path.join(here, 'kallithea', '__init__.py'), 'rb') |
|
24 | 24 | _metadata = _meta.read() |
|
25 | 25 | _meta.close() |
|
26 | 26 | |
|
27 | 27 | callback = lambda V: ('.'.join(map(str, V[:3])) + '.'.join(V[3:])) |
|
28 | 28 | __version__ = _get_meta_var('VERSION', _metadata, callback) |
|
29 | 29 | __license__ = _get_meta_var('__license__', _metadata) |
|
30 | 30 | __author__ = _get_meta_var('__author__', _metadata) |
|
31 | 31 | __url__ = _get_meta_var('__url__', _metadata) |
|
32 | 32 | # defines current platform |
|
33 | 33 | __platform__ = platform.system() |
|
34 | 34 | |
|
35 | 35 | is_windows = __platform__ in ['Windows'] |
|
36 | 36 | |
|
37 | 37 | requirements = [ |
|
38 | 38 | "alembic>=0.8.0,<0.9", |
|
39 | 39 | "waitress>=0.8.8,<1.0", |
|
40 | 40 | "webob>=1.0.8,<=1.1.1", |
|
41 | 41 | "Pylons>=1.0.0,<=1.0.2", |
|
42 | 42 | "WebTest<2.0", # make the Pylons dependency pick a version that supports our WebOb version |
|
43 | 43 | "Beaker==1.6.4", |
|
44 | 44 | "WebHelpers==1.3", |
|
45 | 45 | "formencode>=1.2.4,<=1.2.6", |
|
46 | 46 | "SQLAlchemy>=1.0,<1.1", |
|
47 | 47 | "Mako>=0.9.0,<=1.0.0", |
|
48 | 48 | "pygments>=1.5", |
|
49 | 49 | "whoosh>=2.4.0,<=2.5.7", |
|
50 |
"celery>= |
|
|
50 | "celery>=3.1,<3.2", | |
|
51 | 51 | "babel>=0.9.6,<=1.3", |
|
52 | 52 | "python-dateutil>=1.5.0,<2.0.0", |
|
53 | 53 | "markdown==2.2.1", |
|
54 | 54 | "docutils>=0.8.1,<=0.11", |
|
55 | 55 | "URLObject==2.3.4", |
|
56 | 56 | "Routes==1.13", |
|
57 | 57 | "dulwich>=0.14.1", |
|
58 | 58 | "mercurial>=2.9,<4.0", |
|
59 | 59 | ] |
|
60 | 60 | |
|
61 | 61 | if sys.version_info < (2, 7): |
|
62 | 62 | requirements.append("importlib==1.0.1") |
|
63 | 63 | requirements.append("argparse") |
|
64 | 64 | |
|
65 | 65 | if not is_windows: |
|
66 | 66 | requirements.append("bcrypt>=2.0.0") |
|
67 | 67 | |
|
68 | 68 | dependency_links = [ |
|
69 | 69 | ] |
|
70 | 70 | |
|
71 | 71 | classifiers = [ |
|
72 | 72 | 'Development Status :: 4 - Beta', |
|
73 | 73 | 'Environment :: Web Environment', |
|
74 | 74 | 'Framework :: Pylons', |
|
75 | 75 | 'Intended Audience :: Developers', |
|
76 | 76 | 'License :: OSI Approved :: GNU General Public License (GPL)', |
|
77 | 77 | 'Operating System :: OS Independent', |
|
78 | 78 | 'Programming Language :: Python', |
|
79 | 79 | 'Programming Language :: Python :: 2.6', |
|
80 | 80 | 'Programming Language :: Python :: 2.7', |
|
81 | 81 | 'Topic :: Software Development :: Version Control', |
|
82 | 82 | ] |
|
83 | 83 | |
|
84 | 84 | |
|
85 | 85 | # additional files from project that goes somewhere in the filesystem |
|
86 | 86 | # relative to sys.prefix |
|
87 | 87 | data_files = [] |
|
88 | 88 | |
|
89 | 89 | description = ('Kallithea is a fast and powerful management tool ' |
|
90 | 90 | 'for Mercurial and Git with a built in push/pull server, ' |
|
91 | 91 | 'full text search and code-review.') |
|
92 | 92 | |
|
93 | 93 | keywords = ' '.join([ |
|
94 | 94 | 'kallithea', 'mercurial', 'git', 'code review', |
|
95 | 95 | 'repo groups', 'ldap', 'repository management', 'hgweb replacement', |
|
96 | 96 | 'hgwebdir', 'gitweb replacement', 'serving hgweb', |
|
97 | 97 | ]) |
|
98 | 98 | |
|
99 | 99 | # long description |
|
100 | 100 | README_FILE = 'README.rst' |
|
101 | 101 | try: |
|
102 | 102 | long_description = open(README_FILE).read() |
|
103 | 103 | except IOError as err: |
|
104 | 104 | sys.stderr.write( |
|
105 | 105 | "[WARNING] Cannot find file specified as long_description (%s)\n" |
|
106 | 106 | % README_FILE |
|
107 | 107 | ) |
|
108 | 108 | long_description = description |
|
109 | 109 | |
|
110 | 110 | import setuptools |
|
111 | 111 | |
|
112 | 112 | # monkey patch setuptools to use distutils owner/group functionality |
|
113 | 113 | from setuptools.command import sdist |
|
114 | 114 | sdist_org = sdist.sdist |
|
115 | 115 | class sdist_new(sdist_org): |
|
116 | 116 | def initialize_options(self): |
|
117 | 117 | sdist_org.initialize_options(self) |
|
118 | 118 | self.owner = self.group = 'root' |
|
119 | 119 | sdist.sdist = sdist_new |
|
120 | 120 | |
|
121 | 121 | packages = setuptools.find_packages(exclude=['ez_setup']) |
|
122 | 122 | |
|
123 | 123 | setuptools.setup( |
|
124 | 124 | name='Kallithea', |
|
125 | 125 | version=__version__, |
|
126 | 126 | description=description, |
|
127 | 127 | long_description=long_description, |
|
128 | 128 | keywords=keywords, |
|
129 | 129 | license=__license__, |
|
130 | 130 | author=__author__, |
|
131 | 131 | author_email='kallithea@sfconservancy.org', |
|
132 | 132 | dependency_links=dependency_links, |
|
133 | 133 | url=__url__, |
|
134 | 134 | install_requires=requirements, |
|
135 | 135 | classifiers=classifiers, |
|
136 | 136 | setup_requires=['PasteScript>=1.6.3'], |
|
137 | 137 | data_files=data_files, |
|
138 | 138 | packages=packages, |
|
139 | 139 | include_package_data=True, |
|
140 | 140 | message_extractors={'kallithea': [ |
|
141 | 141 | ('**.py', 'python', None), |
|
142 | 142 | ('templates/**.mako', 'mako', {'input_encoding': 'utf-8'}), |
|
143 | 143 | ('templates/**.html', 'mako', {'input_encoding': 'utf-8'}), |
|
144 | 144 | ('public/**', 'ignore', None)]}, |
|
145 | 145 | zip_safe=False, |
|
146 | 146 | paster_plugins=['PasteScript', 'Pylons'], |
|
147 | 147 | entry_points=""" |
|
148 | 148 | [console_scripts] |
|
149 | 149 | kallithea-api = kallithea.bin.kallithea_api:main |
|
150 | 150 | kallithea-gist = kallithea.bin.kallithea_gist:main |
|
151 | 151 | kallithea-config = kallithea.bin.kallithea_config:main |
|
152 | 152 | |
|
153 | 153 | [paste.app_factory] |
|
154 | 154 | main = kallithea.config.middleware:make_app |
|
155 | 155 | |
|
156 | 156 | [paste.app_install] |
|
157 | 157 | main = pylons.util:PylonsInstaller |
|
158 | 158 | |
|
159 | 159 | [paste.global_paster_command] |
|
160 | 160 | setup-db=kallithea.lib.paster_commands.setup_db:Command |
|
161 | 161 | cleanup-repos=kallithea.lib.paster_commands.cleanup:Command |
|
162 | 162 | update-repoinfo=kallithea.lib.paster_commands.update_repoinfo:Command |
|
163 | 163 | make-rcext=kallithea.lib.paster_commands.make_rcextensions:Command |
|
164 | 164 | repo-scan=kallithea.lib.paster_commands.repo_scan:Command |
|
165 | 165 | cache-keys=kallithea.lib.paster_commands.cache_keys:Command |
|
166 | 166 | ishell=kallithea.lib.paster_commands.ishell:Command |
|
167 | 167 | make-index=kallithea.lib.paster_commands.make_index:Command |
|
168 | 168 | upgrade-db=kallithea.lib.dbmigrate:UpgradeDb |
|
169 | 169 | celeryd=kallithea.lib.paster_commands.celeryd:Command |
|
170 | 170 | install-iis=kallithea.lib.paster_commands.install_iis:Command |
|
171 | 171 | """, |
|
172 | 172 | ) |
General Comments 0
You need to be logged in to leave comments.
Login now