Skip to content

Commit

Permalink
Remove Python 2.7 compatibility.
Browse files Browse the repository at this point in the history
It is no longer support on GitHub actions anymore,
so it is time to give up on it.

Signed-off-by: Chris Lalancette <[email protected]>
  • Loading branch information
clalancette committed Mar 24, 2024
1 parent 6ba9643 commit 2732b6b
Show file tree
Hide file tree
Showing 37 changed files with 706 additions and 1,123 deletions.
2 changes: 0 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ sdist:
python3 setup.py sdist

slowtests:
-PYCDLIB_TRACK_WRITES=1 [ -x /usr/bin/py.test-2 ] && py.test-2 --basetemp=/var/tmp/pycdlib-tests --runslow --verbose tests
PYCDLIB_TRACK_WRITES=1 py.test-3 --basetemp=/var/tmp/pycdlib-tests --runslow --verbose tests

srpm: sdist
Expand All @@ -53,7 +52,6 @@ test-coverage:
xdg-open htmlcov/index.html

tests:
-[ -x /usr/bin/py.test-2 ] && py.test-2 --verbose tests
py.test-3 --verbose tests

.PHONY: clean deb docs flake8 lineprof mypy profile pylint rpm sdist slowtests srpm test-coverage tests
1 change: 0 additions & 1 deletion docs/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ The original motivation for writing the library was to replace the subprocess ca
* Support for all of the common optical disk filesystems and their extensions.
* Compatibility with the large corpus of existing ISOs (this implies reading ISOs that violate the standards).
* Relatively simple API.
* Python 2 and Python 3 compatibility.
* Expansive test coverage.
* In-place modification of existing ISOs, something that none of the other libraries support.
* Performance approaching that of genisoimage.
Expand Down
2 changes: 1 addition & 1 deletion docs/python-compatibility.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Python Compatibility
PyCdlib works equally well with Python 2.7 and Python 3.4+. The [test suite](design.md#testing) ensures that the core PyCdlib code works with both flavors of Python. Note that all of the command-line tools use Python 3 by default.
The [test suite](design.md#testing) ensures that the core PyCdlib code works with all versions of Python greater than or equal to Python 3.7.

---

Expand Down
216 changes: 0 additions & 216 deletions pycdlib/backport_functools.py

This file was deleted.

13 changes: 4 additions & 9 deletions pycdlib/dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,15 @@
Classes and utilities for ISO date support.
"""

from __future__ import absolute_import

import functools
import struct
import time
try:
from functools import lru_cache
except ImportError:
from pycdlib.backport_functools import lru_cache # type: ignore

from pycdlib import pycdlibexception
from pycdlib import utils


@lru_cache(maxsize=256)
@functools.lru_cache(maxsize=256)
def string_to_timestruct(input_string):
# type: (bytes) -> time.struct_time
"""
Expand Down Expand Up @@ -59,7 +54,7 @@ def string_to_timestruct(input_string):
return timestruct


class DirectoryRecordDate(object):
class DirectoryRecordDate:
"""
A class to represent a Directory Record date as described in Ecma-119
section 9.1.5. The Directory Record date consists of the number of years
Expand Down Expand Up @@ -147,7 +142,7 @@ def __ne__(self, other):
self.second != other.second or self.gmtoffset != other.gmtoffset


class VolumeDescriptorDate(object):
class VolumeDescriptorDate:
"""
A class to represent a Volume Descriptor Date as described in Ecma-119
section 8.4.26.1. The Volume Descriptor Date consists of a year (from 1 to
Expand Down
10 changes: 4 additions & 6 deletions pycdlib/dr.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
The class to support ISO9660 Directory Records.
"""

from __future__ import absolute_import

import bisect
import struct

Expand All @@ -31,13 +29,13 @@

# For mypy annotations
if False: # pylint: disable=using-constant-test
from typing import BinaryIO, List, Optional, Tuple, Union # NOQA pylint: disable=unused-import
from typing import Any, IO, List, Optional, Tuple, Union # NOQA pylint: disable=unused-import
# NOTE: these imports have to be here to avoid circular deps
from pycdlib import headervd # NOQA pylint: disable=unused-import
from pycdlib import path_table_record # NOQA pylint: disable=unused-import


class XARecord(object):
class XARecord:
"""
A class that represents an ISO9660 Extended Attribute record as defined
in the Philips Yellow Book standard.
Expand Down Expand Up @@ -149,7 +147,7 @@ def length():
return 14


class DirectoryRecord(object):
class DirectoryRecord:
"""A class that represents an ISO9660 directory record."""
__slots__ = ('initialized', 'new_extent_loc', 'ptr', 'extents_to_here',
'offset_to_here', 'data_continuation', 'vd', 'children',
Expand Down Expand Up @@ -1190,7 +1188,7 @@ def set_data_length(self, length):

@property
def data_fp(self):
# type: () -> Optional[Union[BinaryIO, str]]
# type: () -> Optional[Union[IO[Any], str]]
"""Backwards compatibility property for 'data_fp'."""
if self.inode is None:
return None
Expand Down
13 changes: 5 additions & 8 deletions pycdlib/eltorito.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@

"""Classes to support El Torito."""

from __future__ import absolute_import
from __future__ import print_function

import logging
import struct

Expand All @@ -38,7 +35,7 @@
_logger = logging.getLogger('pycdlib')


class EltoritoBootInfoTable(object):
class EltoritoBootInfoTable:
"""
A class that represents an El Torito Boot Info Table. The Boot Info Table
is an optional table that may be patched into the boot file at offset 8,
Expand Down Expand Up @@ -132,7 +129,7 @@ def header_length():
return 16


class EltoritoValidationEntry(object):
class EltoritoValidationEntry:
"""
A class that represents an El Torito Validation Entry. El Torito requires
that the first entry in the El Torito Boot Catalog be a validation entry.
Expand Down Expand Up @@ -277,7 +274,7 @@ def record(self):
return self._record()


class EltoritoEntry(object):
class EltoritoEntry:
"""A class that represents an El Torito Entry (Initial or Section)."""
__slots__ = ('_initialized', 'inode', 'boot_indicator',
'boot_media_type', 'load_segment', 'system_type',
Expand Down Expand Up @@ -493,7 +490,7 @@ def set_data_length(self, length):
self.sector_count = utils.ceiling_div(length, 512)


class EltoritoSectionHeader(object):
class EltoritoSectionHeader:
"""A class that represents an El Torito Section Header."""
__slots__ = ('_initialized', 'header_indicator', 'platform_id',
'num_section_entries', 'id_string', 'section_entries')
Expand Down Expand Up @@ -621,7 +618,7 @@ def record(self):
return b''.join(outlist)


class EltoritoBootCatalog(object):
class EltoritoBootCatalog:
"""
A class that represents an El Torito Boot Catalog. The boot catalog is the
basic unit of El Torito, and is expected to contain a validation entry,
Expand Down
Loading

0 comments on commit 2732b6b

Please sign in to comment.