Gentoo Archives: gentoo-python

From: "Michał Górny" <mgorny@g.o>
To: gentoo-python@l.g.o
Cc: python@g.o
Subject: [gentoo-python] [PATCHES] distutils-r1: making in-source builds more compatible with out-of-source builds
Date: Sun, 24 Feb 2013 12:45:44
Message-Id: 20130224134551.63bd9791@pomiocik.lan
1 Hello,
2
3 Currently in-source builds differ a lot from out-of-source builds. Most
4 notably:
5
6 - BUILD_DIR points to source dir rather than build dir,
7
8 - build directories are not overriden,
9
10 - PYTHONPATH is not set.
11
12
13 With the net outcome being that:
14
15 - in-source builds are theoretically safer for weird build system hacks,
16
17 - in-source build ebuilds are harder to write,
18
19 - switching between one and the other requires a fair amount of changes.
20
21
22 If we consider then that enabling in-source build should be considered
23 a quick and possibly temporary hack to get the package to build, points
24 2/3 seem to really outweigh the benefit of 1.
25
26 For that reason, I'd like to 'unify' the behavior between the two.
27 The patches which I will send in reply to this mail will:
28
29
30 1) make BUILD_DIR point to the 'build' subdirectory in in-source builds,
31
32 2) override build locations the same way in both kinds of builds,
33
34 3) set PYTHONPATH in in-source builds,
35
36 4) [optional] run *_all() phases in implementation-specific sources
37 copy rather than ${S}.
38
39
40 This is an incompatible change but seems to be the least troublesome
41 possibility. Most importantly, any ebuild using BUILD_DIR
42 in python_*_all() phase will become at least partially broken.
43
44 Hopefully, this ain't as bad as it seems. Those ebuilds which used
45 BUILD_DIR there to append to PYTHONPATH will still work. While
46 the appending will no longer be correct, the newly-introduced
47 PYTHONPATH will take precedence and solve the issue for now.
48
49 There is also the potential of packages being broken because of
50 --build-* overrides. But the most common case of relying on standard
51 locations would probably still work because the new paths will mostly be
52 absolute-path variants of the default locations.
53
54 In any case, I'm testing this a bit now and will let you know what gets
55 broken.
56
57
58 Rationale:
59
60 The code appends '/build' subdirectory to BUILD_DIR in distutils-r1
61 (python-r1's BUILD_DIR still points to the sources). This seemed like
62 the best possible way of achieving the goal since:
63
64 1) BUILD_DIR is not used commonly in in-source build ebuilds,
65
66 2) using ${BUILD_DIR}/lib with BUILD_DIR pointing to source root is
67 likely to collide with package sources,
68
69 3) using ${BUILD_DIR}/build/lib conditionally would cause
70 incompatibility with out-of-source builds,
71
72 4) using ${BUILD_DIR}/build/lib unconditionally would break a fair
73 number of out-of-source build ebuilds using '${BUILD_DIR}/lib'.
74
75 Therefore, appending the 'build' subdir to BUILD_DIR seems like
76 the least evil necessary to fix the past mistake.
77
78 --
79 Best regards,
80 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies