Mercurial > kallithea
annotate rhodecode/lib/paster_commands/ishell.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 |
rev | line source |
---|---|
3663
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
1 # -*- coding: utf-8 -*- |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
2 # This program is free software: you can redistribute it and/or modify |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
3 # it under the terms of the GNU General Public License as published by |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
4 # the Free Software Foundation, either version 3 of the License, or |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
5 # (at your option) any later version. |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
6 # |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
7 # This program is distributed in the hope that it will be useful, |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
8 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
9 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
10 # GNU General Public License for more details. |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
11 # |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
12 # You should have received a copy of the GNU General Public License |
44d173a8136f
ishell paster command
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.ishell |
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 interactive shell 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: Apr 4, 2013 |
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 |
3663
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
26 from __future__ import with_statement |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
27 |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
28 import os |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
29 import sys |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
30 import logging |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
31 |
3915
a42bfe8a9335
moved make-index command to paster_commands module
Marcin Kuzminski <marcin@python-works.com>
parents:
3663
diff
changeset
|
32 from rhodecode.lib.utils import BasePasterCommand |
a42bfe8a9335
moved make-index command to paster_commands module
Marcin Kuzminski <marcin@python-works.com>
parents:
3663
diff
changeset
|
33 |
a42bfe8a9335
moved make-index command to paster_commands module
Marcin Kuzminski <marcin@python-works.com>
parents:
3663
diff
changeset
|
34 # fix rhodecode import |
a42bfe8a9335
moved make-index command to paster_commands module
Marcin Kuzminski <marcin@python-works.com>
parents:
3663
diff
changeset
|
35 from os.path import dirname as dn |
3663
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
36 rc_path = dn(dn(dn(os.path.realpath(__file__)))) |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
37 sys.path.append(rc_path) |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
38 |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
39 log = logging.getLogger(__name__) |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
40 |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
41 |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
42 class Command(BasePasterCommand): |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
43 |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
44 max_args = 1 |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
45 min_args = 1 |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
46 |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
47 usage = "CONFIG_FILE" |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
48 group_name = "RhodeCode" |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
49 takes_config_file = -1 |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
50 parser = BasePasterCommand.standard_parser(verbose=True) |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
51 summary = "Interactive shell" |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
52 |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
53 def command(self): |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
54 #get SqlAlchemy session |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
55 self._init_session() |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
56 |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
57 # imports, used in ipython shell |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
58 import os |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
59 import sys |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
60 import time |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
61 import shutil |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
62 import datetime |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
63 from rhodecode.model.db import * |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
64 |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
65 try: |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
66 from IPython import embed |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
67 from IPython.config.loader import Config |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
68 cfg = Config() |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
69 cfg.InteractiveShellEmbed.confirm_exit = False |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
70 embed(config=cfg, banner1="RhodeCode IShell.") |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
71 except ImportError: |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
72 print 'ipython installation required for ishell' |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
73 sys.exit(-1) |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
74 |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
75 def update_parser(self): |
44d173a8136f
ishell paster command
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
76 pass |