Skip to content

Commit

Permalink
Fallback from pip._vendor imports to environment wide imports
Browse files Browse the repository at this point in the history
  • Loading branch information
xolox committed Jan 17, 2016
1 parent 94904a0 commit 77d4131
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
13 changes: 10 additions & 3 deletions pip_accel/req.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Accelerator for pip, the Python package manager.
#
# Author: Peter Odding <[email protected]>
# Last Change: November 7, 2015
# Last Change: January 17, 2016
# URL: https://github.com/paylogic/pip-accel

"""
Expand Down Expand Up @@ -38,10 +38,17 @@

# External dependencies.
from cached_property import cached_property
from pip._vendor.distlib.util import ARCHIVE_EXTENSIONS
from pip._vendor.pkg_resources import find_distributions
from pip.req import InstallRequirement

# The following package(s) are usually bundled with pip but may be unbundled
# by redistributors and pip-accel should handle this gracefully.
try:
from pip._vendor.distlib.util import ARCHIVE_EXTENSIONS
from pip._vendor.pkg_resources import find_distributions
except ImportError:
from distlib.util import ARCHIVE_EXTENSIONS
from pkg_resources import find_distributions


class Requirement(object):

Expand Down
15 changes: 8 additions & 7 deletions pip_accel/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Utility functions for the pip accelerator.
#
# Author: Peter Odding <[email protected]>
# Last Change: January 10, 2016
# Last Change: January 17, 2016
# URL: https://github.com/paylogic/pip-accel

"""
Expand All @@ -26,12 +26,13 @@
# External dependencies.
from humanfriendly import parse_path
from pip.commands.uninstall import UninstallCommand
from pip._vendor.pkg_resources import (
DistributionNotFound,
WorkingSet,
get_distribution,
parse_requirements,
)

# The following package(s) are usually bundled with pip but may be unbundled
# by redistributors and pip-accel should handle this gracefully.
try:
from pip._vendor.pkg_resources import DistributionNotFound, WorkingSet, get_distribution, parse_requirements
except ImportError:
from pkg_resources import DistributionNotFound, WorkingSet, get_distribution, parse_requirements

# Initialize a logger for this module.
logger = logging.getLogger(__name__)
Expand Down

0 comments on commit 77d4131

Please sign in to comment.