Skip to content

Commit

Permalink
fixup! Use newer tarfile to handle bundles more safely
Browse files Browse the repository at this point in the history
  • Loading branch information
bbannier committed Jul 25, 2024
1 parent c67aeb3 commit bc0f054
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ repos:
args: [--fix]
- id: ruff-format

exclude: testing/baselines|zeekpkg/tarfile_fallback.py
exclude: testing/baselines|zeekpkg/vendor/.*
28 changes: 1 addition & 27 deletions zeekpkg/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,38 +7,12 @@
import os
import shutil
import string
import sys
import types

import git
import semantic_version as semver

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
)
):
# 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"
from .vendor import tarfile


def make_dir(path):
Expand Down
3 changes: 3 additions & 0 deletions zeekpkg/vendor/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This directory contains vendored dependencies.

- `tarfile.py` was vendored from <https://github.com/python/cpython/raw/v3.8.19/Lib/tarfile.py>.
File renamed without changes.

0 comments on commit bc0f054

Please sign in to comment.