annotate kallithea/lib/paster_commands/make_rcextensions.py @ 4208:ad38f9f93b3b kallithea-2.2.5-rebrand

Correct licensing information in individual files. The top-level license file is now LICENSE.md. Also, in various places where there should have been joint copyright holders listed, a single copyright holder was listed. It does not appear easy to add a link to a large list of copyright holders in these places, so it simply refers to the fact that various authors hold copyright. In future, if an easy method is discovered to link to a list from those places, we should do so. Finally, text is added to LICENSE.md to point to where the full list of copyright holders is, and that Kallithea as a whole is GPLv3'd.
author Bradley M. Kuhn <bkuhn@sfconservancy.org>
date Wed, 21 May 2014 16:59:37 -0400
parents d1addaf7a91e
children 1948ede028ef
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2105
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
2 # This program is free software: you can redistribute it and/or modify
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
3 # it under the terms of the GNU General Public License as published by
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
4 # the Free Software Foundation, either version 3 of the License, or
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
5 # (at your option) any later version.
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
6 #
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
7 # This program is distributed in the hope that it will be useful,
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
10 # GNU General Public License for more details.
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
11 #
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
12 # You should have received a copy of the GNU General Public License
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
13 # along with this program. If not, see <http://www.gnu.org/licenses/>.
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3915
diff changeset
14 """
4186
7e5f8c12a3fc First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4175
diff changeset
15 kallithea.lib.paster_commands.make_rcextensions
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3915
diff changeset
16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3915
diff changeset
17
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3915
diff changeset
18 make-rcext paster command for RhodeCode
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3915
diff changeset
19
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3915
diff changeset
20 :created_on: Mar 6, 2012
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3915
diff changeset
21 :author: marcink
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3915
diff changeset
22 :copyright: (c) 2013 RhodeCode GmbH.
4208
ad38f9f93b3b Correct licensing information in individual files.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4187
diff changeset
23 :license: GPLv3, see LICENSE.md for more details.
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3915
diff changeset
24
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3915
diff changeset
25 """
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3915
diff changeset
26
2268
6eaa2395a80e small issue fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 2260
diff changeset
27 from __future__ import with_statement
6eaa2395a80e small issue fixes
Marcin Kuzminski <marcin@python-works.com>
parents: 2260
diff changeset
28
2105
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
29 import os
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
30 import sys
3915
a42bfe8a9335 moved make-index command to paster_commands module
Marcin Kuzminski <marcin@python-works.com>
parents: 3340
diff changeset
31 import logging
2105
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
32 import pkg_resources
3915
a42bfe8a9335 moved make-index command to paster_commands module
Marcin Kuzminski <marcin@python-works.com>
parents: 3340
diff changeset
33
4186
7e5f8c12a3fc First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4175
diff changeset
34 from kallithea.lib.utils import BasePasterCommand, ask_ok
3340
f1491bad8339 unified RhodeCode paster commands
Marcin Kuzminski <marcin@python-works.com>
parents: 2405
diff changeset
35
4175
e9f6b533a8f6 Remove wrong/unnecessary/unfixable comment(s)
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4116
diff changeset
36 # Add location of top level folder to sys.path
3915
a42bfe8a9335 moved make-index command to paster_commands module
Marcin Kuzminski <marcin@python-works.com>
parents: 3340
diff changeset
37 from os.path import dirname as dn
3340
f1491bad8339 unified RhodeCode paster commands
Marcin Kuzminski <marcin@python-works.com>
parents: 2405
diff changeset
38 rc_path = dn(dn(dn(os.path.realpath(__file__))))
f1491bad8339 unified RhodeCode paster commands
Marcin Kuzminski <marcin@python-works.com>
parents: 2405
diff changeset
39 sys.path.append(rc_path)
2105
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
40
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
41 log = logging.getLogger(__name__)
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
42
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
43
3340
f1491bad8339 unified RhodeCode paster commands
Marcin Kuzminski <marcin@python-works.com>
parents: 2405
diff changeset
44 class Command(BasePasterCommand):
2105
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
45
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
46 max_args = 1
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
47 min_args = 1
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
48
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
49 usage = "CONFIG_FILE"
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
50 group_name = "RhodeCode"
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
51 takes_config_file = -1
3340
f1491bad8339 unified RhodeCode paster commands
Marcin Kuzminski <marcin@python-works.com>
parents: 2405
diff changeset
52 parser = BasePasterCommand.standard_parser(verbose=True)
f1491bad8339 unified RhodeCode paster commands
Marcin Kuzminski <marcin@python-works.com>
parents: 2405
diff changeset
53 summary = "Creates additional extensions for rhodecode"
2105
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
54
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
55 def command(self):
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
56 logging.config.fileConfig(self.path_to_ini_file)
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
57 from pylons import config
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
58
2405
5019f7798733 removed global tmpl call from make_rcextensions script
Marcin Kuzminski <marcin@python-works.com>
parents: 2268
diff changeset
59 def _make_file(ext_file, tmpl):
2105
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
60 bdir = os.path.split(ext_file)[0]
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
61 if not os.path.isdir(bdir):
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
62 os.makedirs(bdir)
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
63 with open(ext_file, 'wb') as f:
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
64 f.write(tmpl)
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
65 log.info('Writen new extensions file to %s' % ext_file)
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
66
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
67 here = config['here']
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
68 tmpl = pkg_resources.resource_string(
4186
7e5f8c12a3fc First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4175
diff changeset
69 'kallithea', os.path.join('config', 'rcextensions', '__init__.py')
2105
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
70 )
3915
a42bfe8a9335 moved make-index command to paster_commands module
Marcin Kuzminski <marcin@python-works.com>
parents: 3340
diff changeset
71 ext_file = os.path.join(here, 'rcextensions', '__init__.py')
2105
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
72 if os.path.exists(ext_file):
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
73 msg = ('Extension file already exists, do you want '
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
74 'to overwrite it ? [y/n]')
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
75 if ask_ok(msg):
2405
5019f7798733 removed global tmpl call from make_rcextensions script
Marcin Kuzminski <marcin@python-works.com>
parents: 2268
diff changeset
76 _make_file(ext_file, tmpl)
2105
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
77 else:
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
78 log.info('nothing done...')
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
79 else:
2405
5019f7798733 removed global tmpl call from make_rcextensions script
Marcin Kuzminski <marcin@python-works.com>
parents: 2268
diff changeset
80 _make_file(ext_file, tmpl)
2105
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
81
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
82 def update_parser(self):
926f55b038bc added initial rc-extension module
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
83 pass