mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
improve method for getting home scheme purelib
This commit is contained in:
parent
2977a57d66
commit
fd933a93dd
2 changed files with 2 additions and 12 deletions
|
@ -118,15 +118,6 @@ def product(*args, **kwds):
|
||||||
yield tuple(prod)
|
yield tuple(prod)
|
||||||
|
|
||||||
|
|
||||||
def home_lib(home):
|
|
||||||
"""Return the lib dir under the 'home' installation scheme"""
|
|
||||||
if hasattr(sys, 'pypy_version_info'):
|
|
||||||
lib = 'site-packages'
|
|
||||||
else:
|
|
||||||
lib = os.path.join('lib', 'python')
|
|
||||||
return os.path.join(home, lib)
|
|
||||||
|
|
||||||
|
|
||||||
## only >=py32 has ssl.match_hostname and ssl.CertificateError
|
## only >=py32 has ssl.match_hostname and ssl.CertificateError
|
||||||
try:
|
try:
|
||||||
from ssl import match_hostname, CertificateError
|
from ssl import match_hostname, CertificateError
|
||||||
|
|
|
@ -4,11 +4,10 @@ import tempfile
|
||||||
import shutil
|
import shutil
|
||||||
from pip.req import InstallRequirement, RequirementSet, parse_requirements
|
from pip.req import InstallRequirement, RequirementSet, parse_requirements
|
||||||
from pip.log import logger
|
from pip.log import logger
|
||||||
from pip.locations import src_prefix, virtualenv_no_global
|
from pip.locations import src_prefix, virtualenv_no_global, distutils_scheme
|
||||||
from pip.basecommand import Command
|
from pip.basecommand import Command
|
||||||
from pip.index import PackageFinder
|
from pip.index import PackageFinder
|
||||||
from pip.exceptions import InstallationError, CommandError
|
from pip.exceptions import InstallationError, CommandError
|
||||||
from pip.backwardcompat import home_lib
|
|
||||||
from pip import cmdoptions
|
from pip import cmdoptions
|
||||||
|
|
||||||
|
|
||||||
|
@ -256,7 +255,7 @@ class InstallCommand(Command):
|
||||||
if options.target_dir:
|
if options.target_dir:
|
||||||
if not os.path.exists(options.target_dir):
|
if not os.path.exists(options.target_dir):
|
||||||
os.makedirs(options.target_dir)
|
os.makedirs(options.target_dir)
|
||||||
lib_dir = home_lib(temp_target_dir)
|
lib_dir = distutils_scheme('', home=temp_target_dir)['purelib']
|
||||||
for item in os.listdir(lib_dir):
|
for item in os.listdir(lib_dir):
|
||||||
shutil.move(
|
shutil.move(
|
||||||
os.path.join(lib_dir, item),
|
os.path.join(lib_dir, item),
|
||||||
|
|
Loading…
Reference in a new issue