Skip to content

Commit 2732b6b

Browse files
committed
Remove Python 2.7 compatibility.
It is no longer support on GitHub actions anymore, so it is time to give up on it. Signed-off-by: Chris Lalancette <clalancette@gmail.com>
1 parent 6ba9643 commit 2732b6b

37 files changed

+706
-1123
lines changed

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ sdist:
4141
python3 setup.py sdist
4242

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

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

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

5957
.PHONY: clean deb docs flake8 lineprof mypy profile pylint rpm sdist slowtests srpm test-coverage tests

docs/design.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ The original motivation for writing the library was to replace the subprocess ca
1212
* Support for all of the common optical disk filesystems and their extensions.
1313
* Compatibility with the large corpus of existing ISOs (this implies reading ISOs that violate the standards).
1414
* Relatively simple API.
15-
* Python 2 and Python 3 compatibility.
1615
* Expansive test coverage.
1716
* In-place modification of existing ISOs, something that none of the other libraries support.
1817
* Performance approaching that of genisoimage.

docs/python-compatibility.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Python Compatibility
2-
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.
2+
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.
33

44
---
55

pycdlib/backport_functools.py

Lines changed: 0 additions & 216 deletions
This file was deleted.

pycdlib/dates.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,15 @@
1818
Classes and utilities for ISO date support.
1919
"""
2020

21-
from __future__ import absolute_import
22-
21+
import functools
2322
import struct
2423
import time
25-
try:
26-
from functools import lru_cache
27-
except ImportError:
28-
from pycdlib.backport_functools import lru_cache # type: ignore
2924

3025
from pycdlib import pycdlibexception
3126
from pycdlib import utils
3227

3328

34-
@lru_cache(maxsize=256)
29+
@functools.lru_cache(maxsize=256)
3530
def string_to_timestruct(input_string):
3631
# type: (bytes) -> time.struct_time
3732
"""
@@ -59,7 +54,7 @@ def string_to_timestruct(input_string):
5954
return timestruct
6055

6156

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

149144

150-
class VolumeDescriptorDate(object):
145+
class VolumeDescriptorDate:
151146
"""
152147
A class to represent a Volume Descriptor Date as described in Ecma-119
153148
section 8.4.26.1. The Volume Descriptor Date consists of a year (from 1 to

pycdlib/dr.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
The class to support ISO9660 Directory Records.
1919
"""
2020

21-
from __future__ import absolute_import
22-
2321
import bisect
2422
import struct
2523

@@ -31,13 +29,13 @@
3129

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

3937

40-
class XARecord(object):
38+
class XARecord:
4139
"""
4240
A class that represents an ISO9660 Extended Attribute record as defined
4341
in the Philips Yellow Book standard.
@@ -149,7 +147,7 @@ def length():
149147
return 14
150148

151149

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

11911189
@property
11921190
def data_fp(self):
1193-
# type: () -> Optional[Union[BinaryIO, str]]
1191+
# type: () -> Optional[Union[IO[Any], str]]
11941192
"""Backwards compatibility property for 'data_fp'."""
11951193
if self.inode is None:
11961194
return None

pycdlib/eltorito.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616

1717
"""Classes to support El Torito."""
1818

19-
from __future__ import absolute_import
20-
from __future__ import print_function
21-
2219
import logging
2320
import struct
2421

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

4037

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

134131

135-
class EltoritoValidationEntry(object):
132+
class EltoritoValidationEntry:
136133
"""
137134
A class that represents an El Torito Validation Entry. El Torito requires
138135
that the first entry in the El Torito Boot Catalog be a validation entry.
@@ -277,7 +274,7 @@ def record(self):
277274
return self._record()
278275

279276

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

495492

496-
class EltoritoSectionHeader(object):
493+
class EltoritoSectionHeader:
497494
"""A class that represents an El Torito Section Header."""
498495
__slots__ = ('_initialized', 'header_indicator', 'platform_id',
499496
'num_section_entries', 'id_string', 'section_entries')
@@ -621,7 +618,7 @@ def record(self):
621618
return b''.join(outlist)
622619

623620

624-
class EltoritoBootCatalog(object):
621+
class EltoritoBootCatalog:
625622
"""
626623
A class that represents an El Torito Boot Catalog. The boot catalog is the
627624
basic unit of El Torito, and is expected to contain a validation entry,

0 commit comments

Comments
 (0)