Skip to content

Commit

Permalink
Merge pull request #5709 from BoboTiG/fix-warnings
Browse files Browse the repository at this point in the history
Fix several warnings
  • Loading branch information
pradyunsg authored Sep 18, 2018
2 parents 392cb09 + 3b1be84 commit 52cf26e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/pip/_internal/pep425tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from collections import OrderedDict

import pip._internal.utils.glibc
from pip._internal.utils.compat import get_extension_suffixes

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -252,10 +253,9 @@ def get_supported(versions=None, noarch=False, platform=None,
abis[0:0] = [abi]

abi3s = set()
import imp
for suffix in imp.get_suffixes():
if suffix[0].startswith('.abi'):
abi3s.add(suffix[0].split('.', 2)[1])
for suffix in get_extension_suffixes():
if suffix.startswith('.abi'):
abi3s.add(suffix.split('.', 2)[1])

abis.extend(sorted(list(abi3s)))

Expand Down
13 changes: 13 additions & 0 deletions src/pip/_internal/utils/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
__all__ = [
"ipaddress", "uses_pycache", "console_to_str", "native_str",
"get_path_uid", "stdlib_pkgs", "WINDOWS", "samefile", "get_terminal_size",
"get_extension_suffixes",
]


Expand Down Expand Up @@ -160,6 +161,18 @@ def get_path_uid(path):
return file_uid


if sys.version_info >= (3, 4):
from importlib.machinery import EXTENSION_SUFFIXES

def get_extension_suffixes():
return EXTENSION_SUFFIXES
else:
from imp import get_suffixes

def get_extension_suffixes():
return [suffix[0] for suffix in get_suffixes()]


def expanduser(path):
"""
Expand ~ and ~user constructions.
Expand Down
2 changes: 1 addition & 1 deletion src/pip/_internal/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ def _get_script_text(entry):
if warn_script_location:
msg = message_about_scripts_not_on_PATH(generated_console_scripts)
if msg is not None:
logger.warn(msg)
logger.warning(msg)

if len(gui) > 0:
generated.extend(
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/test_req.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ def test_no_reuse_existing_build_dir(self, data):

build_dir = os.path.join(self.tempdir, 'build', 'simple')
os.makedirs(build_dir)
open(os.path.join(build_dir, "setup.py"), 'w')
with open(os.path.join(build_dir, "setup.py"), 'w'):
pass
reqset = RequirementSet()
req = install_req_from_line('simple')
req.is_direct = True
Expand Down

0 comments on commit 52cf26e

Please sign in to comment.