Skip to content

Commit

Permalink
Merge pull request #465 from citrus-it/desix
Browse files Browse the repository at this point in the history
Remove remaining uses of "six"
  • Loading branch information
hadfl authored Jan 1, 2024
2 parents 0402b9e + 95c26f8 commit 1051cb7
Show file tree
Hide file tree
Showing 11 changed files with 586 additions and 585 deletions.
3 changes: 1 addition & 2 deletions src/modules/client/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
from urllib.parse import unquote

import pkg.actions as actions
import six

import pkg.catalog as catalog
import pkg.client.api_errors as apx
Expand Down Expand Up @@ -1299,7 +1298,7 @@ def __plan_common_exception(self, log_op_end_all=False):
# re-raise the original exception. (we have to explicitly
# restate the original exception since we may have cleared the
# current exception scope above.)
six.reraise(exc_type, exc_value, exc_traceback)
raise exc_value.with_traceback(exc_traceback)

def solaris_image(self):
"""Returns True if the current image is a solaris image, or an
Expand Down
5 changes: 2 additions & 3 deletions src/modules/client/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import os
import platform
import shutil
import six
import stat
import sys
import tempfile
Expand Down Expand Up @@ -3969,14 +3968,14 @@ def _create_fast_lookups(self, progtrack=None):
portable.rename(op, offsets_path)
portable.rename(bp, conflicting_keys_path)
else:
exc_info = sys.exc_info()
exc_type, exc_value, exc_traceback = sys.exc_info()
try:
os.unlink(stripped_path)
os.unlink(offsets_path)
os.unlink(conflicting_keys_path)
except:
pass
six.reraise(exc_info[0], exc_info[1], exc_info[2])
raise exc_value.with_traceback(exc_traceback)

progtrack.job_add_progress(progtrack.JOB_FAST_LOOKUP)
progtrack.job_done(progtrack.JOB_FAST_LOOKUP)
Expand Down
10 changes: 4 additions & 6 deletions src/modules/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@
S_IXOTH,
)

import six

from urllib.parse import urlsplit, urlparse, urlunparse
from urllib.request import pathname2url, url2pathname

Expand Down Expand Up @@ -180,7 +178,7 @@ def copytree(src, dst):
nor the 'ignore' keyword arguments of the shutil version.
"""

problem = None
exc_value = None
os.makedirs(dst, PKG_DIR_MODE)
src_stat = os.stat(src)
for name in sorted(os.listdir(src)):
Expand Down Expand Up @@ -222,7 +220,7 @@ def copytree(src, dst):
# Store original exception so that the
# real cause of failure can be raised if
# this fails.
problem = sys.exc_info()
exc_type, exc_value, exc_traceback = sys.exc_info()
continue
os.chown(d_path, s.st_uid, s.st_gid)
os.utime(d_path, (s.st_atime, s.st_mtime))
Expand All @@ -244,8 +242,8 @@ def copytree(src, dst):
os.chmod(dst, S_IMODE(src_stat.st_mode))
os.chown(dst, src_stat.st_uid, src_stat.st_gid)
os.utime(dst, (src_stat.st_atime, src_stat.st_mtime))
if problem:
six.reraise(problem[0], problem[1], problem[2])
if exc_value:
raise exc_value.with_traceback(exc_traceback)


def move(src, dst):
Expand Down
2 changes: 1 addition & 1 deletion src/modules/site_paths/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def strip_site():


def add_pkglib():
strip_zip()
# If PYTHONPATH is set in the environment and the environment is not
# being ignored, then don't adjust the path. This could, for example,
# be running under the testsuite.
Expand All @@ -55,6 +54,7 @@ def add_pkglib():
return
import platform

strip_zip()
sys.path, remainder = sys.path[:2], sys.path[2:]
addsitedir(
"/usr/lib/pkg/python{}".format(
Expand Down
7 changes: 0 additions & 7 deletions src/pkg/manifests/legacy/package:pkg:system-repository.p5m
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ file path=lib/svc/manifest/application/pkg/pkg-system-repository.xml \
pkg.depend.bypass-generate=.*
file path=lib/svc/method/svc-pkg-sysrepo pkg.depend.bypass-generate=.*
dir path=usr
#
# Don't worry about the "from x.y.z" six imports since pkgdepend has some issues
# with the python importer. Instead, we force a dependency on the six package.
#
file path=usr/lib/pkg.sysrepo mode=0755 pkg.depend.bypass-generate=.*six.*
dir path=usr/share/man/ja_JP.UTF-8/man1m
file path=usr/share/man/ja_JP.UTF-8/man1m/pkg.sysrepo.1m
dir path=usr/share/man/man1m
Expand All @@ -70,8 +65,6 @@ file path=var/log/pkg/sysrepo/access_log owner=pkg5srv mode=0644 preserve=true
file path=var/log/pkg/sysrepo/error_log owner=pkg5srv mode=0644 preserve=true
license cr_Oracle license=cr_Oracle
depend type=require fmri=package/pkg@$(PKGVERS)
# force a dependency on the six package because we bypass dependency check for it
depend type=require fmri=library/python/six-27
#
# The manual dependency on apache results from our calling apachectl from
# our method script, and can't be detected by pkgdepend.
Expand Down
3 changes: 0 additions & 3 deletions src/pkg/manifests/package:pkg.p5m
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
# Copyright 2023 OmniOS Community Edition (OmniOSce) Association.
#
#
# The six compatibility layers cause detection problems for pkgdepend
<transform file -> default pkg.depend.bypass-generate .*six.*>
#
# pkgdepend doesn't understand the relative import syntax "from .x import y",
# so we have to bypass generating dependencies on those files.
<transform file path=$(PYDIRVP)/pkg/actions -> \
Expand Down
1 change: 0 additions & 1 deletion src/requirements-aarch64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ pybonjour @ https://mirrors.omnios.org/pymodules/pybonjour/pybonjour-1.1.1-pytho
pycurl==7.44.1 # stuck on 7.44.1 - https://github.com/pycurl/pycurl/issues/748
pydantic==1.10.7
pytz==2023.3
six==1.16.0
tempora==5.2.2
typing_extensions==4.5.0
wcwidth==0.2.6
Expand Down
Loading

0 comments on commit 1051cb7

Please sign in to comment.