summaryrefslogtreecommitdiffstats
path: root/third_party/python/pip/pip/_internal/utils/filetypes.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--third_party/python/pip/pip/_internal/utils/filetypes.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/third_party/python/pip/pip/_internal/utils/filetypes.py b/third_party/python/pip/pip/_internal/utils/filetypes.py
new file mode 100644
index 0000000000..5948570178
--- /dev/null
+++ b/third_party/python/pip/pip/_internal/utils/filetypes.py
@@ -0,0 +1,27 @@
+"""Filetype information.
+"""
+
+from typing import Tuple
+
+from pip._internal.utils.misc import splitext
+
+WHEEL_EXTENSION = ".whl"
+BZ2_EXTENSIONS: Tuple[str, ...] = (".tar.bz2", ".tbz")
+XZ_EXTENSIONS: Tuple[str, ...] = (
+ ".tar.xz",
+ ".txz",
+ ".tlz",
+ ".tar.lz",
+ ".tar.lzma",
+)
+ZIP_EXTENSIONS: Tuple[str, ...] = (".zip", WHEEL_EXTENSION)
+TAR_EXTENSIONS: Tuple[str, ...] = (".tar.gz", ".tgz", ".tar")
+ARCHIVE_EXTENSIONS = ZIP_EXTENSIONS + BZ2_EXTENSIONS + TAR_EXTENSIONS + XZ_EXTENSIONS
+
+
+def is_archive_file(name: str) -> bool:
+ """Return True if `name` is a considered as an archive file."""
+ ext = splitext(name)[1].lower()
+ if ext in ARCHIVE_EXTENSIONS:
+ return True
+ return False