Changed selection of installation directories (in 'set_final_options()')
authorGreg Ward <gward@python.net>
Mon, 13 Sep 1999 13:58:34 +0000 (13:58 +0000)
committerGreg Ward <gward@python.net>
Mon, 13 Sep 1999 13:58:34 +0000 (13:58 +0000)
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
Lib/distutils/command/install_py.py

index 876a34ce61fa91886eee7a91b60ededf8076d7df..a2ba16cc35e5ff1650d3ac1af9615337b9f1b8a4 100644 (file)
@@ -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'))
 
index 876a34ce61fa91886eee7a91b60ededf8076d7df..a2ba16cc35e5ff1650d3ac1af9615337b9f1b8a4 100644 (file)
@@ -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'))