Skip to content

Commit 5a1c609

Browse files
committed
pypy home scheme fix
1 parent 6e10adf commit 5a1c609

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

pip/backwardcompat.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Stuff that differs in different Python versions"""
22

3+
import os
34
import sys
45
import site
56

@@ -98,3 +99,11 @@ def product(*args, **kwds):
9899
result = [x+[y] for x in result for y in pool]
99100
for prod in result:
100101
yield tuple(prod)
102+
103+
def home_lib(home):
104+
"""Return the lib dir under the 'home' installation scheme"""
105+
if hasattr(sys, 'pypy_version_info'):
106+
lib = 'site-packages'
107+
else:
108+
lib = os.path.join('lib', 'python')
109+
return os.path.join(home, lib)

pip/commands/install.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from pip.basecommand import Command
1010
from pip.index import PackageFinder
1111
from pip.exceptions import InstallationError, CommandError
12+
from pip.backwardcompat import home_lib
1213

1314

1415
class InstallCommand(Command):
@@ -276,7 +277,7 @@ def run(self, options, args):
276277
if options.target_dir:
277278
if not os.path.exists(options.target_dir):
278279
os.makedirs(options.target_dir)
279-
lib_dir = os.path.join(temp_target_dir, "lib/python/")
280+
lib_dir = home_lib(temp_target_dir)
280281
for item in os.listdir(lib_dir):
281282
shutil.move(
282283
os.path.join(lib_dir, item),

0 commit comments

Comments
 (0)