feat(deps): remove deprecated and unmaintained paste and pastescripts

This commit is contained in:
RhodeCode Admin 2024-05-07 12:32:09 +02:00
parent 338376372c
commit 6db6ef44a6
8 changed files with 1 additions and 342 deletions

View file

@ -171,11 +171,6 @@ nbconvert==7.7.3
webencodings==0.5.1
traitlets==5.9.0
orjson==3.10.3
pastescript==3.6.0
paste==3.10.1
six==1.16.0
pastedeploy==3.1.0
six==1.16.0
premailer==3.10.0
cachetools==5.3.2
cssselect==1.2.0
@ -279,12 +274,6 @@ tzlocal==4.3
unidecode==1.3.6
urlobject==2.4.3
waitress==3.0.0
weberror==0.13.1
paste==3.10.1
six==1.16.0
pygments==2.15.1
tempita==0.5.2
webob==1.8.7
webhelpers2==2.1
markupsafe==2.1.2
six==1.16.0

View file

@ -1,89 +0,0 @@
# Copyright (C) 2010-2023 RhodeCode GmbH
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License, version 3
# (only), as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This program is dual-licensed. If you wish to learn more about the
# RhodeCode Enterprise Edition, including its added features, Support services,
# and proprietary license terms, please see https://rhodecode.com/licenses/
import os
import logging
from paste.script.command import Command, BadCommand
class BasePasterCommand(Command):
"""
Abstract Base Class for paster commands.
The celery commands are somewhat aggressive about loading
celery.conf, and since our module sets the `CELERY_LOADER`
environment variable to our loader, we have to bootstrap a bit and
make sure we've had a chance to load the pylons config off of the
command line, otherwise everything fails.
"""
min_args = 1
min_args_error = "Please provide a paster config file as an argument."
takes_config_file = 1
requires_config_file = True
def notify_msg(self, msg, log=False):
"""Make a notification to user, additionally if logger is passed
it logs this action using given logger
:param msg: message that will be printed to user
:param log: logging instance, to use to additionally log this message
"""
if log and isinstance(log, logging):
log(msg)
def run(self, args):
"""
Overrides Command.run
Checks for a config file argument and loads it.
"""
if len(args) < self.min_args:
raise BadCommand(
self.min_args_error % {'min_args': self.min_args,
'actual_args': len(args)})
# Decrement because we're going to lob off the first argument.
# @@ This is hacky
self.min_args -= 1
self.bootstrap_config(args[0])
self.update_parser()
return super(BasePasterCommand, self).run(args[1:])
def update_parser(self):
"""
Abstract method. Allows for the class' parser to be updated
before the superclass' `run` method is called. Necessary to
allow options/arguments to be passed through to the underlying
celery command.
"""
raise NotImplementedError("Abstract Method.")
def bootstrap_config(self, conf):
"""
Loads the pylons configuration.
"""
self.path_to_ini_file = os.path.realpath(conf)
def _init_session(self):
"""
Inits SqlAlchemy Session
"""
logging.config.fileConfig(self.path_to_ini_file)

View file

@ -1,44 +0,0 @@
# Copyright (C) 2013-2023 RhodeCode GmbH
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License, version 3
# (only), as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This program is dual-licensed. If you wish to learn more about the
# RhodeCode Enterprise Edition, including its added features, Support services,
# and proprietary license terms, please see https://rhodecode.com/licenses/
from rhodecode.lib.paster_commands import BasePasterCommand
class Command(BasePasterCommand):
"""
Start the celery worker
Starts the celery worker that uses a paste.deploy configuration
file.
"""
usage = 'CONFIG_FILE'
summary = __doc__.splitlines()[0]
description = "".join(__doc__.splitlines()[2:])
parser = BasePasterCommand.standard_parser(quiet=True)
def update_parser(self):
pass
def command(self):
cmd = 'celery worker --task-events --beat --app rhodecode.lib.celerylib.loader --loglevel DEBUG --ini=%s' % self.path_to_ini_file
raise Exception('This Command is deprecated please run: %s' % cmd)

View file

@ -1,42 +0,0 @@
# Copyright (C) 2010-2023 RhodeCode GmbH
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License, version 3
# (only), as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This program is dual-licensed. If you wish to learn more about the
# RhodeCode Enterprise Edition, including its added features, Support services,
# and proprietary license terms, please see https://rhodecode.com/licenses/
from rhodecode.lib.paster_commands import BasePasterCommand
class Command(BasePasterCommand):
"""
Start the celery worker
Starts the celery worker that uses a paste.deploy configuration
file.
"""
usage = 'CONFIG_FILE [celeryd options...]'
summary = __doc__.splitlines()[0]
description = "".join(__doc__.splitlines()[2:])
parser = BasePasterCommand.standard_parser(quiet=True)
def update_parser(self):
pass
def command(self):
cmd = 'rc-setup-app %s' % self.path_to_ini_file
raise Exception('This Command is deprecated please run: %s' % cmd)

View file

@ -1,85 +0,0 @@
# Copyright (C) 2013-2023 RhodeCode GmbH
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License, version 3
# (only), as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This program is dual-licensed. If you wish to learn more about the
# RhodeCode Enterprise Edition, including its added features, Support services,
# and proprietary license terms, please see https://rhodecode.com/licenses/
"""
interactive shell paster command for RhodeCode
"""
import os
import sys
import logging
from rhodecode.lib.paster_commands import BasePasterCommand
# fix rhodecode import
from os.path import dirname as dn
rc_path = dn(dn(dn(os.path.realpath(__file__))))
sys.path.append(rc_path)
log = logging.getLogger(__name__)
welcome_banner = """Welcome to RhodeCode iShell.
Type `exit` to exit the shell.
iShell is interactive shell to interact directly with the
internal RhodeCode APIs. You can rescue your lost password,
or reset some user/system settings.
"""
class Command(BasePasterCommand):
max_args = 1
min_args = 1
usage = "CONFIG_FILE"
group_name = "RhodeCode"
takes_config_file = -1
parser = BasePasterCommand.standard_parser(verbose=True)
summary = "Interactive shell"
def import_all_from_module(self, module_name):
import importlib
module = importlib.import_module(module_name)
globals().update({k: v for k, v in module.__dict__.items() if not k.startswith('_')})
def command(self):
# get SqlAlchemy session
self._init_session()
# imports, used in ipython shell
import os
import sys
import time
import shutil
import datetime
self.import_all_from_module('rhodecode.model.db')
try:
from IPython import embed
from traitlets.config import Config
cfg = Config()
cfg.InteractiveShellEmbed.confirm_exit = False
embed(config=cfg, banner1=welcome_banner)
except ImportError:
print('ipython installation required for ishell')
sys.exit(-1)
def update_parser(self):
pass

View file

@ -1,63 +0,0 @@
# Copyright (C) 2010-2023 RhodeCode GmbH
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License, version 3
# (only), as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This program is dual-licensed. If you wish to learn more about the
# RhodeCode Enterprise Edition, including its added features, Support services,
# and proprietary license terms, please see https://rhodecode.com/licenses/
import logging
from rhodecode.lib.paster_commands import BasePasterCommand, Command
log = logging.getLogger(__name__)
class UpgradeDb(BasePasterCommand):
"""
Command used for paster to upgrade our database to newer version
"""
max_args = 1
min_args = 1
usage = "CONFIG_FILE"
summary = "Upgrades current db to newer version"
group_name = "RhodeCode"
parser = Command.standard_parser(verbose=True)
def command(self):
from rhodecode.lib.rc_commands import upgrade_db
upgrade_db.command(
self.path_to_ini_file, self.options.__dict__.get('force_ask'), None)
def update_parser(self):
self.parser.add_option('--sql',
action='store_true',
dest='just_sql',
help="Prints upgrade sql for further investigation",
default=False)
self.parser.add_option('--force-yes',
action='store_true',
dest='force_ask',
default=None,
help='Force yes to every question')
self.parser.add_option('--force-no',
action='store_false',
dest='force_ask',
default=None,
help='Force no to every question')

View file

@ -176,18 +176,11 @@ setup(
('public/**', 'ignore', None),
]
},
paster_plugins=['PasteScript'],
entry_points={
'paste.app_factory': [
'main=rhodecode.config.middleware:make_pyramid_app',
],
'paste.global_paster_command': [
'ishell=rhodecode.lib.paster_commands.ishell:Command',
'upgrade-db=rhodecode.lib.paster_commands.upgrade_db:UpgradeDb',
'setup-rhodecode=rhodecode.lib.paster_commands.deprecated.setup_rhodecode:Command',
'celeryd=rhodecode.lib.paster_commands.deprecated.celeryd:Command',
],
'pyramid.pshell_runner': [
'ipython = rhodecode.lib.pyramid_shell:ipython_shell_runner',
],