@@ -815,8 +815,13 @@ def create_glob_set(directory, excludes):
815815
816816
817817def is_environment_dir (directory ):
818+ """Detect whether `directory` is a virtualenv"""
819+
820+ # A virtualenv will have Python at ./bin/python
818821 python_path = join (directory , "bin" , "python" )
819- return exists (python_path )
822+ # But on Windows, it's at Scripts\Python.exe
823+ win_path = join (directory , "Scripts" , "Python.exe" )
824+ return exists (python_path ) or exists (win_path )
820825
821826
822827def list_environment_dirs (directory ):
@@ -859,7 +864,7 @@ def make_api_manifest(
859864 :return: the manifest and a list of the files involved.
860865 """
861866 if is_environment_dir (directory ):
862- excludes = list (excludes or []) + ["bin/" , "lib/" ]
867+ excludes = list (excludes or []) + ["bin/" , "lib/" , "Lib/" , "Scripts/" , "Include/" ]
863868
864869 extra_files = extra_files or []
865870 skip = [environment .filename , "manifest.json" ]
@@ -1483,7 +1488,7 @@ def _warn_if_environment_directory(directory):
14831488 if is_environment_dir (directory ):
14841489 click .secho (
14851490 " Warning: The deployment directory appears to be a python virtual environment.\n "
1486- " Excluding the 'bin' and 'lib' directories ." ,
1491+ " Python libraries and binaries will be excluded from the deployment ." ,
14871492 fg = "yellow" ,
14881493 )
14891494
0 commit comments