##// END OF EJS Templates
Merge with upstream
Nicolas VINOT -
r1588:8ac66733 merge beta
parent child Browse files
Show More
@@ -1,500 +1,505
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 rhodecode.lib.db_manage
4 4 ~~~~~~~~~~~~~~~~~~~~~~~
5 5
6 6 Database creation, and setup module for RhodeCode. Used for creation
7 7 of database as well as for migration operations
8 8
9 9 :created_on: Apr 10, 2010
10 10 :author: marcink
11 11 :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com>
12 12 :license: GPLv3, see COPYING for more details.
13 13 """
14 14 # This program is free software: you can redistribute it and/or modify
15 15 # it under the terms of the GNU General Public License as published by
16 16 # the Free Software Foundation, either version 3 of the License, or
17 17 # (at your option) any later version.
18 18 #
19 19 # This program is distributed in the hope that it will be useful,
20 20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 22 # GNU General Public License for more details.
23 23 #
24 24 # You should have received a copy of the GNU General Public License
25 25 # along with this program. If not, see <http://www.gnu.org/licenses/>.
26 26
27 27 import os
28 28 import sys
29 29 import uuid
30 30 import logging
31 31 from os.path import dirname as dn, join as jn
32 32
33 33 from rhodecode import __dbversion__
34 34 from rhodecode.model import meta
35 35
36 36 from rhodecode.lib.auth import get_crypt_password, generate_api_key
37 37 from rhodecode.lib.utils import ask_ok
38 38 from rhodecode.model import init_model
39 39 from rhodecode.model.db import User, Permission, RhodeCodeUi, \
40 40 RhodeCodeSettings, UserToPerm, DbMigrateVersion
41 41
42 42 from sqlalchemy.engine import create_engine
43 43
44 44 log = logging.getLogger(__name__)
45 45
46 46
47 47 class DbManage(object):
48 48 def __init__(self, log_sql, dbconf, root, tests=False):
49 49 self.dbname = dbconf.split('/')[-1]
50 50 self.tests = tests
51 51 self.root = root
52 52 self.dburi = dbconf
53 53 self.log_sql = log_sql
54 54 self.db_exists = False
55 55 self.init_db()
56 56
57 57 def init_db(self):
58 58 engine = create_engine(self.dburi, echo=self.log_sql)
59 59 init_model(engine)
60 60 self.sa = meta.Session()
61 61
62 62 def create_tables(self, override=False):
63 63 """Create a auth database
64 64 """
65 65
66 66 log.info("Any existing database is going to be destroyed")
67 67 if self.tests:
68 68 destroy = True
69 69 else:
70 70 destroy = ask_ok('Are you sure to destroy old database ? [y/n]')
71 71 if not destroy:
72 72 sys.exit()
73 73 if destroy:
74 74 meta.Base.metadata.drop_all()
75 75
76 76 checkfirst = not override
77 77 meta.Base.metadata.create_all(checkfirst=checkfirst)
78 78 log.info('Created tables for %s', self.dbname)
79 79
80 80 def set_db_version(self):
81 81 try:
82 82 ver = DbMigrateVersion()
83 83 ver.version = __dbversion__
84 84 ver.repository_id = 'rhodecode_db_migrations'
85 85 ver.repository_path = 'versions'
86 86 self.sa.add(ver)
87 87 self.sa.commit()
88 88 except:
89 89 self.sa.rollback()
90 90 raise
91 91 log.info('db version set to: %s', __dbversion__)
92 92
93 93 def upgrade(self):
94 94 """Upgrades given database schema to given revision following
95 95 all needed steps, to perform the upgrade
96 96
97 97 """
98 98
99 99 from rhodecode.lib.dbmigrate.migrate.versioning import api
100 100 from rhodecode.lib.dbmigrate.migrate.exceptions import \
101 101 DatabaseNotControlledError
102 102
103 103 upgrade = ask_ok('You are about to perform database upgrade, make '
104 104 'sure You backed up your database before. '
105 105 'Continue ? [y/n]')
106 106 if not upgrade:
107 107 sys.exit('Nothing done')
108 108
109 109 repository_path = jn(dn(dn(dn(os.path.realpath(__file__)))),
110 110 'rhodecode/lib/dbmigrate')
111 111 db_uri = self.dburi
112 112
113 113 try:
114 114 curr_version = api.db_version(db_uri, repository_path)
115 115 msg = ('Found current database under version'
116 116 ' control with version %s' % curr_version)
117 117
118 118 except (RuntimeError, DatabaseNotControlledError):
119 119 curr_version = 1
120 120 msg = ('Current database is not under version control. Setting'
121 121 ' as version %s' % curr_version)
122 122 api.version_control(db_uri, repository_path, curr_version)
123 123
124 124 print (msg)
125 125
126 126 if curr_version == __dbversion__:
127 127 sys.exit('This database is already at the newest version')
128 128
129 129 #======================================================================
130 130 # UPGRADE STEPS
131 131 #======================================================================
132 132 class UpgradeSteps(object):
133 133 """Those steps follow schema versions so for example schema
134 134 for example schema with seq 002 == step_2 and so on.
135 135 """
136 136
137 137 def __init__(self, klass):
138 138 self.klass = klass
139 139
140 140 def step_0(self):
141 141 #step 0 is the schema upgrade, and than follow proper upgrades
142 142 print ('attempting to do database upgrade to version %s' \
143 143 % __dbversion__)
144 144 api.upgrade(db_uri, repository_path, __dbversion__)
145 145 print ('Schema upgrade completed')
146 146
147 147 def step_1(self):
148 148 pass
149 149
150 150 def step_2(self):
151 151 print ('Patching repo paths for newer version of RhodeCode')
152 152 self.klass.fix_repo_paths()
153 153
154 154 print ('Patching default user of RhodeCode')
155 155 self.klass.fix_default_user()
156 156
157 157 log.info('Changing ui settings')
158 158 self.klass.create_ui_settings()
159 159
160 160 def step_3(self):
161 161 print ('Adding additional settings into RhodeCode db')
162 162 self.klass.fix_settings()
163 print ('Adding ldap defaults')
164 self.klass.create_ldap_options(skip_existing=True)
163 165
164 166 upgrade_steps = [0] + range(curr_version + 1, __dbversion__ + 1)
165 167
166 168 #CALL THE PROPER ORDER OF STEPS TO PERFORM FULL UPGRADE
167 169 for step in upgrade_steps:
168 170 print ('performing upgrade step %s' % step)
169 171 callable = getattr(UpgradeSteps(self), 'step_%s' % step)()
170 172
171 173 def fix_repo_paths(self):
172 174 """Fixes a old rhodecode version path into new one without a '*'
173 175 """
174 176
175 177 paths = self.sa.query(RhodeCodeUi)\
176 178 .filter(RhodeCodeUi.ui_key == '/')\
177 179 .scalar()
178 180
179 181 paths.ui_value = paths.ui_value.replace('*', '')
180 182
181 183 try:
182 184 self.sa.add(paths)
183 185 self.sa.commit()
184 186 except:
185 187 self.sa.rollback()
186 188 raise
187 189
188 190 def fix_default_user(self):
189 191 """Fixes a old default user with some 'nicer' default values,
190 192 used mostly for anonymous access
191 193 """
192 194 def_user = self.sa.query(User)\
193 195 .filter(User.username == 'default')\
194 196 .one()
195 197
196 198 def_user.name = 'Anonymous'
197 199 def_user.lastname = 'User'
198 200 def_user.email = 'anonymous@rhodecode.org'
199 201
200 202 try:
201 203 self.sa.add(def_user)
202 204 self.sa.commit()
203 205 except:
204 206 self.sa.rollback()
205 207 raise
206 208
207 209 def fix_settings(self):
208 210 """Fixes rhodecode settings adds ga_code key for google analytics
209 211 """
210 212
211 213 hgsettings3 = RhodeCodeSettings('ga_code', '')
212 214
213 215 try:
214 216 self.sa.add(hgsettings3)
215 217 self.sa.commit()
216 218 except:
217 219 self.sa.rollback()
218 220 raise
219 221
220 222 def admin_prompt(self, second=False):
221 223 if not self.tests:
222 224 import getpass
223 225
224 226 def get_password():
225 227 password = getpass.getpass('Specify admin password '
226 228 '(min 6 chars):')
227 229 confirm = getpass.getpass('Confirm password:')
228 230
229 231 if password != confirm:
230 232 log.error('passwords mismatch')
231 233 return False
232 234 if len(password) < 6:
233 235 log.error('password is to short use at least 6 characters')
234 236 return False
235 237
236 238 return password
237 239
238 240 username = raw_input('Specify admin username:')
239 241
240 242 password = get_password()
241 243 if not password:
242 244 #second try
243 245 password = get_password()
244 246 if not password:
245 247 sys.exit()
246 248
247 249 email = raw_input('Specify admin email:')
248 250 self.create_user(username, password, email, True)
249 251 else:
250 252 log.info('creating admin and regular test users')
251 253 self.create_user('test_admin', 'test12',
252 254 'test_admin@mail.com', True)
253 255 self.create_user('test_regular', 'test12',
254 256 'test_regular@mail.com', False)
255 257 self.create_user('test_regular2', 'test12',
256 258 'test_regular2@mail.com', False)
257 259
258 260 def create_ui_settings(self):
259 261 """Creates ui settings, fills out hooks
260 262 and disables dotencode
261 263
262 264 """
263 265 #HOOKS
264 266 hooks1_key = RhodeCodeUi.HOOK_UPDATE
265 267 hooks1_ = self.sa.query(RhodeCodeUi)\
266 268 .filter(RhodeCodeUi.ui_key == hooks1_key).scalar()
267 269
268 270 hooks1 = RhodeCodeUi() if hooks1_ is None else hooks1_
269 271 hooks1.ui_section = 'hooks'
270 272 hooks1.ui_key = hooks1_key
271 273 hooks1.ui_value = 'hg update >&2'
272 274 hooks1.ui_active = False
273 275
274 276 hooks2_key = RhodeCodeUi.HOOK_REPO_SIZE
275 277 hooks2_ = self.sa.query(RhodeCodeUi)\
276 278 .filter(RhodeCodeUi.ui_key == hooks2_key).scalar()
277 279
278 280 hooks2 = RhodeCodeUi() if hooks2_ is None else hooks2_
279 281 hooks2.ui_section = 'hooks'
280 282 hooks2.ui_key = hooks2_key
281 283 hooks2.ui_value = 'python:rhodecode.lib.hooks.repo_size'
282 284
283 285 hooks3 = RhodeCodeUi()
284 286 hooks3.ui_section = 'hooks'
285 287 hooks3.ui_key = RhodeCodeUi.HOOK_PUSH
286 288 hooks3.ui_value = 'python:rhodecode.lib.hooks.log_push_action'
287 289
288 290 hooks4 = RhodeCodeUi()
289 291 hooks4.ui_section = 'hooks'
290 292 hooks4.ui_key = RhodeCodeUi.HOOK_PULL
291 293 hooks4.ui_value = 'python:rhodecode.lib.hooks.log_pull_action'
292 294
293 295 #For mercurial 1.7 set backward comapatibility with format
294 296 dotencode_disable = RhodeCodeUi()
295 297 dotencode_disable.ui_section = 'format'
296 298 dotencode_disable.ui_key = 'dotencode'
297 299 dotencode_disable.ui_value = 'false'
298 300
299 301 try:
300 302 self.sa.add(hooks1)
301 303 self.sa.add(hooks2)
302 304 self.sa.add(hooks3)
303 305 self.sa.add(hooks4)
304 306 self.sa.add(dotencode_disable)
305 307 self.sa.commit()
306 308 except:
307 309 self.sa.rollback()
308 310 raise
309 311
310 def create_ldap_options(self):
312 def create_ldap_options(self,skip_existing=False):
311 313 """Creates ldap settings"""
312 314
313 315 try:
314 316 for k, v in [('ldap_active', 'false'), ('ldap_host', ''),
315 317 ('ldap_port', '389'), ('ldap_tls_kind', 'PLAIN'),
316 318 ('ldap_tls_reqcert', ''), ('ldap_dn_user', ''),
317 319 ('ldap_dn_pass', ''), ('ldap_base_dn', ''),
318 320 ('ldap_filter', ''), ('ldap_search_scope', ''),
319 321 ('ldap_attr_login', ''), ('ldap_attr_firstname', ''),
320 322 ('ldap_attr_lastname', ''), ('ldap_attr_email', '')]:
321 323
324 if skip_existing and RhodeCodeSettings.get_by_name(k) != None:
325 log.debug('Skipping option %s' % k)
326 continue
322 327 setting = RhodeCodeSettings(k, v)
323 328 self.sa.add(setting)
324 329 self.sa.commit()
325 330 except:
326 331 self.sa.rollback()
327 332 raise
328 333
329 334 def config_prompt(self, test_repo_path='', retries=3):
330 335 if retries == 3:
331 336 log.info('Setting up repositories config')
332 337
333 338 if not self.tests and not test_repo_path:
334 339 path = raw_input('Specify valid full path to your repositories'
335 340 ' you can change this later in application settings:')
336 341 else:
337 342 path = test_repo_path
338 343 path_ok = True
339 344
340 345 #check proper dir
341 346 if not os.path.isdir(path):
342 347 path_ok = False
343 348 log.error('Given path %s is not a valid directory', path)
344 349
345 350 #check write access
346 351 if not os.access(path, os.W_OK) and path_ok:
347 352 path_ok = False
348 353 log.error('No write permission to given path %s', path)
349 354
350 355
351 356 if retries == 0:
352 357 sys.exit('max retries reached')
353 358 if path_ok is False:
354 359 retries -= 1
355 360 return self.config_prompt(test_repo_path, retries)
356 361
357 362 return path
358 363
359 364 def create_settings(self, path):
360 365
361 366 self.create_ui_settings()
362 367
363 368 #HG UI OPTIONS
364 369 web1 = RhodeCodeUi()
365 370 web1.ui_section = 'web'
366 371 web1.ui_key = 'push_ssl'
367 372 web1.ui_value = 'false'
368 373
369 374 web2 = RhodeCodeUi()
370 375 web2.ui_section = 'web'
371 376 web2.ui_key = 'allow_archive'
372 377 web2.ui_value = 'gz zip bz2'
373 378
374 379 web3 = RhodeCodeUi()
375 380 web3.ui_section = 'web'
376 381 web3.ui_key = 'allow_push'
377 382 web3.ui_value = '*'
378 383
379 384 web4 = RhodeCodeUi()
380 385 web4.ui_section = 'web'
381 386 web4.ui_key = 'baseurl'
382 387 web4.ui_value = '/'
383 388
384 389 paths = RhodeCodeUi()
385 390 paths.ui_section = 'paths'
386 391 paths.ui_key = '/'
387 392 paths.ui_value = path
388 393
389 394 hgsettings1 = RhodeCodeSettings('realm', 'RhodeCode authentication')
390 395 hgsettings2 = RhodeCodeSettings('title', 'RhodeCode')
391 396 hgsettings3 = RhodeCodeSettings('ga_code', '')
392 397
393 398 try:
394 399 self.sa.add(web1)
395 400 self.sa.add(web2)
396 401 self.sa.add(web3)
397 402 self.sa.add(web4)
398 403 self.sa.add(paths)
399 404 self.sa.add(hgsettings1)
400 405 self.sa.add(hgsettings2)
401 406 self.sa.add(hgsettings3)
402 407
403 408 self.sa.commit()
404 409 except:
405 410 self.sa.rollback()
406 411 raise
407 412
408 413 self.create_ldap_options()
409 414
410 415 log.info('created ui config')
411 416
412 417 def create_user(self, username, password, email='', admin=False):
413 418 log.info('creating administrator user %s', username)
414 419
415 420 form_data = dict(username=username,
416 421 password=password,
417 422 active=True,
418 423 admin=admin,
419 424 name='RhodeCode',
420 425 lastname='Admin',
421 426 email=email)
422 427 User.create(form_data)
423 428
424 429
425 430 def create_default_user(self):
426 431 log.info('creating default user')
427 432 #create default user for handling default permissions.
428 433
429 434 form_data = dict(username='default',
430 435 password=str(uuid.uuid1())[:8],
431 436 active=False,
432 437 admin=False,
433 438 name='Anonymous',
434 439 lastname='User',
435 440 email='anonymous@rhodecode.org')
436 441 User.create(form_data)
437 442
438 443 def create_permissions(self):
439 444 #module.(access|create|change|delete)_[name]
440 445 #module.(read|write|owner)
441 446 perms = [('repository.none', 'Repository no access'),
442 447 ('repository.read', 'Repository read access'),
443 448 ('repository.write', 'Repository write access'),
444 449 ('repository.admin', 'Repository admin access'),
445 450 ('hg.admin', 'Hg Administrator'),
446 451 ('hg.create.repository', 'Repository create'),
447 452 ('hg.create.none', 'Repository creation disabled'),
448 453 ('hg.register.none', 'Register disabled'),
449 454 ('hg.register.manual_activate', 'Register new user with '
450 455 'RhodeCode without manual'
451 456 'activation'),
452 457
453 458 ('hg.register.auto_activate', 'Register new user with '
454 459 'RhodeCode without auto '
455 460 'activation'),
456 461 ]
457 462
458 463 for p in perms:
459 464 new_perm = Permission()
460 465 new_perm.permission_name = p[0]
461 466 new_perm.permission_longname = p[1]
462 467 try:
463 468 self.sa.add(new_perm)
464 469 self.sa.commit()
465 470 except:
466 471 self.sa.rollback()
467 472 raise
468 473
469 474 def populate_default_permissions(self):
470 475 log.info('creating default user permissions')
471 476
472 477 default_user = self.sa.query(User)\
473 478 .filter(User.username == 'default').scalar()
474 479
475 480 reg_perm = UserToPerm()
476 481 reg_perm.user = default_user
477 482 reg_perm.permission = self.sa.query(Permission)\
478 483 .filter(Permission.permission_name == 'hg.register.manual_activate')\
479 484 .scalar()
480 485
481 486 create_repo_perm = UserToPerm()
482 487 create_repo_perm.user = default_user
483 488 create_repo_perm.permission = self.sa.query(Permission)\
484 489 .filter(Permission.permission_name == 'hg.create.repository')\
485 490 .scalar()
486 491
487 492 default_repo_perm = UserToPerm()
488 493 default_repo_perm.user = default_user
489 494 default_repo_perm.permission = self.sa.query(Permission)\
490 495 .filter(Permission.permission_name == 'repository.read')\
491 496 .scalar()
492 497
493 498 try:
494 499 self.sa.add(reg_perm)
495 500 self.sa.add(create_repo_perm)
496 501 self.sa.add(default_repo_perm)
497 502 self.sa.commit()
498 503 except:
499 504 self.sa.rollback()
500 505 raise
@@ -1,116 +1,119
1 1 import logging
2 2 import datetime
3 3
4 4 from sqlalchemy import *
5 5 from sqlalchemy.exc import DatabaseError
6 6 from sqlalchemy.orm import relation, backref, class_mapper
7 7 from sqlalchemy.orm.session import Session
8 8
9 9 from rhodecode.lib.dbmigrate.migrate import *
10 10 from rhodecode.lib.dbmigrate.migrate.changeset import *
11 11
12 12 from rhodecode.model.meta import Base
13 13
14 14 log = logging.getLogger(__name__)
15 15
16 16 def upgrade(migrate_engine):
17 17 """ Upgrade operations go here.
18 18 Don't create your own engine; bind migrate_engine to your metadata
19 19 """
20 20
21 21 #==========================================================================
22 22 # Add table `groups``
23 23 #==========================================================================
24 24 from rhodecode.model.db import Group
25 25 Group().__table__.create()
26 26
27 27 #==========================================================================
28 28 # Add table `group_to_perm`
29 29 #==========================================================================
30 30 from rhodecode.model.db import GroupToPerm
31 31 GroupToPerm().__table__.create()
32 32
33 33 #==========================================================================
34 34 # Add table `users_groups`
35 35 #==========================================================================
36 36 from rhodecode.model.db import UsersGroup
37 37 UsersGroup().__table__.create()
38 38
39 39 #==========================================================================
40 40 # Add table `users_groups_members`
41 41 #==========================================================================
42 42 from rhodecode.model.db import UsersGroupMember
43 43 UsersGroupMember().__table__.create()
44 44
45 45 #==========================================================================
46 46 # Add table `users_group_repo_to_perm`
47 47 #==========================================================================
48 48 from rhodecode.model.db import UsersGroupRepoToPerm
49 49 UsersGroupRepoToPerm().__table__.create()
50 50
51 51 #==========================================================================
52 52 # Add table `users_group_to_perm`
53 53 #==========================================================================
54 54 from rhodecode.model.db import UsersGroupToPerm
55 55 UsersGroupToPerm().__table__.create()
56 56
57 57 #==========================================================================
58 58 # Upgrade of `users` table
59 59 #==========================================================================
60 60 from rhodecode.model.db import User
61 61
62 62 #add column
63 63 ldap_dn = Column("ldap_dn", String(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
64 64 ldap_dn.create(User().__table__)
65 65
66 66 api_key = Column("api_key", String(length=255, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
67 67 api_key.create(User().__table__)
68 68
69 69 #remove old column
70 70 is_ldap = Column("is_ldap", Boolean(), nullable=False, unique=None, default=False)
71 71 is_ldap.drop(User().__table__)
72 72
73 73
74 74 #==========================================================================
75 75 # Upgrade of `repositories` table
76 76 #==========================================================================
77 77 from rhodecode.model.db import Repository
78 78
79 #ADD clone_uri column#
80
81 clone_uri = Column("clone_uri", String(length=255, convert_unicode=False,
82 assert_unicode=None),
83 nullable=True, unique=False, default=None)
84
85 clone_uri.create(Repository().__table__)
86
79 87 #ADD downloads column#
80 88 enable_downloads = Column("downloads", Boolean(), nullable=True, unique=None, default=True)
81 89 enable_downloads.create(Repository().__table__)
82 90
83 91 #ADD column created_on
84 92 created_on = Column('created_on', DateTime(timezone=False), nullable=True,
85 93 unique=None, default=datetime.datetime.now)
86 94 created_on.create(Repository().__table__)
87 95
88 96 #ADD group_id column#
89 97 group_id = Column("group_id", Integer(), ForeignKey('groups.group_id'),
90 98 nullable=True, unique=False, default=None)
91 99
92 100 group_id.create(Repository().__table__)
93 101
94 102
95 #ADD clone_uri column#
96
97 clone_uri = Column("clone_uri", String(length=255, convert_unicode=False,
98 assert_unicode=None),
99 nullable=True, unique=False, default=None)
100
101 clone_uri.create(Repository().__table__)
102
103
104 103 #==========================================================================
105 104 # Upgrade of `user_followings` table
106 105 #==========================================================================
107 106
108 follows_from = Column('follows_from', DateTime(timezone=False), nullable=True, unique=None, default=datetime.datetime.now)
109 follows_from.create(Repository().__table__)
107 from rhodecode.model.db import UserFollowing
108
109 follows_from = Column('follows_from', DateTime(timezone=False),
110 nullable=True, unique=None,
111 default=datetime.datetime.now)
112 follows_from.create(UserFollowing().__table__)
110 113
111 114 return
112 115
113 116
114 117 def downgrade(migrate_engine):
115 118 meta = MetaData()
116 119 meta.bind = migrate_engine
@@ -1,124 +1,125
1 1 import sys
2 2 from rhodecode import get_version
3 3 from rhodecode import __platform__
4 4 from rhodecode import __license__
5 5 from rhodecode import PLATFORM_OTHERS
6 6
7 7 py_version = sys.version_info
8 8
9 9 if py_version < (2, 5):
10 10 raise Exception('RhodeCode requires python 2.5 or later')
11 11
12 12 requirements = [
13 13 "Pylons==1.0.0",
14 14 "WebHelpers>=1.2",
15 "formencode==1.2.4",
15 16 "SQLAlchemy>=0.7.2,<0.8",
16 17 "Mako>=0.4.2",
17 18 "pygments>=1.4",
18 19 "mercurial>=1.9,<2.0",
19 20 "whoosh<1.8",
20 21 "celery>=2.2.5,<2.3",
21 22 "babel",
22 23 "python-dateutil>=1.5.0,<2.0.0",
23 24 "dulwich>=0.8.0",
24 25 "vcs>=0.2.1.dev",
25 26 "webob==1.0.8"
26 27 ]
27 28
28 29 dependency_links = [
29 30 "https://secure.rhodecode.org/vcs/archive/default.zip#egg=vcs-0.2.1.dev",
30 31 "https://bitbucket.org/marcinkuzminski/vcs/get/default.zip#egg=vcs-0.2.1.dev",
31 32 ]
32 33
33 34 classifiers = ['Development Status :: 4 - Beta',
34 35 'Environment :: Web Environment',
35 36 'Framework :: Pylons',
36 37 'Intended Audience :: Developers',
37 38 'Operating System :: OS Independent',
38 39 'Programming Language :: Python',
39 40 'Programming Language :: Python :: 2.5',
40 41 'Programming Language :: Python :: 2.6',
41 42 'Programming Language :: Python :: 2.7', ]
42 43
43 44 if py_version < (2, 6):
44 45 requirements.append("simplejson")
45 46 requirements.append("pysqlite")
46 47
47 48 if __platform__ in PLATFORM_OTHERS:
48 49 requirements.append("py-bcrypt")
49 50
50 51
51 52 #additional files from project that goes somewhere in the filesystem
52 53 #relative to sys.prefix
53 54 data_files = []
54 55
55 56 #additional files that goes into package itself
56 57 package_data = {'rhodecode': ['i18n/*/LC_MESSAGES/*.mo', ], }
57 58
58 59 description = ('Mercurial repository browser/management with '
59 60 'build in push/pull server and full text search')
60 61 keywords = ' '.join(['rhodecode', 'rhodiumcode', 'mercurial', 'git',
61 62 'repository management', 'hgweb replacement'
62 63 'hgwebdir', 'gitweb replacement', 'serving hgweb', ])
63 64 #long description
64 65 try:
65 66 readme_file = 'README.rst'
66 67 changelog_file = 'docs/changelog.rst'
67 68 long_description = open(readme_file).read() + '\n\n' + \
68 69 open(changelog_file).read()
69 70
70 71 except IOError, err:
71 72 sys.stderr.write("[WARNING] Cannot find file specified as "
72 73 "long_description (%s)\n or changelog (%s) skipping that file" \
73 74 % (readme_file, changelog_file))
74 75 long_description = description
75 76
76 77
77 78 try:
78 79 from setuptools import setup, find_packages
79 80 except ImportError:
80 81 from ez_setup import use_setuptools
81 82 use_setuptools()
82 83 from setuptools import setup, find_packages
83 84 #packages
84 85 packages = find_packages(exclude=['ez_setup'])
85 86
86 87 setup(
87 88 name='RhodeCode',
88 89 version=get_version(),
89 90 description=description,
90 91 long_description=long_description,
91 92 keywords=keywords,
92 93 license=__license__,
93 94 author='Marcin Kuzminski',
94 95 author_email='marcin@python-works.com',
95 96 dependency_links=dependency_links,
96 97 url='http://rhodecode.org',
97 98 install_requires=requirements,
98 99 classifiers=classifiers,
99 100 setup_requires=["PasteScript>=1.6.3"],
100 101 data_files=data_files,
101 102 packages=packages,
102 103 include_package_data=True,
103 104 test_suite='nose.collector',
104 105 package_data=package_data,
105 106 message_extractors={'rhodecode': [
106 107 ('**.py', 'python', None),
107 108 ('templates/**.mako', 'mako', {'input_encoding': 'utf-8'}),
108 109 ('templates/**.html', 'mako', {'input_encoding': 'utf-8'}),
109 110 ('public/**', 'ignore', None)]},
110 111 zip_safe=False,
111 112 paster_plugins=['PasteScript', 'Pylons'],
112 113 entry_points="""
113 114 [paste.app_factory]
114 115 main = rhodecode.config.middleware:make_app
115 116
116 117 [paste.app_install]
117 118 main = pylons.util:PylonsInstaller
118 119
119 120 [paste.global_paster_command]
120 121 make-index = rhodecode.lib.indexers:MakeIndex
121 122 upgrade-db = rhodecode.lib.dbmigrate:UpgradeDb
122 123 celeryd=rhodecode.lib.celerypylons.commands:CeleryDaemonCommand
123 124 """,
124 125 )
General Comments 0
You need to be logged in to leave comments. Login now