setup: fix incomplete implementation of Command
authorRaphaël Gomès <rgomes@octobus.net>
Thu, 07 Apr 2022 15:29:02 +0200
changeset 49038 b6f535f3beda
parent 49037 bb76343959d6
child 49039 0940a45cc838
setup: fix incomplete implementation of Command `test-install.t` fails without the `get_outputs` method being implemented, which is used when, `self.report` is `True`. When 8d7eaff92f9c introduced this change, they probably ran `test-install.t` without `HGTESTS_ALLOW_NETIO=1`, which does not trigger this codepath. Differential Revision: https://phab.mercurial-scm.org/D12482
setup.py
--- a/setup.py	Mon Apr 04 15:36:32 2022 +0200
+++ b/setup.py	Thu Apr 07 15:29:02 2022 +0200
@@ -1110,12 +1110,16 @@
 
     def initialize_options(self):
         self.install_dir = None
+        self.outputs = []
 
     def finalize_options(self):
         self.set_undefined_options(
             'install_data', ('install_dir', 'install_dir')
         )
 
+    def get_outputs(self):
+        return self.outputs
+
     def run(self):
         for src, dir_path, dest in (
             (
@@ -1127,9 +1131,10 @@
         ):
             dir = os.path.join(self.install_dir, *dir_path)
             self.mkpath(dir)
-            self.copy_file(
-                os.path.join('contrib', src), os.path.join(dir, dest)
-            )
+
+            dest = os.path.join(dir, dest)
+            self.outputs.append(dest)
+            self.copy_file(os.path.join('contrib', src), dest)
 
 
 # virtualenv installs custom distutils/__init__.py and