annotate rhodecode/lib/paster_commands/make_rcextensions.py @ 4116:ffd45b185016 rhodecode-2.2.5-gpl

Imported some of the GPLv3'd changes from RhodeCode v2.2.5. This imports changes between changesets 21af6c4eab3d and 6177597791c2 in RhodeCode's original repository, including only changes to Python files and HTML. RhodeCode clearly licensed its changes to these files under GPLv3 in their /LICENSE file, which states the following: The Python code and integrated HTML are licensed under the GPLv3 license. (See: https://code.rhodecode.com/rhodecode/files/v2.2.5/LICENSE or http://web.archive.org/web/20140512193334/https://code.rhodecode.com/rhodecode/files/f3b123159901f15426d18e3dc395e8369f70ebe0/LICENSE for an online copy of that LICENSE file) Conservancy reviewed these changes and confirmed that they can be licensed as a whole to the Kallithea project under GPLv3-only. While some of the contents committed herein are clearly licensed GPLv3-or-later, on the whole we must assume the are GPLv3-only, since the statement above from RhodeCode indicates that they intend GPLv3-only as their license, per GPLv3ยง14 and other relevant sections of GPLv3.
author Bradley M. Kuhn <bkuhn@sfconservancy.org>
date Wed, 02 Jul 2014 19:03:13 -0400
parents a42bfe8a9335
children e9f6b533a8f6
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 """
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3915
diff changeset
15 rhodecode.lib.paster_commands.make_rcextensions
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.
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3915
diff changeset
23 :license: GPLv3, see LICENSE for more details.
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
a42bfe8a9335 moved make-index command to paster_commands module
Marcin Kuzminski <marcin@python-works.com>
parents: 3340
diff changeset
34 from rhodecode.lib.utils import BasePasterCommand, ask_ok
3340
f1491bad8339 unified RhodeCode paster commands
Marcin Kuzminski <marcin@python-works.com>
parents: 2405
diff changeset
35
3915
a42bfe8a9335 moved make-index command to paster_commands module
Marcin Kuzminski <marcin@python-works.com>
parents: 3340
diff changeset
36 # fix rhodecode import
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(
3915
a42bfe8a9335 moved make-index command to paster_commands module
Marcin Kuzminski <marcin@python-works.com>
parents: 3340
diff changeset
69 'rhodecode', 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