summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/command/install.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/distutils/command/install.py')
-rw-r--r--Lib/distutils/command/install.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/distutils/command/install.py b/Lib/distutils/command/install.py
index e4ee680..50884c3 100644
--- a/Lib/distutils/command/install.py
+++ b/Lib/distutils/command/install.py
@@ -13,6 +13,7 @@ from distutils.sysconfig import get_config_vars
from distutils.errors import DistutilsPlatformError
from distutils.file_util import write_file
from distutils.util import convert_path, subst_vars, change_root
+from distutils.util import get_platform
from distutils.errors import DistutilsOptionError
if sys.version < "2.2":
@@ -485,6 +486,14 @@ class install (Command):
# Obviously have to build before we can install
if not self.skip_build:
self.run_command('build')
+ # If we built for any other platform, we can't install.
+ build_plat = self.distribution.get_command_obj('build').plat_name
+ # check warn_dir - it is a clue that the 'install' is happening
+ # internally, and not to sys.path, so we don't check the platform
+ # matches what we are running.
+ if self.warn_dir and build_plat != get_platform():
+ raise DistutilsPlatformError("Can't install when "
+ "cross-compiling")
# Run all sub-commands (at least those that need to be run)
for cmd_name in self.get_sub_commands():