annotate Lib/distutils/command/install.py @ 58765:2ba7677bfa95 legacy-trunk

testCopysign was defined twice in test_math; combine the definitions
author Mark Dickinson <dickinsm@gmail.com>
date Sat, 06 Feb 2010 23:11:25 +0000
parents 39c8b47824c5
children 0bd1736e3297
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
1 """distutils.command.install
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
2
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
3 Implements the Distutils 'install' command."""
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
4
11897
017e592c0fd2 Changed '__rcsid__' to '__revision__'.
Greg Ward <gward@python.net>
parents: 11859
diff changeset
5 __revision__ = "$Id$"
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
6
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
7 import sys
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
8 import os
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
9
58503
f9fd1795fcf7 added local get_platform/set_platform APIs in distutils.sysconfig
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58450
diff changeset
10 from sysconfig import get_config_vars, get_paths, get_path, get_config_var
58450
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
11
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
12 from distutils import log
25212
12949eced55f Use distutils.debug.DEBUG instead of distutils.core.DEBUG.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 23688
diff changeset
13 from distutils.core import Command
12949eced55f Use distutils.debug.DEBUG instead of distutils.core.DEBUG.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 23688
diff changeset
14 from distutils.debug import DEBUG
19140
8c378f9086cd Add forgotten import
Andrew M. Kuchling <amk@amk.ca>
parents: 15922
diff changeset
15 from distutils.errors import DistutilsPlatformError
13871
8307446bc6aa Fixed imports from '*util' modules to not just import everything from util.
Greg Ward <gward@python.net>
parents: 13003
diff changeset
16 from distutils.file_util import write_file
58503
f9fd1795fcf7 added local get_platform/set_platform APIs in distutils.sysconfig
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58450
diff changeset
17 from distutils.util import convert_path, change_root, get_platform
11859
2d8740647e99 Unfinished, untested implementation of the lovely baroque installation scheme
Greg Ward <gward@python.net>
parents: 11817
diff changeset
18 from distutils.errors import DistutilsOptionError
46698
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
19
58676
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
20 # kept for backward compat, will be removed in 3.2
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
21 if sys.version < "2.2":
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
22 WINDOWS_SCHEME = {
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
23 'purelib': '$base',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
24 'platlib': '$base',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
25 'headers': '$base/Include/$dist_name',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
26 'scripts': '$base/Scripts',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
27 'data' : '$base',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
28 }
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
29 else:
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
30 WINDOWS_SCHEME = {
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
31 'purelib': '$base/Lib/site-packages',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
32 'platlib': '$base/Lib/site-packages',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
33 'headers': '$base/Include/$dist_name',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
34 'scripts': '$base/Scripts',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
35 'data' : '$base',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
36 }
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
37
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
38 INSTALL_SCHEMES = {
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
39 'unix_prefix': {
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
40 'purelib': '$base/lib/python$py_version_short/site-packages',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
41 'platlib': '$platbase/lib/python$py_version_short/site-packages',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
42 'headers': '$base/include/python$py_version_short/$dist_name',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
43 'scripts': '$base/bin',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
44 'data' : '$base',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
45 },
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
46 'unix_home': {
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
47 'purelib': '$base/lib/python',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
48 'platlib': '$base/lib/python',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
49 'headers': '$base/include/python/$dist_name',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
50 'scripts': '$base/bin',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
51 'data' : '$base',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
52 },
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
53 'unix_user': {
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
54 'purelib': '$usersite',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
55 'platlib': '$usersite',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
56 'headers': '$userbase/include/python$py_version_short/$dist_name',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
57 'scripts': '$userbase/bin',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
58 'data' : '$userbase',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
59 },
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
60 'nt': WINDOWS_SCHEME,
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
61 'nt_user': {
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
62 'purelib': '$usersite',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
63 'platlib': '$usersite',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
64 'headers': '$userbase/Python$py_version_nodot/Include/$dist_name',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
65 'scripts': '$userbase/Scripts',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
66 'data' : '$userbase',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
67 },
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
68 'mac': {
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
69 'purelib': '$base/Lib/site-packages',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
70 'platlib': '$base/Lib/site-packages',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
71 'headers': '$base/Include/$dist_name',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
72 'scripts': '$base/Scripts',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
73 'data' : '$base',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
74 },
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
75 'mac_user': {
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
76 'purelib': '$usersite',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
77 'platlib': '$usersite',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
78 'headers': '$userbase/$py_version_short/include/$dist_name',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
79 'scripts': '$userbase/bin',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
80 'data' : '$userbase',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
81 },
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
82 'os2': {
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
83 'purelib': '$base/Lib/site-packages',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
84 'platlib': '$base/Lib/site-packages',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
85 'headers': '$base/Include/$dist_name',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
86 'scripts': '$base/Scripts',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
87 'data' : '$base',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
88 },
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
89 'os2_home': {
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
90 'purelib': '$usersite',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
91 'platlib': '$usersite',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
92 'headers': '$userbase/include/python$py_version_short/$dist_name',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
93 'scripts': '$userbase/bin',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
94 'data' : '$userbase',
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
95 },
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
96 }
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
97
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
98 SCHEME_KEYS = ('purelib', 'platlib', 'headers', 'scripts', 'data')
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
99 # end of backward compat
39c8b47824c5 leaving global attributes for backward compat
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 58503
diff changeset
100
58450
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
101 def _subst_vars(s, local_vars):
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
102 try:
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
103 return s.format(**local_vars)
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
104 except KeyError:
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
105 try:
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
106 return s.format(**os.environ)
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
107 except KeyError, var:
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
108 raise AttributeError('{%s}' % var)
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
109
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
110 class install(Command):
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
111
11683
47f75a17b103 Added 'description' class attribute to every command class (to help the
Greg Ward <gward@python.net>
parents: 11659
diff changeset
112 description = "install everything from build directory"
47f75a17b103 Added 'description' class attribute to every command class (to help the
Greg Ward <gward@python.net>
parents: 11659
diff changeset
113
11815
03902bc0214a Renamed all 'options' class attributes to 'user_options'.
Greg Ward <gward@python.net>
parents: 11813
diff changeset
114 user_options = [
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
115 # Select installation scheme and set base director(y|ies)
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
116 ('prefix=', None,
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
117 "installation prefix"),
11815
03902bc0214a Renamed all 'options' class attributes to 'user_options'.
Greg Ward <gward@python.net>
parents: 11813
diff changeset
118 ('exec-prefix=', None,
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
119 "(Unix only) prefix for platform-specific files"),
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
120 ('home=', None,
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
121 "(Unix only) home directory to install under"),
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
122
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
123 # Or, just set the base director(y|ies)
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
124 ('install-base=', None,
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
125 "base installation directory (instead of --prefix or --home)"),
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
126 ('install-platbase=', None,
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
127 "base installation directory for platform-specific files " +
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
128 "(instead of --exec-prefix or --home)"),
12508
b76bacccd346 Added the "--root" option as a sort of meta-install-base; if supplied,
Greg Ward <gward@python.net>
parents: 12498
diff changeset
129 ('root=', None,
b76bacccd346 Added the "--root" option as a sort of meta-install-base; if supplied,
Greg Ward <gward@python.net>
parents: 12498
diff changeset
130 "install everything relative to this alternate root directory"),
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
131
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
132 # Or, explicitly set the installation scheme
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
133 ('install-purelib=', None,
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
134 "installation directory for pure Python module distributions"),
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
135 ('install-platlib=', None,
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
136 "installation directory for non-pure module distributions"),
11859
2d8740647e99 Unfinished, untested implementation of the lovely baroque installation scheme
Greg Ward <gward@python.net>
parents: 11817
diff changeset
137 ('install-lib=', None,
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
138 "installation directory for all module distributions " +
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
139 "(overrides --install-purelib and --install-platlib)"),
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
140
12777
38da864a0c80 Support for the "install_headers" command:
Greg Ward <gward@python.net>
parents: 12743
diff changeset
141 ('install-headers=', None,
38da864a0c80 Support for the "install_headers" command:
Greg Ward <gward@python.net>
parents: 12743
diff changeset
142 "installation directory for C/C++ headers"),
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
143 ('install-scripts=', None,
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
144 "installation directory for Python scripts"),
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
145 ('install-data=', None,
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
146 "installation directory for data files"),
11859
2d8740647e99 Unfinished, untested implementation of the lovely baroque installation scheme
Greg Ward <gward@python.net>
parents: 11817
diff changeset
147
14962
9c3aefa5cd7f Added --compile, --optimize options so users have an easy way to
Greg Ward <gward@python.net>
parents: 14948
diff changeset
148 # Byte-compilation options -- see install_lib.py for details, as
9c3aefa5cd7f Added --compile, --optimize options so users have an easy way to
Greg Ward <gward@python.net>
parents: 14948
diff changeset
149 # these are duplicated from there (but only install_lib does
9c3aefa5cd7f Added --compile, --optimize options so users have an easy way to
Greg Ward <gward@python.net>
parents: 14948
diff changeset
150 # anything with them).
9c3aefa5cd7f Added --compile, --optimize options so users have an easy way to
Greg Ward <gward@python.net>
parents: 14948
diff changeset
151 ('compile', 'c', "compile .py to .pyc [default]"),
9c3aefa5cd7f Added --compile, --optimize options so users have an easy way to
Greg Ward <gward@python.net>
parents: 14948
diff changeset
152 ('no-compile', None, "don't compile .py files"),
9c3aefa5cd7f Added --compile, --optimize options so users have an easy way to
Greg Ward <gward@python.net>
parents: 14948
diff changeset
153 ('optimize=', 'O',
9c3aefa5cd7f Added --compile, --optimize options so users have an easy way to
Greg Ward <gward@python.net>
parents: 14948
diff changeset
154 "also compile with optimization: -O1 for \"python -O\", "
9c3aefa5cd7f Added --compile, --optimize options so users have an easy way to
Greg Ward <gward@python.net>
parents: 14948
diff changeset
155 "-O2 for \"python -OO\", and -O0 to disable [default: -O0]"),
21268
d296e6bb17e5 Whitespace normalization.
Fred Drake <fdrake@acm.org>
parents: 19699
diff changeset
156
14540
35ae8dff8ed0 Added --force (-f) option to force installation (including bytecode
Greg Ward <gward@python.net>
parents: 14537
diff changeset
157 # Miscellaneous control options
35ae8dff8ed0 Added --force (-f) option to force installation (including bytecode
Greg Ward <gward@python.net>
parents: 14537
diff changeset
158 ('force', 'f',
35ae8dff8ed0 Added --force (-f) option to force installation (including bytecode
Greg Ward <gward@python.net>
parents: 14537
diff changeset
159 "force installation (overwrite any existing files)"),
12680
b89da202d18d Added --skip-build option, so lazy debuggers/testers (mainly me) don't
Gregory P. Smith <greg@mad-scientist.com>
parents: 12675
diff changeset
160 ('skip-build', None,
b89da202d18d Added --skip-build option, so lazy debuggers/testers (mainly me) don't
Gregory P. Smith <greg@mad-scientist.com>
parents: 12675
diff changeset
161 "skip rebuilding everything (for testing/debugging)"),
b89da202d18d Added --skip-build option, so lazy debuggers/testers (mainly me) don't
Gregory P. Smith <greg@mad-scientist.com>
parents: 12675
diff changeset
162
11815
03902bc0214a Renamed all 'options' class attributes to 'user_options'.
Greg Ward <gward@python.net>
parents: 11813
diff changeset
163 # Where to install documentation (eventually!)
11859
2d8740647e99 Unfinished, untested implementation of the lovely baroque installation scheme
Greg Ward <gward@python.net>
parents: 11817
diff changeset
164 #('doc-format=', None, "format of documentation to generate"),
2d8740647e99 Unfinished, untested implementation of the lovely baroque installation scheme
Greg Ward <gward@python.net>
parents: 11817
diff changeset
165 #('install-man=', None, "directory for Unix man pages"),
2d8740647e99 Unfinished, untested implementation of the lovely baroque installation scheme
Greg Ward <gward@python.net>
parents: 11817
diff changeset
166 #('install-html=', None, "directory for HTML documentation"),
2d8740647e99 Unfinished, untested implementation of the lovely baroque installation scheme
Greg Ward <gward@python.net>
parents: 11817
diff changeset
167 #('install-info=', None, "directory for GNU info files"),
12694
a94269bd6585 Harry Henry Gebel: add the "--record" option to write the list of
Gregory P. Smith <greg@mad-scientist.com>
parents: 12681
diff changeset
168
12698
eb1718c5a56c Made the '--record' option take an argument, which is the name of the
Gregory P. Smith <greg@mad-scientist.com>
parents: 12697
diff changeset
169 ('record=', None,
eb1718c5a56c Made the '--record' option take an argument, which is the name of the
Gregory P. Smith <greg@mad-scientist.com>
parents: 12697
diff changeset
170 "filename in which to record list of installed files"),
11815
03902bc0214a Renamed all 'options' class attributes to 'user_options'.
Greg Ward <gward@python.net>
parents: 11813
diff changeset
171 ]
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
172
51890
8b68968879c7 Issue #5052: make Distutils compatible with 2.3 again.
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51047
diff changeset
173 boolean_options = ['compile', 'force', 'skip-build']
8b68968879c7 Issue #5052: make Distutils compatible with 2.3 again.
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51047
diff changeset
174
58450
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
175 user_options.append(('user', None,
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
176 "install in user site-package '%s'" % \
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
177 get_path('purelib', '%s_user' % os.name)))
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
178 boolean_options.append('user')
14983
b61cd1a48960 Fixed so --no-compile is a negative alias for --compile.
Greg Ward <gward@python.net>
parents: 14962
diff changeset
179 negative_opt = {'no-compile' : 'compile'}
14829
b1f220f636ed Added 'boolean_options' list to support config file parsing.
Greg Ward <gward@python.net>
parents: 14744
diff changeset
180
12097
7a515fc10c1d Changed so the sub-commands we rely on to do the real work is specified
Greg Ward <gward@python.net>
parents: 12039
diff changeset
181
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
182 def initialize_options(self):
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
183 """Initializes options."""
12039
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
184 # High-level options: these select both an installation base
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
185 # and scheme.
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
186 self.prefix = None
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
187 self.exec_prefix = None
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
188 self.home = None
46698
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
189 self.user = 0
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
190
12039
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
191 # These select only the installation base; it's up to the user to
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
192 # specify the installation scheme (currently, that means supplying
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
193 # the --install-{platlib,purelib,scripts,data} options).
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
194 self.install_base = None
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
195 self.install_platbase = None
12508
b76bacccd346 Added the "--root" option as a sort of meta-install-base; if supplied,
Greg Ward <gward@python.net>
parents: 12498
diff changeset
196 self.root = None
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
197
12039
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
198 # These options are the actual installation directories; if not
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
199 # supplied by the user, they are filled in using the installation
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
200 # scheme implied by prefix/exec-prefix/home and the contents of
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
201 # that installation scheme.
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
202 self.install_purelib = None # for pure module distributions
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
203 self.install_platlib = None # non-pure (dists w/ extensions)
12777
38da864a0c80 Support for the "install_headers" command:
Greg Ward <gward@python.net>
parents: 12743
diff changeset
204 self.install_headers = None # for C/C++ headers
12039
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
205 self.install_lib = None # set to either purelib or platlib
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
206 self.install_scripts = None
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
207 self.install_data = None
58450
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
208 self.install_userbase = get_config_var('userbase')
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
209 self.install_usersite = get_path('purelib', '%s_user' % os.name)
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
210
22448
9e8aa29523f0 Revert part of previous patch: several install_* subcommands expect
Andrew M. Kuchling <amk@amk.ca>
parents: 22435
diff changeset
211 self.compile = None
14962
9c3aefa5cd7f Added --compile, --optimize options so users have an easy way to
Greg Ward <gward@python.net>
parents: 14948
diff changeset
212 self.optimize = None
9c3aefa5cd7f Added --compile, --optimize options so users have an easy way to
Greg Ward <gward@python.net>
parents: 14948
diff changeset
213
12039
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
214 # These two are for putting non-packagized distributions into their
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
215 # own directory and creating a .pth file if it makes sense.
14744
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
216 # 'extra_path' comes from the setup file; 'install_path_file' can
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
217 # be turned off if it makes no sense to install a .pth file. (But
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
218 # better to install it uselessly than to guess wrong and not
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
219 # install it when it's necessary and would be used!) Currently,
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
220 # 'install_path_file' is always true unless some outsider meddles
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
221 # with it.
12034
23fce9b9f3bc Dropped any notion of allowing the user to specify the build directories:
Greg Ward <gward@python.net>
parents: 12031
diff changeset
222 self.extra_path = None
14744
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
223 self.install_path_file = 1
12034
23fce9b9f3bc Dropped any notion of allowing the user to specify the build directories:
Greg Ward <gward@python.net>
parents: 12031
diff changeset
224
14744
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
225 # 'force' forces installation, even if target files are not
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
226 # out-of-date. 'skip_build' skips running the "build" command,
33744
99caba814565 Backing out the basic dependency checking (from pycon sprint).
Anthony Baxter <anthonybaxter@gmail.com>
parents: 32736
diff changeset
227 # handy if you know it's not necessary. 'warn_dir' (which is *not*
14744
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
228 # a user option, it's just there so the bdist_* commands can turn
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
229 # it off) determines whether we warn about installing to a
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
230 # directory not in sys.path.
14540
35ae8dff8ed0 Added --force (-f) option to force installation (including bytecode
Greg Ward <gward@python.net>
parents: 14537
diff changeset
231 self.force = 0
12680
b89da202d18d Added --skip-build option, so lazy debuggers/testers (mainly me) don't
Gregory P. Smith <greg@mad-scientist.com>
parents: 12675
diff changeset
232 self.skip_build = 0
14744
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
233 self.warn_dir = 1
12680
b89da202d18d Added --skip-build option, so lazy debuggers/testers (mainly me) don't
Gregory P. Smith <greg@mad-scientist.com>
parents: 12675
diff changeset
234
12034
23fce9b9f3bc Dropped any notion of allowing the user to specify the build directories:
Greg Ward <gward@python.net>
parents: 12031
diff changeset
235 # These are only here as a conduit from the 'build' command to the
23fce9b9f3bc Dropped any notion of allowing the user to specify the build directories:
Greg Ward <gward@python.net>
parents: 12031
diff changeset
236 # 'install_*' commands that do the real work. ('build_base' isn't
23fce9b9f3bc Dropped any notion of allowing the user to specify the build directories:
Greg Ward <gward@python.net>
parents: 12031
diff changeset
237 # actually used anywhere, but it might be useful in future.) They
23fce9b9f3bc Dropped any notion of allowing the user to specify the build directories:
Greg Ward <gward@python.net>
parents: 12031
diff changeset
238 # are not user options, because if the user told the install
23fce9b9f3bc Dropped any notion of allowing the user to specify the build directories:
Greg Ward <gward@python.net>
parents: 12031
diff changeset
239 # command where the build directory is, that wouldn't affect the
23fce9b9f3bc Dropped any notion of allowing the user to specify the build directories:
Greg Ward <gward@python.net>
parents: 12031
diff changeset
240 # build command.
11859
2d8740647e99 Unfinished, untested implementation of the lovely baroque installation scheme
Greg Ward <gward@python.net>
parents: 11817
diff changeset
241 self.build_base = None
2d8740647e99 Unfinished, untested implementation of the lovely baroque installation scheme
Greg Ward <gward@python.net>
parents: 11817
diff changeset
242 self.build_lib = None
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
243
12039
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
244 # Not defined yet because we don't know anything about
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
245 # documentation yet.
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
246 #self.install_man = None
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
247 #self.install_html = None
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
248 #self.install_info = None
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
249
12694
a94269bd6585 Harry Henry Gebel: add the "--record" option to write the list of
Gregory P. Smith <greg@mad-scientist.com>
parents: 12681
diff changeset
250 self.record = None
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
251
14939
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
252
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
253 # -- Option finalizing methods -------------------------------------
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
254 # (This is rather more involved than for most commands,
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
255 # because this is where the policy for installing third-
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
256 # party Python modules on various platforms given a wide
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
257 # array of user input is decided. Yes, it's quite complex!)
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
258
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
259 def finalize_options(self):
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
260 """Finalizes options."""
12039
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
261 # This method (and its pliant slaves, like 'finalize_unix()',
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
262 # 'finalize_other()', and 'select_scheme()') is where the default
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
263 # installation directories for modules, extension modules, and
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
264 # anything else we care to install from a Python module
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
265 # distribution. Thus, this code makes a pretty important policy
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
266 # statement about how third-party stuff is added to a Python
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
267 # installation! Note that the actual work of installation is done
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
268 # by the relatively simple 'install_*' commands; they just take
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
269 # their orders from the installation directory options determined
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
270 # here.
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
271
12039
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
272 # Check for errors/inconsistencies in the options; first, stuff
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
273 # that's wrong on any platform.
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
274
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
275 if ((self.prefix or self.exec_prefix or self.home) and
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
276 (self.install_base or self.install_platbase)):
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
277 raise DistutilsOptionError, \
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
278 ("must supply either prefix/exec-prefix/home or " +
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
279 "install-base/install-platbase -- not both")
10928
5ed9a2dd18d9 Hacked 'set_final_options()' to set (hopefully) appropriate values for
Greg Ward <gward@python.net>
parents: 10807
diff changeset
280
32408
e0a7c461311b Make distutils "install --home" support all platforms.
Fred Drake <fdrake@acm.org>
parents: 31777
diff changeset
281 if self.home and (self.prefix or self.exec_prefix):
e0a7c461311b Make distutils "install --home" support all platforms.
Fred Drake <fdrake@acm.org>
parents: 31777
diff changeset
282 raise DistutilsOptionError, \
e0a7c461311b Make distutils "install --home" support all platforms.
Fred Drake <fdrake@acm.org>
parents: 31777
diff changeset
283 "must supply either home or prefix/exec-prefix -- not both"
e0a7c461311b Make distutils "install --home" support all platforms.
Fred Drake <fdrake@acm.org>
parents: 31777
diff changeset
284
46698
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
285 if self.user and (self.prefix or self.exec_prefix or self.home or
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
286 self.install_base or self.install_platbase):
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
287 raise DistutilsOptionError("can't combine user with with prefix/"
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
288 "exec_prefix/home or install_(plat)base")
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
289
12039
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
290 # Next, stuff that's wrong (or dubious) only on certain platforms.
32408
e0a7c461311b Make distutils "install --home" support all platforms.
Fred Drake <fdrake@acm.org>
parents: 31777
diff changeset
291 if os.name != "posix":
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
292 if self.exec_prefix:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
293 self.warn("exec-prefix option ignored on this platform")
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
294 self.exec_prefix = None
10928
5ed9a2dd18d9 Hacked 'set_final_options()' to set (hopefully) appropriate values for
Greg Ward <gward@python.net>
parents: 10807
diff changeset
295
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
296 # Now the interesting logic -- so interesting that we farm it out
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
297 # to other methods. The goal of these methods is to set the final
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
298 # values for the install_{lib,scripts,data,...} options, using as
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
299 # input a heady brew of prefix, exec_prefix, home, install_base,
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
300 # install_platbase, user-supplied versions of
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
301 # install_{purelib,platlib,lib,scripts,data,...}, and the
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
302 # INSTALL_SCHEME dictionary above. Phew!
11859
2d8740647e99 Unfinished, untested implementation of the lovely baroque installation scheme
Greg Ward <gward@python.net>
parents: 11817
diff changeset
303
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
304 self.dump_dirs("pre-finalize_{unix,other}")
12498
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
305
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
306 if os.name == 'posix':
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
307 self.finalize_unix()
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
308 else:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
309 self.finalize_other()
11859
2d8740647e99 Unfinished, untested implementation of the lovely baroque installation scheme
Greg Ward <gward@python.net>
parents: 11817
diff changeset
310
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
311 self.dump_dirs("post-finalize_{unix,other}()")
12498
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
312
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
313 # Expand configuration variables, tilde, etc. in self.install_base
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
314 # and self.install_platbase -- that way, we can use $base or
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
315 # $platbase in the other installation directories and not worry
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
316 # about needing recursive variable expansion (shudder).
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
317
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
318 py_version = sys.version.split()[0]
58450
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
319 prefix, exec_prefix, srcdir = get_config_vars('prefix', 'exec_prefix',
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
320 'srcdir')
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
321
12777
38da864a0c80 Support for the "install_headers" command:
Greg Ward <gward@python.net>
parents: 12743
diff changeset
322 self.config_vars = {'dist_name': self.distribution.get_name(),
38da864a0c80 Support for the "install_headers" command:
Greg Ward <gward@python.net>
parents: 12743
diff changeset
323 'dist_version': self.distribution.get_version(),
38da864a0c80 Support for the "install_headers" command:
Greg Ward <gward@python.net>
parents: 12743
diff changeset
324 'dist_fullname': self.distribution.get_fullname(),
38da864a0c80 Support for the "install_headers" command:
Greg Ward <gward@python.net>
parents: 12743
diff changeset
325 'py_version': py_version,
38da864a0c80 Support for the "install_headers" command:
Greg Ward <gward@python.net>
parents: 12743
diff changeset
326 'py_version_short': py_version[0:3],
46698
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
327 'py_version_nodot': py_version[0] + py_version[2],
14575
ba5421ff0256 Adjust to the new sysconfig regime: use 'get_config_vars()' instead
Greg Ward <gward@python.net>
parents: 14540
diff changeset
328 'sys_prefix': prefix,
ba5421ff0256 Adjust to the new sysconfig regime: use 'get_config_vars()' instead
Greg Ward <gward@python.net>
parents: 14540
diff changeset
329 'prefix': prefix,
ba5421ff0256 Adjust to the new sysconfig regime: use 'get_config_vars()' instead
Greg Ward <gward@python.net>
parents: 14540
diff changeset
330 'sys_exec_prefix': exec_prefix,
ba5421ff0256 Adjust to the new sysconfig regime: use 'get_config_vars()' instead
Greg Ward <gward@python.net>
parents: 14540
diff changeset
331 'exec_prefix': exec_prefix,
58450
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
332 'srcdir': srcdir,
12498
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
333 }
51890
8b68968879c7 Issue #5052: make Distutils compatible with 2.3 again.
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51047
diff changeset
334
58450
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
335 self.config_vars['userbase'] = self.install_userbase
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
336 self.config_vars['usersite'] = self.install_usersite
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
337 self.expand_basedirs()
12498
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
338
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
339 self.dump_dirs("post-expand_basedirs()")
12498
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
340
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
341 # Now define config vars for the base directories so we can expand
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
342 # everything else.
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
343 self.config_vars['base'] = self.install_base
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
344 self.config_vars['platbase'] = self.install_platbase
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
345
12786
f768d4dad9a6 Only print debugging output if DEBUG (imported from distutils.core) is true.
Greg Ward <gward@python.net>
parents: 12783
diff changeset
346 if DEBUG:
f768d4dad9a6 Only print debugging output if DEBUG (imported from distutils.core) is true.
Greg Ward <gward@python.net>
parents: 12783
diff changeset
347 from pprint import pprint
f768d4dad9a6 Only print debugging output if DEBUG (imported from distutils.core) is true.
Greg Ward <gward@python.net>
parents: 12783
diff changeset
348 print "config vars:"
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
349 pprint(self.config_vars)
12498
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
350
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
351 # Expand "~" and configuration variables in the installation
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
352 # directories.
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
353 self.expand_dirs()
11302
8028908a9889 Added 'install_path' option for giving non-packagized module
Greg Ward <gward@python.net>
parents: 11282
diff changeset
354
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
355 self.dump_dirs("post-expand_dirs()")
12498
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
356
46698
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
357 # Create directories in the home dir:
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
358 if self.user:
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
359 self.create_home_path()
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
360
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
361 # Pick the actual directory to install all modules to: either
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
362 # install_purelib or install_platlib, depending on whether this
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
363 # module distribution is pure or not. Of course, if the user
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
364 # already specified install_lib, use their selection.
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
365 if self.install_lib is None:
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
366 if self.distribution.ext_modules: # has extensions: non-pure
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
367 self.install_lib = self.install_platlib
11302
8028908a9889 Added 'install_path' option for giving non-packagized module
Greg Ward <gward@python.net>
parents: 11282
diff changeset
368 else:
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
369 self.install_lib = self.install_purelib
21268
d296e6bb17e5 Whitespace normalization.
Fred Drake <fdrake@acm.org>
parents: 19699
diff changeset
370
14744
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
371
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
372 # Convert directories from Unix /-separated syntax to the local
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
373 # convention.
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
374 self.convert_paths('lib', 'purelib', 'platlib',
46698
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
375 'scripts', 'data', 'headers',
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
376 'userbase', 'usersite')
14744
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
377
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
378 # Well, we're not actually fully completely finalized yet: we still
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
379 # have to deal with 'extra_path', which is the hack for allowing
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
380 # non-packagized module distributions (hello, Numerical Python!) to
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
381 # get their own directories.
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
382 self.handle_extra_path()
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
383 self.install_libbase = self.install_lib # needed for .pth file
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
384 self.install_lib = os.path.join(self.install_lib, self.extra_dirs)
11302
8028908a9889 Added 'install_path' option for giving non-packagized module
Greg Ward <gward@python.net>
parents: 11282
diff changeset
385
12508
b76bacccd346 Added the "--root" option as a sort of meta-install-base; if supplied,
Greg Ward <gward@python.net>
parents: 12498
diff changeset
386 # If a new root directory was supplied, make all the installation
b76bacccd346 Added the "--root" option as a sort of meta-install-base; if supplied,
Greg Ward <gward@python.net>
parents: 12498
diff changeset
387 # dirs relative to it.
b76bacccd346 Added the "--root" option as a sort of meta-install-base; if supplied,
Greg Ward <gward@python.net>
parents: 12498
diff changeset
388 if self.root is not None:
14744
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
389 self.change_roots('libbase', 'lib', 'purelib', 'platlib',
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
390 'scripts', 'data', 'headers')
12508
b76bacccd346 Added the "--root" option as a sort of meta-install-base; if supplied,
Greg Ward <gward@python.net>
parents: 12498
diff changeset
391
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
392 self.dump_dirs("after prepending root")
12508
b76bacccd346 Added the "--root" option as a sort of meta-install-base; if supplied,
Greg Ward <gward@python.net>
parents: 12498
diff changeset
393
12039
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
394 # Find out the build directories, ie. where to install from.
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
395 self.set_undefined_options('build',
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
396 ('build_base', 'build_base'),
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
397 ('build_lib', 'build_lib'))
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
398
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
399 # Punt on doc directories for now -- after all, we're punting on
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
400 # documentation completely!
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
401
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
402 def dump_dirs(self, msg):
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
403 """Dumps the list of user options."""
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
404 if not DEBUG:
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
405 return
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
406 from distutils.fancy_getopt import longopt_xlate
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
407 log.debug(msg + ":")
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
408 for opt in self.user_options:
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
409 opt_name = opt[0]
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
410 if opt_name[-1] == "=":
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
411 opt_name = opt_name[0:-1]
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
412 if opt_name in self.negative_opt:
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
413 opt_name = self.negative_opt[opt_name]
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
414 opt_name = opt_name.translate(longopt_xlate)
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
415 val = not getattr(self, opt_name)
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
416 else:
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
417 opt_name = opt_name.translate(longopt_xlate)
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
418 val = getattr(self, opt_name)
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
419 log.debug(" %s: %s" % (opt_name, val))
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
420
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
421 def finalize_unix(self):
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
422 """Finalizes options for posix platforms."""
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
423 if self.install_base is not None or self.install_platbase is not None:
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
424 if ((self.install_lib is None and
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
425 self.install_purelib is None and
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
426 self.install_platlib is None) or
12777
38da864a0c80 Support for the "install_headers" command:
Greg Ward <gward@python.net>
parents: 12743
diff changeset
427 self.install_headers is None or
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
428 self.install_scripts is None or
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
429 self.install_data is None):
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
430 raise DistutilsOptionError, \
23688
d7bd7b7329a7 Move warning about directory not on sys.path to debug level.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 22448
diff changeset
431 ("install-base or install-platbase supplied, but "
d7bd7b7329a7 Move warning about directory not on sys.path to debug level.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 22448
diff changeset
432 "installation scheme is incomplete")
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
433 return
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
434
46698
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
435 if self.user:
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
436 if self.install_userbase is None:
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
437 raise DistutilsPlatformError(
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
438 "User base directory is not specified")
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
439 self.install_base = self.install_platbase = self.install_userbase
58450
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
440 self.select_scheme("posix_user")
46698
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
441 elif self.home is not None:
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
442 self.install_base = self.install_platbase = self.home
58450
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
443 self.select_scheme("posix_home")
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
444 else:
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
445 if self.prefix is None:
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
446 if self.exec_prefix is not None:
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
447 raise DistutilsOptionError, \
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
448 "must not supply exec-prefix without prefix"
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
449
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
450 self.prefix = os.path.normpath(sys.prefix)
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
451 self.exec_prefix = os.path.normpath(sys.exec_prefix)
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
452
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
453 else:
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
454 if self.exec_prefix is None:
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
455 self.exec_prefix = self.prefix
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
456
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
457 self.install_base = self.prefix
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
458 self.install_platbase = self.exec_prefix
58450
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
459 self.select_scheme("posix_prefix")
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
460
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
461 def finalize_other(self):
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
462 """Finalizes options for non-posix platforms"""
46698
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
463 if self.user:
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
464 if self.install_userbase is None:
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
465 raise DistutilsPlatformError(
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
466 "User base directory is not specified")
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
467 self.install_base = self.install_platbase = self.install_userbase
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
468 self.select_scheme(os.name + "_user")
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
469 elif self.home is not None:
32408
e0a7c461311b Make distutils "install --home" support all platforms.
Fred Drake <fdrake@acm.org>
parents: 31777
diff changeset
470 self.install_base = self.install_platbase = self.home
58450
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
471 self.select_scheme("posix_home")
32408
e0a7c461311b Make distutils "install --home" support all platforms.
Fred Drake <fdrake@acm.org>
parents: 31777
diff changeset
472 else:
e0a7c461311b Make distutils "install --home" support all platforms.
Fred Drake <fdrake@acm.org>
parents: 31777
diff changeset
473 if self.prefix is None:
e0a7c461311b Make distutils "install --home" support all platforms.
Fred Drake <fdrake@acm.org>
parents: 31777
diff changeset
474 self.prefix = os.path.normpath(sys.prefix)
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
475
32408
e0a7c461311b Make distutils "install --home" support all platforms.
Fred Drake <fdrake@acm.org>
parents: 31777
diff changeset
476 self.install_base = self.install_platbase = self.prefix
e0a7c461311b Make distutils "install --home" support all platforms.
Fred Drake <fdrake@acm.org>
parents: 31777
diff changeset
477 try:
e0a7c461311b Make distutils "install --home" support all platforms.
Fred Drake <fdrake@acm.org>
parents: 31777
diff changeset
478 self.select_scheme(os.name)
e0a7c461311b Make distutils "install --home" support all platforms.
Fred Drake <fdrake@acm.org>
parents: 31777
diff changeset
479 except KeyError:
e0a7c461311b Make distutils "install --home" support all platforms.
Fred Drake <fdrake@acm.org>
parents: 31777
diff changeset
480 raise DistutilsPlatformError, \
e0a7c461311b Make distutils "install --home" support all platforms.
Fred Drake <fdrake@acm.org>
parents: 31777
diff changeset
481 "I don't know how to install stuff on '%s'" % os.name
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
482
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
483 def select_scheme(self, name):
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
484 """Sets the install directories by applying the install schemes."""
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
485 # it's the caller's problem if they supply a bad name!
58450
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
486 scheme = get_paths(name, expand=False)
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
487 for key, value in scheme.items():
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
488 if key == 'platinclude':
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
489 key = 'headers'
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
490 value = os.path.join(value, self.distribution.get_name())
12681
bdae6b90934f Fixed 'select_scheme()' so it doesn't override a directory attribute that's
Gregory P. Smith <greg@mad-scientist.com>
parents: 12680
diff changeset
491 attrname = 'install_' + key
58450
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
492 if hasattr(self, attrname):
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
493 if getattr(self, attrname) is None:
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
494 setattr(self, attrname, value)
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
495
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
496 def _expand_attrs(self, attrs):
12498
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
497 for attr in attrs:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
498 val = getattr(self, attr)
12498
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
499 if val is not None:
46698
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
500 if os.name == 'posix' or os.name == 'nt':
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
501 val = os.path.expanduser(val)
58450
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
502 try:
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
503 val = _subst_vars(val, self.config_vars)
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
504 except:
fa69e891edf4 taking sysconfig out of distutils
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 54557
diff changeset
505 import pdb; pdb.set_trace()
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
506 setattr(self, attr, val)
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
507
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
508 def expand_basedirs(self):
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
509 """Calls `os.path.expanduser` on install_base, install_platbase and
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
510 root."""
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
511 self._expand_attrs(['install_base', 'install_platbase', 'root'])
12498
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
512
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
513 def expand_dirs(self):
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
514 """Calls `os.path.expanduser` on install dirs."""
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
515 self._expand_attrs(['install_purelib', 'install_platlib',
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
516 'install_lib', 'install_headers',
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
517 'install_scripts', 'install_data',])
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
518
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
519 def convert_paths(self, *names):
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
520 """Call `convert_path` over `names`."""
14744
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
521 for name in names:
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
522 attr = "install_" + name
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
523 setattr(self, attr, convert_path(getattr(self, attr)))
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
524
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
525 def handle_extra_path(self):
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
526 """Set `path_file` and `extra_dirs` using `extra_path`."""
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
527 if self.extra_path is None:
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
528 self.extra_path = self.distribution.extra_path
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
529
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
530 if self.extra_path is not None:
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
531 if isinstance(self.extra_path, str):
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
532 self.extra_path = self.extra_path.split(',')
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
533
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
534 if len(self.extra_path) == 1:
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
535 path_file = extra_dirs = self.extra_path[0]
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
536 elif len(self.extra_path) == 2:
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
537 path_file, extra_dirs = self.extra_path
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
538 else:
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
539 raise DistutilsOptionError, \
23688
d7bd7b7329a7 Move warning about directory not on sys.path to debug level.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 22448
diff changeset
540 ("'extra_path' option must be a list, tuple, or "
d7bd7b7329a7 Move warning about directory not on sys.path to debug level.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 22448
diff changeset
541 "comma-separated string with 1 or 2 elements")
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
542
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
543 # convert to local form in case Unix notation used (as it
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
544 # should be in setup scripts)
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
545 extra_dirs = convert_path(extra_dirs)
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
546 else:
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
547 path_file = None
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
548 extra_dirs = ''
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
549
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
550 # XXX should we warn if path_file and not extra_dirs? (in which
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
551 # case the path file would be harmless but pointless)
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
552 self.path_file = path_file
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
553 self.extra_dirs = extra_dirs
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
554
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
555 def change_roots(self, *names):
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
556 """Change the install direcories pointed by name using root."""
14744
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
557 for name in names:
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
558 attr = "install_" + name
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
559 setattr(self, attr, change_root(self.root, getattr(self, attr)))
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
560
46698
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
561 def create_home_path(self):
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
562 """Create directories under ~."""
46698
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
563 if not self.user:
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
564 return
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
565 home = convert_path(os.path.expanduser("~"))
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
566 for name, path in self.config_vars.iteritems():
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
567 if path.startswith(home) and not os.path.isdir(path):
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
568 self.debug_print("os.makedirs('%s', 0700)" % path)
1a2dbc84bdfc Implemented PEP 370
Christian Heimes <christian@cheimes.de>
parents: 46331
diff changeset
569 os.makedirs(path, 0700)
14744
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
570
14939
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
571 # -- Command execution methods -------------------------------------
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
572
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
573 def run(self):
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
574 """Runs the command."""
10928
5ed9a2dd18d9 Hacked 'set_final_options()' to set (hopefully) appropriate values for
Greg Ward <gward@python.net>
parents: 10807
diff changeset
575 # Obviously have to build before we can install
12680
b89da202d18d Added --skip-build option, so lazy debuggers/testers (mainly me) don't
Gregory P. Smith <greg@mad-scientist.com>
parents: 12675
diff changeset
576 if not self.skip_build:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
577 self.run_command('build')
46331
a93d2919ea59 Issue #2513: enable 64bit cross compilation on windows.
Mark Hammond <mhammond@skippinet.com.au>
parents: 45468
diff changeset
578 # If we built for any other platform, we can't install.
a93d2919ea59 Issue #2513: enable 64bit cross compilation on windows.
Mark Hammond <mhammond@skippinet.com.au>
parents: 45468
diff changeset
579 build_plat = self.distribution.get_command_obj('build').plat_name
a93d2919ea59 Issue #2513: enable 64bit cross compilation on windows.
Mark Hammond <mhammond@skippinet.com.au>
parents: 45468
diff changeset
580 # check warn_dir - it is a clue that the 'install' is happening
a93d2919ea59 Issue #2513: enable 64bit cross compilation on windows.
Mark Hammond <mhammond@skippinet.com.au>
parents: 45468
diff changeset
581 # internally, and not to sys.path, so we don't check the platform
a93d2919ea59 Issue #2513: enable 64bit cross compilation on windows.
Mark Hammond <mhammond@skippinet.com.au>
parents: 45468
diff changeset
582 # matches what we are running.
a93d2919ea59 Issue #2513: enable 64bit cross compilation on windows.
Mark Hammond <mhammond@skippinet.com.au>
parents: 45468
diff changeset
583 if self.warn_dir and build_plat != get_platform():
a93d2919ea59 Issue #2513: enable 64bit cross compilation on windows.
Mark Hammond <mhammond@skippinet.com.au>
parents: 45468
diff changeset
584 raise DistutilsPlatformError("Can't install when "
a93d2919ea59 Issue #2513: enable 64bit cross compilation on windows.
Mark Hammond <mhammond@skippinet.com.au>
parents: 45468
diff changeset
585 "cross-compiling")
10928
5ed9a2dd18d9 Hacked 'set_final_options()' to set (hopefully) appropriate values for
Greg Ward <gward@python.net>
parents: 10807
diff changeset
586
12722
052afb74952e Changed the semantics of the 'sub_commands' list: instead of function
Greg Ward <gward@python.net>
parents: 12698
diff changeset
587 # Run all sub-commands (at least those that need to be run)
052afb74952e Changed the semantics of the 'sub_commands' list: instead of function
Greg Ward <gward@python.net>
parents: 12698
diff changeset
588 for cmd_name in self.get_sub_commands():
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
589 self.run_command(cmd_name)
11302
8028908a9889 Added 'install_path' option for giving non-packagized module
Greg Ward <gward@python.net>
parents: 11282
diff changeset
590
8028908a9889 Added 'install_path' option for giving non-packagized module
Greg Ward <gward@python.net>
parents: 11282
diff changeset
591 if self.path_file:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
592 self.create_path_file()
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
593
12694
a94269bd6585 Harry Henry Gebel: add the "--record" option to write the list of
Gregory P. Smith <greg@mad-scientist.com>
parents: 12681
diff changeset
594 # write list of installed files, if requested.
a94269bd6585 Harry Henry Gebel: add the "--record" option to write the list of
Gregory P. Smith <greg@mad-scientist.com>
parents: 12681
diff changeset
595 if self.record:
a94269bd6585 Harry Henry Gebel: add the "--record" option to write the list of
Gregory P. Smith <greg@mad-scientist.com>
parents: 12681
diff changeset
596 outputs = self.get_outputs()
12697
902800d8e8be Ditch the explicit search for *.py[co] files -- they're now included in
Gregory P. Smith <greg@mad-scientist.com>
parents: 12695
diff changeset
597 if self.root: # strip any package prefix
12694
a94269bd6585 Harry Henry Gebel: add the "--record" option to write the list of
Gregory P. Smith <greg@mad-scientist.com>
parents: 12681
diff changeset
598 root_len = len(self.root)
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
599 for counter in xrange(len(outputs)):
12694
a94269bd6585 Harry Henry Gebel: add the "--record" option to write the list of
Gregory P. Smith <greg@mad-scientist.com>
parents: 12681
diff changeset
600 outputs[counter] = outputs[counter][root_len:]
a94269bd6585 Harry Henry Gebel: add the "--record" option to write the list of
Gregory P. Smith <greg@mad-scientist.com>
parents: 12681
diff changeset
601 self.execute(write_file,
12698
eb1718c5a56c Made the '--record' option take an argument, which is the name of the
Gregory P. Smith <greg@mad-scientist.com>
parents: 12697
diff changeset
602 (self.record, outputs),
eb1718c5a56c Made the '--record' option take an argument, which is the name of the
Gregory P. Smith <greg@mad-scientist.com>
parents: 12697
diff changeset
603 "writing list of installed files to '%s'" %
eb1718c5a56c Made the '--record' option take an argument, which is the name of the
Gregory P. Smith <greg@mad-scientist.com>
parents: 12697
diff changeset
604 self.record)
12695
a48b60b6eb48 Moved check for installation to non-sys.path location so it comes
Gregory P. Smith <greg@mad-scientist.com>
parents: 12694
diff changeset
605
15214
7d45249b1477 Lyle Johnson: use 'normcase()' in addition to 'normpath()' when testing if
Greg Ward <gward@python.net>
parents: 14983
diff changeset
606 sys_path = map(os.path.normpath, sys.path)
15216
a3975d2811f0 Untabified.
Greg Ward <gward@python.net>
parents: 15214
diff changeset
607 sys_path = map(os.path.normcase, sys_path)
15214
7d45249b1477 Lyle Johnson: use 'normcase()' in addition to 'normpath()' when testing if
Greg Ward <gward@python.net>
parents: 14983
diff changeset
608 install_lib = os.path.normcase(os.path.normpath(self.install_lib))
14744
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
609 if (self.warn_dir and
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
610 not (self.path_file and self.install_path_file) and
15214
7d45249b1477 Lyle Johnson: use 'normcase()' in addition to 'normpath()' when testing if
Greg Ward <gward@python.net>
parents: 14983
diff changeset
611 install_lib not in sys_path):
23688
d7bd7b7329a7 Move warning about directory not on sys.path to debug level.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 22448
diff changeset
612 log.debug(("modules installed to '%s', which is not in "
32736
c3a096bfbd6b Whitespace normalization, via reindent.py.
Tim Peters <tim.peters@gmail.com>
parents: 32408
diff changeset
613 "Python's module search path (sys.path) -- "
23688
d7bd7b7329a7 Move warning about directory not on sys.path to debug level.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 22448
diff changeset
614 "you'll have to change the search path yourself"),
d7bd7b7329a7 Move warning about directory not on sys.path to debug level.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 22448
diff changeset
615 self.install_lib)
12694
a94269bd6585 Harry Henry Gebel: add the "--record" option to write the list of
Gregory P. Smith <greg@mad-scientist.com>
parents: 12681
diff changeset
616
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
617 def create_path_file(self):
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
618 """Creates the .pth file"""
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
619 filename = os.path.join(self.install_libbase,
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
620 self.path_file + ".pth")
14939
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
621 if self.install_path_file:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
622 self.execute(write_file,
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
623 (filename, [self.extra_dirs]),
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
624 "creating %s" % filename)
14939
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
625 else:
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
626 self.warn("path file '%s' not created" % filename)
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
627
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
628
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
629 # -- Reporting methods ---------------------------------------------
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
630
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
631 def get_outputs(self):
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
632 """Assembles the outputs of all the sub-commands."""
14939
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
633 outputs = []
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
634 for cmd_name in self.get_sub_commands():
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
635 cmd = self.get_finalized_command(cmd_name)
15922
fda9f86dc4e8 Modified version of a patch from Jeremy Kloth, to make .get_outputs()
Andrew M. Kuchling <amk@amk.ca>
parents: 15632
diff changeset
636 # Add the contents of cmd.get_outputs(), ensuring
fda9f86dc4e8 Modified version of a patch from Jeremy Kloth, to make .get_outputs()
Andrew M. Kuchling <amk@amk.ca>
parents: 15632
diff changeset
637 # that outputs doesn't contain duplicate entries
fda9f86dc4e8 Modified version of a patch from Jeremy Kloth, to make .get_outputs()
Andrew M. Kuchling <amk@amk.ca>
parents: 15632
diff changeset
638 for filename in cmd.get_outputs():
fda9f86dc4e8 Modified version of a patch from Jeremy Kloth, to make .get_outputs()
Andrew M. Kuchling <amk@amk.ca>
parents: 15632
diff changeset
639 if filename not in outputs:
fda9f86dc4e8 Modified version of a patch from Jeremy Kloth, to make .get_outputs()
Andrew M. Kuchling <amk@amk.ca>
parents: 15632
diff changeset
640 outputs.append(filename)
14939
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
641
19699
2a4e3c9285b5 [Bug #436732] install.py does not record a created *.pth file in the
Andrew M. Kuchling <amk@amk.ca>
parents: 19453
diff changeset
642 if self.path_file and self.install_path_file:
2a4e3c9285b5 [Bug #436732] install.py does not record a created *.pth file in the
Andrew M. Kuchling <amk@amk.ca>
parents: 19453
diff changeset
643 outputs.append(os.path.join(self.install_libbase,
2a4e3c9285b5 [Bug #436732] install.py does not record a created *.pth file in the
Andrew M. Kuchling <amk@amk.ca>
parents: 19453
diff changeset
644 self.path_file + ".pth"))
21268
d296e6bb17e5 Whitespace normalization.
Fred Drake <fdrake@acm.org>
parents: 19699
diff changeset
645
14939
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
646 return outputs
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
647
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
648 def get_inputs(self):
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
649 """Returns the inputs of all the sub-commands"""
14939
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
650 # XXX gee, this looks familiar ;-(
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
651 inputs = []
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
652 for cmd_name in self.get_sub_commands():
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
653 cmd = self.get_finalized_command(cmd_name)
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
654 inputs.extend(cmd.get_inputs())
14939
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
655
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
656 return inputs
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
657
14625
af36ba5061f6 Factored the "sub-command" machinery out to Command. Mainly, this
Greg Ward <gward@python.net>
parents: 14614
diff changeset
658 # -- Predicates for sub-command list -------------------------------
af36ba5061f6 Factored the "sub-command" machinery out to Command. Mainly, this
Greg Ward <gward@python.net>
parents: 14614
diff changeset
659
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
660 def has_lib(self):
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
661 """Returns true if the current distribution has any Python
12722
052afb74952e Changed the semantics of the 'sub_commands' list: instead of function
Greg Ward <gward@python.net>
parents: 12698
diff changeset
662 modules to install."""
052afb74952e Changed the semantics of the 'sub_commands' list: instead of function
Greg Ward <gward@python.net>
parents: 12698
diff changeset
663 return (self.distribution.has_pure_modules() or
052afb74952e Changed the semantics of the 'sub_commands' list: instead of function
Greg Ward <gward@python.net>
parents: 12698
diff changeset
664 self.distribution.has_ext_modules())
052afb74952e Changed the semantics of the 'sub_commands' list: instead of function
Greg Ward <gward@python.net>
parents: 12698
diff changeset
665
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
666 def has_headers(self):
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
667 """Returns true if the current distribution has any headers to
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
668 install."""
12777
38da864a0c80 Support for the "install_headers" command:
Greg Ward <gward@python.net>
parents: 12743
diff changeset
669 return self.distribution.has_headers()
38da864a0c80 Support for the "install_headers" command:
Greg Ward <gward@python.net>
parents: 12743
diff changeset
670
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
671 def has_scripts(self):
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
672 """Returns true if the current distribution has any scripts to.
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
673 install."""
12722
052afb74952e Changed the semantics of the 'sub_commands' list: instead of function
Greg Ward <gward@python.net>
parents: 12698
diff changeset
674 return self.distribution.has_scripts()
052afb74952e Changed the semantics of the 'sub_commands' list: instead of function
Greg Ward <gward@python.net>
parents: 12698
diff changeset
675
54557
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
676 def has_data(self):
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
677 """Returns true if the current distribution has any data to.
7df2929a3d06 improved test coverage for distutils.command.install and cleaned it up
Tarek Ziadé <ziade.tarek@gmail.com>
parents: 51890
diff changeset
678 install."""
12722
052afb74952e Changed the semantics of the 'sub_commands' list: instead of function
Greg Ward <gward@python.net>
parents: 12698
diff changeset
679 return self.distribution.has_data_files()
052afb74952e Changed the semantics of the 'sub_commands' list: instead of function
Greg Ward <gward@python.net>
parents: 12698
diff changeset
680
14625
af36ba5061f6 Factored the "sub-command" machinery out to Command. Mainly, this
Greg Ward <gward@python.net>
parents: 14614
diff changeset
681 # 'sub_commands': a list of commands this command might have to run to
af36ba5061f6 Factored the "sub-command" machinery out to Command. Mainly, this
Greg Ward <gward@python.net>
parents: 14614
diff changeset
682 # get its work done. See cmd.py for more info.
af36ba5061f6 Factored the "sub-command" machinery out to Command. Mainly, this
Greg Ward <gward@python.net>
parents: 14614
diff changeset
683 sub_commands = [('install_lib', has_lib),
af36ba5061f6 Factored the "sub-command" machinery out to Command. Mainly, this
Greg Ward <gward@python.net>
parents: 14614
diff changeset
684 ('install_headers', has_headers),
af36ba5061f6 Factored the "sub-command" machinery out to Command. Mainly, this
Greg Ward <gward@python.net>
parents: 14614
diff changeset
685 ('install_scripts', has_scripts),
af36ba5061f6 Factored the "sub-command" machinery out to Command. Mainly, this
Greg Ward <gward@python.net>
parents: 14614
diff changeset
686 ('install_data', has_data),
37253
93344da76acd Patch #1459476: install PKG-INFO metadata alongside distutils-installed packages.
Phillip J. Eby <pje@telecommunity.com>
parents: 34472
diff changeset
687 ('install_egg_info', lambda self:True),
14625
af36ba5061f6 Factored the "sub-command" machinery out to Command. Mainly, this
Greg Ward <gward@python.net>
parents: 14614
diff changeset
688 ]