Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ekoyle committed Jul 24, 2024
1 parent 958bff4 commit 0b6004c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
27 changes: 18 additions & 9 deletions zeekpkg/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,29 @@

pysemver = sys.version_info
# try to handle older versions of python that don't have a recent version of tarfile
if (pysemver.major > 4 or pysemver.major == 3 and (
pysemver.minor >= 12
or pysemver.minor == 11 and pysemver.micro >= 4
or pysemver.minor == 10 and pysemver.micro >= 12
or pysemver.minor == 9 and pysemver.micro >= 17
or pysemver.minor == 8 and pysemver.micro >= 17
)):
if (
pysemver.major > 4
or pysemver.major == 3
and (
pysemver.minor >= 12
or pysemver.minor == 11
and pysemver.micro >= 4
or pysemver.minor == 10
and pysemver.micro >= 12
or pysemver.minor == 9
and pysemver.micro >= 17
or pysemver.minor == 8
and pysemver.micro >= 17
)
):
# Python should have the needed version of tarfile
import tarfile

_tarfile_info = "native"
else:
# use our local copy of the python3.12 tarfile package
from . import tarfile_fallback as tarfile

_tarfile_info = "fallback"


Expand Down Expand Up @@ -88,7 +98,7 @@ def make_symlink(target_path, link_path, force=True):

def zkg_tarfile_create(basedir):
compression = "gz"
tar_name = ''.join((basedir, '.tar.', compression))
tar_name = "".join((basedir, ".tar.", compression))

with tarfile.open(tar_name, "w:" + compression) as tar:
tar.add(basedir, arcname=".", filter=zkg_tarfile_create_filter)
Expand Down Expand Up @@ -144,7 +154,6 @@ def zkg_update_perms(new_attrs, member, extract):
new_attrs["uname"] = new_attrs["gname"] = "root"



def zkg_tarfile_create_filter(member):
new_attrs = {}
zkg_update_perms(new_attrs, member, extract=False)
Expand Down
3 changes: 1 addition & 2 deletions zeekpkg/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
make_symlink,
normalize_version_tag,
read_zeek_config_line,
std_encoding,
zkg_tarfile_create,
zkg_tarfile_extractall,
std_encoding,
)
from .package import (
BUILTIN_SCHEME,
Expand Down Expand Up @@ -2440,7 +2440,6 @@ def match_package_url_and_version(git_url, version):
with open(manifest_file, "w") as f:
config.write(f)

#archive = shutil.make_archive(bundle_dir, "gztar", bundle_dir)
archive = zkg_tarfile_create(bundle_dir)
delete_path(bundle_file)
shutil.move(archive, bundle_file)
Expand Down

0 comments on commit 0b6004c

Please sign in to comment.