summaryrefslogtreecommitdiff
path: root/setuptools/glob.py
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2018-09-14 05:56:37 -0700
committerJon Dufresne <jon.dufresne@gmail.com>2018-09-14 15:03:46 -0700
commit4f165ed9d35ea7e37823bec25ed822338387c0be (patch)
tree1743f721fa3448aab482b4ed6afe3e48986f7847 /setuptools/glob.py
parent9a2cb89a1c733343c7040073a799d0cd782e435e (diff)
downloadpython-setuptools-git-4f165ed9d35ea7e37823bec25ed822338387c0be.tar.gz
Remove use of compatibility shim six.binary_type
The type bytes is available on all supported Pythons. Makes the code more forward compatible with Python 3.
Diffstat (limited to 'setuptools/glob.py')
-rw-r--r--setuptools/glob.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/setuptools/glob.py b/setuptools/glob.py
index 6c781de3..9d7cbc5d 100644
--- a/setuptools/glob.py
+++ b/setuptools/glob.py
@@ -3,14 +3,12 @@ Filename globbing utility. Mostly a copy of `glob` from Python 3.5.
Changes include:
* `yield from` and PEP3102 `*` removed.
- * `bytes` changed to `six.binary_type`.
* Hidden files are not ignored.
"""
import os
import re
import fnmatch
-from setuptools.extern.six import binary_type
__all__ = ["glob", "iglob", "escape"]
@@ -92,7 +90,7 @@ def _iglob(pathname, recursive):
def glob1(dirname, pattern):
if not dirname:
- if isinstance(pattern, binary_type):
+ if isinstance(pattern, bytes):
dirname = os.curdir.encode('ASCII')
else:
dirname = os.curdir
@@ -129,8 +127,8 @@ def glob2(dirname, pattern):
# Recursively yields relative pathnames inside a literal directory.
def _rlistdir(dirname):
if not dirname:
- if isinstance(dirname, binary_type):
- dirname = binary_type(os.curdir, 'ASCII')
+ if isinstance(dirname, bytes):
+ dirname = os.curdir.encode('ASCII')
else:
dirname = os.curdir
try:
@@ -149,7 +147,7 @@ magic_check_bytes = re.compile(b'([*?[])')
def has_magic(s):
- if isinstance(s, binary_type):
+ if isinstance(s, bytes):
match = magic_check_bytes.search(s)
else:
match = magic_check.search(s)
@@ -157,7 +155,7 @@ def has_magic(s):
def _isrecursive(pattern):
- if isinstance(pattern, binary_type):
+ if isinstance(pattern, bytes):
return pattern == b'**'
else:
return pattern == '**'
@@ -169,7 +167,7 @@ def escape(pathname):
# Escaping is done by wrapping any of "*?[" between square brackets.
# Metacharacters do not work in the drive part and shouldn't be escaped.
drive, pathname = os.path.splitdrive(pathname)
- if isinstance(pathname, binary_type):
+ if isinstance(pathname, bytes):
pathname = magic_check_bytes.sub(br'[\1]', pathname)
else:
pathname = magic_check.sub(r'[\1]', pathname)