Commit b4aa5a8 1 parent f61eff9 commit b4aa5a8 Copy full SHA for b4aa5a8
File tree 2 files changed +32
-0
lines changed
2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -757,6 +757,11 @@ def pip_version(self):
757
757
758
758
@property
759
759
def site_packages (self ): # type: () -> Path
760
+ # It seems that PyPy3 virtual environments
761
+ # have their site-packages directory at the root
762
+ if self ._path .joinpath ("site-packages" ).exists ():
763
+ return self ._path .joinpath ("site-packages" )
764
+
760
765
if self ._is_windows :
761
766
return self ._path / "Lib" / "site-packages"
762
767
Original file line number Diff line number Diff line change 9
9
10
10
from poetry .factory import Factory
11
11
from poetry .semver import Version
12
+ from poetry .utils ._compat import WINDOWS
12
13
from poetry .utils ._compat import Path
13
14
from poetry .utils .env import EnvCommandError
14
15
from poetry .utils .env import EnvManager
@@ -696,3 +697,29 @@ def test_activate_with_in_project_setting_does_not_fail_if_no_venvs_dir(
696
697
697
698
envs_file = TomlFile (Path (tmp_dir ) / "virtualenvs" / "envs.toml" )
698
699
assert not envs_file .exists ()
700
+
701
+
702
+ def test_env_site_packages_should_find_the_site_packages_directory_if_standard (tmp_dir ):
703
+ if WINDOWS :
704
+ site_packages = Path (tmp_dir ).joinpath ("Lib/site-packages" )
705
+ else :
706
+ site_packages = Path (tmp_dir ).joinpath (
707
+ "lib/python{}/site-packages" .format (
708
+ "." .join (str (v ) for v in sys .version_info [:2 ])
709
+ )
710
+ )
711
+
712
+ site_packages .mkdir (parents = True )
713
+
714
+ env = VirtualEnv (Path (tmp_dir ), Path (tmp_dir ))
715
+
716
+ assert site_packages == env .site_packages
717
+
718
+
719
+ def test_env_site_packages_should_find_the_site_packages_directory_if_root (tmp_dir ):
720
+ site_packages = Path (tmp_dir ).joinpath ("site-packages" )
721
+ site_packages .mkdir (parents = True )
722
+
723
+ env = VirtualEnv (Path (tmp_dir ), Path (tmp_dir ))
724
+
725
+ assert site_packages == env .site_packages
You can’t perform that action at this time.
0 commit comments