summaryrefslogtreecommitdiff
path: root/dev-python/python-distutils-extra/files/python-distutils-extra-2.44-skip-build.patch
blob: f2a19990ed3425a4962b9bc616ed5286e13a6da9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
From 4f5e11110ce9cc3f511c798acfc009ce5db4e9ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Tue, 28 Apr 2020 10:48:18 +0200
Subject: [PATCH] Fix install_auto command with --skip-build

python-distutils-extra seems to rely on a very bad practice of modifying
internal state (file lists) in middle of `build` commands.  As a result,
if the package is installed via `build` command followed by `install
--skip-build` (since everything was built already!), most of the files
are not installed.

Ideally, this would be resolved by making internal state updates
independent of `build` command execution.  However, given that
the package is not really alive and worth the effort, let's settle
on a cheap hack of calling all `build_*` subcommands from `install`
if `--skip-build` is used.  This partially reverses what standard
distutils `install` command does but it will rebuild only the data files
rather than all C extensions.

Modify tests to use `--skip-build` unconditionally to test this better.
Testing both scenarios probably makes little sense.
---
 DistUtilsExtra/auto.py | 7 +++++++
 test/auto.py           | 5 +++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/DistUtilsExtra/auto.py b/DistUtilsExtra/auto.py
index ea15183..db45f7a 100644
--- a/DistUtilsExtra/auto.py
+++ b/DistUtilsExtra/auto.py
@@ -711,6 +711,13 @@ class sdist_auto(distutils.command.sdist.sdist):
 
 class install_auto(distutils.command.install.install):
     def run(self):
+        # run build_* subcommands to get file lists if install command
+        # won't run 'build' for us
+        if self.skip_build:
+            self.run_command('build_help')
+            self.run_command('build_i18n')
+            self.run_command('build_icons')
+
         # install files from etc/
         if os.path.isdir('etc'):
             # work around a bug in copy_tree() which fails with "File exists" on
diff --git a/test/auto.py b/test/auto.py
index b9644ba..15780c6 100755
--- a/test/auto.py
+++ b/test/auto.py
@@ -873,8 +873,9 @@ print ('import iamnota.module')
         '''
         self.install_tree = tempfile.mkdtemp()
 
-        return self.setup_py(['install', '--no-compile', '--prefix=/usr',
-            '--root=' + self.install_tree])
+        self.setup_py(['build'])
+        return self.setup_py(['install', '--no-compile', '--skip-build',
+            '--prefix=/usr', '--root=' + self.install_tree])
 
     def installed_files(self):
         '''Return list of file paths in install tree.'''
-- 
2.26.2