Skip to content

Commit

Permalink
hardwareprofile: remove ancient "future" compatibility library for py…
Browse files Browse the repository at this point in the history
…thon2

Ironically, for a package that was intended to provide portability
between python2 and python3, it is broken with python 3.12. A better
library to use in all cases is "six".

However, mythtv requires python 3.8 for a while now. Using
"future.standard_library" is a no-op other than costing a pointless
import and being troublesome to actually install.

The hacky copy of six.with_metaclass included in "future" is rewritten
to use the pure python3 form of a metaclass.
  • Loading branch information
eli-schwartz authored and rcrdnalor committed Jan 8, 2024
1 parent af345e2 commit 4b5eac8
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 21 deletions.
1 change: 0 additions & 1 deletion mythtv/configure
Original file line number Diff line number Diff line change
Expand Up @@ -6563,7 +6563,6 @@ if enabled bindings_python; then
check_py_lib MySQLdb || disable_bindings_python "MySQLdb"
check_py_lib lxml || disable_bindings_python "lxml"
check_py_lib requests || disable_bindings_python "requests"
check_py_lib future || disable_bindings_python "future"
check_python "(3,11,1)" && check_py_lib wheel && check_py_lib_version pip "(23,0,1)" && USE_PYTHON_PIP="yes"
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
"""
from __future__ import print_function

from future import standard_library
standard_library.install_aliases()
from builtins import object
from email.generator import _make_boundary
import mimetypes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
# providing the base url, user agent, and proxy information.
# The object returned is slightly modified, with a shortcut to urlopen.

from future import standard_library
standard_library.install_aliases()
from builtins import object
import urllib.request, urllib.error, urllib.parse
import urllib.parse
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.

from future import standard_library
standard_library.install_aliases()
from builtins import map
from builtins import str
from builtins import object
Expand Down
8 changes: 3 additions & 5 deletions mythtv/programs/scripts/hardwareprofile/hwdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
from __future__ import absolute_import
from builtins import int
from builtins import open
from future import standard_library
standard_library.install_aliases()
from builtins import object
from smolt_config import get_config_attr

Expand Down Expand Up @@ -71,9 +69,9 @@ def device_map(self, bus='pci'):
pass
else:
raise Exception('Hardware data file not found. Please set the location HWDATA_DIR in config.py')



vendors = {}
curvendor = None
curdevice = None
Expand Down
5 changes: 2 additions & 3 deletions mythtv/programs/scripts/hardwareprofile/os_detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
from __future__ import print_function
from builtins import object
import os
from future.utils import with_metaclass

class OrderedType( type ):
# provide global sequencing for OS class and subclasses to ensure
Expand All @@ -37,7 +36,7 @@ def __new__(mcs, name, bases, attrs):
mcs.nextorder += 1
return type.__new__(mcs, name, bases, attrs)

class OS( with_metaclass(OrderedType, object) ):
class OS(metaclass=OrderedType):
_requires_func = True
def __init__(self, ostype=-1, func=None, inst=None):
if callable(ostype):
Expand Down Expand Up @@ -189,7 +188,7 @@ def __call__(cls):
# fall through to Unknown
return 'Unknown'

class get_os_info( with_metaclass(OSInfoType, object) ):
class get_os_info(metaclass=OSInfoType):
@OS('nt')
def windows(self):
win_version = {
Expand Down
2 changes: 0 additions & 2 deletions mythtv/programs/scripts/hardwareprofile/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
# providing the base url, user agent, and proxy information.
# The object returned is slightly modified, with a shortcut to urlopen.

from future import standard_library
standard_library.install_aliases()
from builtins import object

try:
Expand Down
2 changes: 0 additions & 2 deletions mythtv/programs/scripts/hardwareprofile/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.

from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
import smolt
import json

Expand Down
2 changes: 0 additions & 2 deletions mythtv/programs/scripts/hardwareprofile/uuiddb.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.

from future import standard_library
standard_library.install_aliases()
from builtins import object
import configparser
import logging
Expand Down

0 comments on commit 4b5eac8

Please sign in to comment.