Add Python 3.12 and fix Radarr handling (#1989)

* Added Python3.12 and future 3.13

* Fix Radarr result handling

* remove py2.7 and py3.7 support
This commit is contained in:
Clinton Hall 2024-02-28 15:47:04 +13:00 committed by GitHub
commit f98d6fff65
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
173 changed files with 17498 additions and 21001 deletions

View file

@ -3,8 +3,7 @@ from distutils import log
from distutils.errors import DistutilsOptionError
import distutils
import os
from setuptools.extern.six.moves import configparser
import configparser
from setuptools import Command
@ -19,15 +18,11 @@ def config_file(kind="local"):
if kind == 'local':
return 'setup.cfg'
if kind == 'global':
return os.path.join(
os.path.dirname(distutils.__file__), 'distutils.cfg'
)
return os.path.join(os.path.dirname(distutils.__file__), 'distutils.cfg')
if kind == 'user':
dot = os.name == 'posix' and '.' or ''
return os.path.expanduser(convert_path("~/%spydistutils.cfg" % dot))
raise ValueError(
"config_file() type must be 'local', 'global', or 'user'", kind
)
raise ValueError("config_file() type must be 'local', 'global', or 'user'", kind)
def edit_config(filename, settings, dry_run=False):
@ -40,6 +35,7 @@ def edit_config(filename, settings, dry_run=False):
"""
log.debug("Reading configuration from %s", filename)
opts = configparser.RawConfigParser()
opts.optionxform = lambda x: x
opts.read([filename])
for section, options in settings.items():
if options is None:
@ -51,19 +47,16 @@ def edit_config(filename, settings, dry_run=False):
opts.add_section(section)
for option, value in options.items():
if value is None:
log.debug(
"Deleting %s.%s from %s",
section, option, filename
)
log.debug("Deleting %s.%s from %s", section, option, filename)
opts.remove_option(section, option)
if not opts.options(section):
log.info("Deleting empty [%s] section from %s",
section, filename)
log.info(
"Deleting empty [%s] section from %s", section, filename
)
opts.remove_section(section)
else:
log.debug(
"Setting %s.%s to %r in %s",
section, option, value, filename
"Setting %s.%s to %r in %s", section, option, value, filename
)
opts.set(section, option, value)
@ -77,16 +70,14 @@ class option_base(Command):
"""Abstract base class for commands that mess with config files"""
user_options = [
('global-config', 'g',
"save options to the site-wide distutils.cfg file"),
('user-config', 'u',
"save options to the current user's pydistutils.cfg file"),
('filename=', 'f',
"configuration file to use (default=setup.cfg)"),
('global-config', 'g', "save options to the site-wide distutils.cfg file"),
('user-config', 'u', "save options to the current user's pydistutils.cfg file"),
('filename=', 'f', "configuration file to use (default=setup.cfg)"),
]
boolean_options = [
'global-config', 'user-config',
'global-config',
'user-config',
]
def initialize_options(self):
@ -106,10 +97,9 @@ class option_base(Command):
filenames.append(config_file('local'))
if len(filenames) > 1:
raise DistutilsOptionError(
"Must specify only one configuration file option",
filenames
"Must specify only one configuration file option", filenames
)
self.filename, = filenames
(self.filename,) = filenames
class setopt(option_base):
@ -142,8 +132,7 @@ class setopt(option_base):
def run(self):
edit_config(
self.filename, {
self.command: {self.option.replace('-', '_'): self.set_value}
},
self.dry_run
self.filename,
{self.command: {self.option.replace('-', '_'): self.set_value}},
self.dry_run,
)