]> granicus.if.org Git - python/commitdiff
[Bug #444589] Record empty directories in the install_data command
authorAndrew M. Kuchling <amk@amk.ca>
Tue, 4 Sep 2001 20:42:08 +0000 (20:42 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Tue, 4 Sep 2001 20:42:08 +0000 (20:42 +0000)
   Slightly modified version of patch from Jon Nelson (jnelson).

Lib/distutils/command/install_data.py

index 28f593866cae2012398b720d364c59757f43afbc..d0091ce23853e86f033270771a1a81cb4098a56b 100644 (file)
@@ -63,10 +63,18 @@ class install_data (Command):
                 elif self.root:
                     dir = change_root(self.root, dir)
                 self.mkpath(dir)
-                for data in f[1]:
-                    data = convert_path(data)
-                    (out, _) = self.copy_file(data, dir)
-                    self.outfiles.append(out)
+
+                if f[1] == []:
+                    # If there are no files listed, the user must be
+                    # trying to create an empty directory, so add the
+                    # directory to the list of output files.
+                    self.outfiles.append(dir)
+                else:
+                    # Copy files, adding them to the list of output files.
+                    for data in f[1]:
+                        data = convert_path(data)
+                        (out, _) = self.copy_file(data, dir)
+                        self.outfiles.append(out)
 
     def get_inputs (self):
         return self.data_files or []