Skip to content

Commit

Permalink
Set blacklist subcommand as deprecated
Browse files Browse the repository at this point in the history
There is an initiative for removal of politically problematic words from
IT projects (blacklist, whitelist, slave).
  • Loading branch information
j-mracek authored and m-blaha committed Mar 5, 2021
1 parent fa0c8b7 commit a2922c5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions plugins/versionlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import os
import tempfile
import time
import warnings

NOT_READABLE = _('Unable to read version lock configuration: %s')
NO_LOCKLIST = _('Locklist not set')
Expand Down Expand Up @@ -119,9 +120,10 @@ def sack(self):
if excludes_query:
self.base.sack.add_excludes(excludes_query)

EXC_CMDS = ['exclude', 'add-!', 'add!', 'blacklist']
EXC_CMDS = ['exclude', 'add-!', 'add!']
DEL_CMDS = ['delete', 'del']
ALL_CMDS = ['add', 'clear', 'list'] + EXC_CMDS + DEL_CMDS
DEP_EXC_CMDS = ['blacklist']
ALL_CMDS = ['add', 'clear', 'list'] + EXC_CMDS + DEL_CMDS + DEP_EXC_CMDS


class VersionLockCommand(dnf.cli.Command):
Expand Down Expand Up @@ -152,6 +154,11 @@ def run(self):
self.opts.package.insert(0, self.opts.subcommand)
elif self.opts.subcommand in EXC_CMDS:
cmd = 'exclude'
elif self.opts.subcommand in DEP_EXC_CMDS:
msg = _("Subcommand '{}' is deprecated. Use 'exclude' subcommand instead.").format(
self.opts.subcommand)
warnings.warn(msg, dnf.exceptions.DeprecationWarning, stacklevel=2)
cmd = 'exclude'
elif self.opts.subcommand in DEL_CMDS:
cmd = 'delete'
else:
Expand Down

0 comments on commit a2922c5

Please sign in to comment.