From fa4eb188f4002383b2c50957e1ec089d1641a8ca Mon Sep 17 00:00:00 2001 From: Greg Ward Date: Mon, 13 Sep 1999 13:58:34 +0000 Subject: Changed selection of installation directories (in 'set_final_options()') so that pure Python modules are installed to the platform-specific directory if there are any extension modules in this distribution. --- Lib/distutils/command/install_lib.py | 20 ++++++++++++++------ Lib/distutils/command/install_py.py | 20 ++++++++++++++------ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/Lib/distutils/command/install_lib.py b/Lib/distutils/command/install_lib.py index 876a34c..a2ba16c 100644 --- a/Lib/distutils/command/install_lib.py +++ b/Lib/distutils/command/install_lib.py @@ -23,15 +23,23 @@ class InstallPy (Command): self.optimize = 1 def set_final_options (self): - # If we don't have a 'dir' value, we'll have to ask the 'install' - # command for one. (This usually means the user ran 'install_py' - # directly, rather than going through 'install' -- so in reality, - # 'find_command_obj()' will create an 'install' command object, - # which we then query. + # Find out from the 'build_ext' command if we were asked to build + # any extensions. If so, that means even pure-Python modules in + # this distribution have to be installed to the "platlib" + # directory. + extensions = self.get_peer_option ('build_ext', 'extensions') + if extensions: + dir_option = 'install_site_platlib' + else: + dir_option = 'install_site_lib' + + # Get all the information we need to install pure Python modules + # from the umbrella 'install' command -- build (source) directory, + # install (target) directory, and whether to compile .py files. self.set_undefined_options ('install', ('build_lib', 'build_dir'), - ('install_site_lib', 'dir'), + (dir_option, 'dir'), ('compile_py', 'compile'), ('optimize_py', 'optimize')) diff --git a/Lib/distutils/command/install_py.py b/Lib/distutils/command/install_py.py index 876a34c..a2ba16c 100644 --- a/Lib/distutils/command/install_py.py +++ b/Lib/distutils/command/install_py.py @@ -23,15 +23,23 @@ class InstallPy (Command): self.optimize = 1 def set_final_options (self): - # If we don't have a 'dir' value, we'll have to ask the 'install' - # command for one. (This usually means the user ran 'install_py' - # directly, rather than going through 'install' -- so in reality, - # 'find_command_obj()' will create an 'install' command object, - # which we then query. + # Find out from the 'build_ext' command if we were asked to build + # any extensions. If so, that means even pure-Python modules in + # this distribution have to be installed to the "platlib" + # directory. + extensions = self.get_peer_option ('build_ext', 'extensions') + if extensions: + dir_option = 'install_site_platlib' + else: + dir_option = 'install_site_lib' + + # Get all the information we need to install pure Python modules + # from the umbrella 'install' command -- build (source) directory, + # install (target) directory, and whether to compile .py files. self.set_undefined_options ('install', ('build_lib', 'build_dir'), - ('install_site_lib', 'dir'), + (dir_option, 'dir'), ('compile_py', 'compile'), ('optimize_py', 'optimize')) -- cgit v0.12