Skip to content

Commit

Permalink
Generic removal of Python2.7 stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
MrBr-github committed Nov 23, 2024
1 parent c386c89 commit b49055a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run_regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ['2.7', '3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
fail-fast: false
steps:
- name: Set up Python ${{ matrix.python-version }}
Expand Down
19 changes: 3 additions & 16 deletions lshca/lshca.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Description: This utility comes to provide bird's-eye view of HCAs installed.
Expand All @@ -8,8 +8,6 @@
# Project repo: https://github.com/MrBr-github/lshca
# License: This utility provided under GNU GPLv3 license

from __future__ import division
from __future__ import print_function
import argparse
import ctypes
import fcntl
Expand All @@ -30,10 +28,7 @@
import time


try:
from StringIO import StringIO # for Python 2
except ImportError:
from io import StringIO, BytesIO # for Python 3
from io import StringIO, BytesIO


class Config(object):
Expand Down Expand Up @@ -2186,9 +2181,6 @@ def lldp_err_msg(self, msg, sign):

def get_data(self, net, ip_state, bond_master):
# type: (str, str, str) -> None
if sys.version_info[0] < 3:
raise Exception("Getting LLDP data requires Python3")

self._interface = net
self._bond_master = bond_master

Expand Down Expand Up @@ -2393,12 +2385,7 @@ def record_data(self, cmd, output, error=""):
def record_data_to_tar(self, file_name, data):
# type: (str, str) -> None
p_data = pickle.dumps(data)

if sys.version_info.major == 3:
tar_contents = BytesIO(p_data)
else:
tar_contents = StringIO(p_data)

tar_contents = BytesIO(p_data)
tarinfo = tarfile.TarInfo(file_name)
tarinfo.size = len(p_data)
tarinfo.mtime = time.time()
Expand Down
8 changes: 1 addition & 7 deletions regression/lshca_regression.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/usr/bin/env python

from __future__ import print_function
#!/usr/bin/env python3

import argparse
import difflib
Expand Down Expand Up @@ -176,10 +174,6 @@ def regression():
sys.exit(1)
else:
file_list = os.listdir(rec_data_dir_path)
if sys.version_info.major == 3:
p3_only_files = os.listdir(os.path.join(rec_data_dir_path, "py3-only"))
p3_only_files = [ os.path.join("py3-only", f) for f in p3_only_files ]
file_list.extend(p3_only_files)

recorded_data_files_list = []
for file in file_list:
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
'Intended Audience :: System Administrators',
'Intended Audience :: Information Technology',
'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3'
],
entry_points={
Expand Down

0 comments on commit b49055a

Please sign in to comment.