annotate kallithea/lib/paster_commands/ishell.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
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 """
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.ishell
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 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.
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
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
4186
7e5f8c12a3fc First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4175
diff changeset
32 from kallithea.lib.utils import BasePasterCommand
3915
a42bfe8a9335 moved make-index command to paster_commands module
Marcin Kuzminski <marcin@python-works.com>
parents: 3663
diff changeset
33
4175
e9f6b533a8f6 Remove wrong/unnecessary/unfixable comment(s)
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4116
diff changeset
34 # 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: 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
4186
7e5f8c12a3fc First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 4175
diff changeset
63 from kallithea.model.db import *
3663
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