annotate Lib/distutils/command/install.py @ 17322:bd110eadc19a legacy-trunk

One-liner critical fix from Jim Fulton: Eric's string-method crusade got the order backwards in a line (for .find()).
author Tim Peters <tim.peters@gmail.com>
date Thu, 05 Apr 2001 22:26:23 +0000
parents fda9f86dc4e8
children 8c378f9086cd
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
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
5 # created 1999/03/13, Greg Ward
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
6
11897
017e592c0fd2 Changed '__rcsid__' to '__revision__'.
Greg Ward <gward@python.net>
parents: 11859
diff changeset
7 __revision__ = "$Id$"
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
8
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
9 import sys, os, string
11302
8028908a9889 Added 'install_path' option for giving non-packagized module
Greg Ward <gward@python.net>
parents: 11282
diff changeset
10 from types import *
12786
f768d4dad9a6 Only print debugging output if DEBUG (imported from distutils.core) is true.
Greg Ward <gward@python.net>
parents: 12783
diff changeset
11 from distutils.core import Command, DEBUG
14575
ba5421ff0256 Adjust to the new sysconfig regime: use 'get_config_vars()' instead
Greg Ward <gward@python.net>
parents: 14540
diff changeset
12 from distutils.sysconfig import get_config_vars
13871
8307446bc6aa Fixed imports from '*util' modules to not just import everything from util.
Greg Ward <gward@python.net>
parents: 13003
diff changeset
13 from distutils.file_util import write_file
8307446bc6aa Fixed imports from '*util' modules to not just import everything from util.
Greg Ward <gward@python.net>
parents: 13003
diff changeset
14 from distutils.util import convert_path, subst_vars, change_root
11859
2d8740647e99 Unfinished, untested implementation of the lovely baroque installation scheme
Greg Ward <gward@python.net>
parents: 11817
diff changeset
15 from distutils.errors import DistutilsOptionError
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
16 from glob import glob
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
17
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
18 INSTALL_SCHEMES = {
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
19 'unix_prefix': {
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
20 'purelib': '$base/lib/python$py_version_short/site-packages',
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
21 'platlib': '$platbase/lib/python$py_version_short/site-packages',
12933
b660ecbeaeb8 Fixed install directory for header files on Unix.
Greg Ward <gward@python.net>
parents: 12804
diff changeset
22 'headers': '$base/include/python$py_version_short/$dist_name',
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
23 'scripts': '$base/bin',
13003
57707dbcc245 Changed the default installation directory for data files (used by
Greg Ward <gward@python.net>
parents: 12980
diff changeset
24 'data' : '$base',
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
25 },
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
26 'unix_home': {
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
27 'purelib': '$base/lib/python',
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
28 'platlib': '$base/lib/python',
12777
38da864a0c80 Support for the "install_headers" command:
Greg Ward <gward@python.net>
parents: 12743
diff changeset
29 'headers': '$base/include/python/$dist_name',
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
30 'scripts': '$base/bin',
13003
57707dbcc245 Changed the default installation directory for data files (used by
Greg Ward <gward@python.net>
parents: 12980
diff changeset
31 'data' : '$base',
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
32 },
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
33 'nt': {
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
34 'purelib': '$base',
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
35 'platlib': '$base',
14744
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
36 'headers': '$base/Include/$dist_name',
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
37 'scripts': '$base/Scripts',
13003
57707dbcc245 Changed the default installation directory for data files (used by
Greg Ward <gward@python.net>
parents: 12980
diff changeset
38 'data' : '$base',
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
39 },
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
40 'mac': {
14744
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
41 'purelib': '$base/Lib/site-packages',
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
42 'platlib': '$base/Lib/site-packages',
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
43 'headers': '$base/Include/$dist_name',
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
44 'scripts': '$base/Scripts',
13003
57707dbcc245 Changed the default installation directory for data files (used by
Greg Ward <gward@python.net>
parents: 12980
diff changeset
45 'data' : '$base',
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
46 }
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
47 }
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
48
14744
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
49 # The keys to an installation scheme; if any new types of files are to be
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
50 # installed, be sure to add an entry to every installation scheme above,
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
51 # and to SCHEME_KEYS here.
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
52 SCHEME_KEYS = ('purelib', 'platlib', 'headers', 'scripts', 'data')
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
53
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
54
11813
eaeda4621f7d Renamed all command classes so they're exactly the same as the name of the
Greg Ward <gward@python.net>
parents: 11683
diff changeset
55 class install (Command):
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
56
11683
47f75a17b103 Added 'description' class attribute to every command class (to help the
Greg Ward <gward@python.net>
parents: 11659
diff changeset
57 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
58
11815
03902bc0214a Renamed all 'options' class attributes to 'user_options'.
Greg Ward <gward@python.net>
parents: 11813
diff changeset
59 user_options = [
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
60 # 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
61 ('prefix=', None,
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
62 "installation prefix"),
11815
03902bc0214a Renamed all 'options' class attributes to 'user_options'.
Greg Ward <gward@python.net>
parents: 11813
diff changeset
63 ('exec-prefix=', None,
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
64 "(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
65 ('home=', None,
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
66 "(Unix only) home directory to install under"),
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
67
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
68 # 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
69 ('install-base=', None,
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
70 "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
71 ('install-platbase=', None,
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
72 "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
73 "(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
74 ('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
75 "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
76
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
77 # 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
78 ('install-purelib=', None,
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
79 "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
80 ('install-platlib=', None,
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
81 "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
82 ('install-lib=', None,
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
83 "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
84 "(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
85
12777
38da864a0c80 Support for the "install_headers" command:
Greg Ward <gward@python.net>
parents: 12743
diff changeset
86 ('install-headers=', None,
38da864a0c80 Support for the "install_headers" command:
Greg Ward <gward@python.net>
parents: 12743
diff changeset
87 "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
88 ('install-scripts=', None,
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
89 "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
90 ('install-data=', None,
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
91 "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
92
14962
9c3aefa5cd7f Added --compile, --optimize options so users have an easy way to
Greg Ward <gward@python.net>
parents: 14948
diff changeset
93 # 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
94 # 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
95 # anything with them).
9c3aefa5cd7f Added --compile, --optimize options so users have an easy way to
Greg Ward <gward@python.net>
parents: 14948
diff changeset
96 ('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
97 ('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
98 ('optimize=', 'O',
9c3aefa5cd7f Added --compile, --optimize options so users have an easy way to
Greg Ward <gward@python.net>
parents: 14948
diff changeset
99 "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
100 "-O2 for \"python -OO\", and -O0 to disable [default: -O0]"),
9c3aefa5cd7f Added --compile, --optimize options so users have an easy way to
Greg Ward <gward@python.net>
parents: 14948
diff changeset
101
14540
35ae8dff8ed0 Added --force (-f) option to force installation (including bytecode
Greg Ward <gward@python.net>
parents: 14537
diff changeset
102 # Miscellaneous control options
35ae8dff8ed0 Added --force (-f) option to force installation (including bytecode
Greg Ward <gward@python.net>
parents: 14537
diff changeset
103 ('force', 'f',
35ae8dff8ed0 Added --force (-f) option to force installation (including bytecode
Greg Ward <gward@python.net>
parents: 14537
diff changeset
104 "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
105 ('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
106 "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
107
11815
03902bc0214a Renamed all 'options' class attributes to 'user_options'.
Greg Ward <gward@python.net>
parents: 11813
diff changeset
108 # 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
109 #('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
110 #('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
111 #('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
112 #('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
113
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
114 ('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
115 "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
116 ]
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
117
14829
b1f220f636ed Added 'boolean_options' list to support config file parsing.
Greg Ward <gward@python.net>
parents: 14744
diff changeset
118 boolean_options = ['force', 'skip-build']
14983
b61cd1a48960 Fixed so --no-compile is a negative alias for --compile.
Greg Ward <gward@python.net>
parents: 14962
diff changeset
119 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
120
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
121
11817
476eaa38e2d6 Renamed 'set_default_options()' to 'initialize_options()', and
Greg Ward <gward@python.net>
parents: 11815
diff changeset
122 def initialize_options (self):
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
123
12039
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
124 # 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
125 # and scheme.
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
126 self.prefix = None
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
127 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
128 self.home = None
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
129
12039
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
130 # 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
131 # 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
132 # 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
133 self.install_base = None
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
134 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
135 self.root = None
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
136
12039
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
137 # 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
138 # 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
139 # 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
140 # 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
141 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
142 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
143 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
144 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
145 self.install_scripts = None
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
146 self.install_data = None
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
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 self.compile = None
15632
19756b918041 Add forgotten initialization. Fixes bug #120994, "Traceback with
Andrew M. Kuchling <amk@amk.ca>
parents: 15216
diff changeset
149 self.no_compile = None
14962
9c3aefa5cd7f Added --compile, --optimize options so users have an easy way to
Greg Ward <gward@python.net>
parents: 14948
diff changeset
150 self.optimize = None
9c3aefa5cd7f Added --compile, --optimize options so users have an easy way to
Greg Ward <gward@python.net>
parents: 14948
diff changeset
151
12039
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
152 # 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
153 # 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
154 # '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
155 # 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
156 # 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
157 # 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
158 # '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
159 # 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
160 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
161 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
162
14744
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
163 # '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
164 # out-of-date. 'skip_build' skips running the "build" command,
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
165 # handy if you know it's not necessary. 'warn_dir' (which is *not*
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
166 # 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
167 # 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
168 # 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
169 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
170 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
171 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
172
12034
23fce9b9f3bc Dropped any notion of allowing the user to specify the build directories:
Greg Ward <gward@python.net>
parents: 12031
diff changeset
173 # 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
174 # '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
175 # 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
176 # 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
177 # 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
178 # build command.
11859
2d8740647e99 Unfinished, untested implementation of the lovely baroque installation scheme
Greg Ward <gward@python.net>
parents: 11817
diff changeset
179 self.build_base = None
2d8740647e99 Unfinished, untested implementation of the lovely baroque installation scheme
Greg Ward <gward@python.net>
parents: 11817
diff changeset
180 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
181
12039
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
182 # 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
183 # documentation yet.
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
184 #self.install_man = None
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
185 #self.install_html = None
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
186 #self.install_info = None
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
187
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
188 self.record = None
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
189
14939
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
190
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
191 # -- Option finalizing methods -------------------------------------
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
192 # (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
193 # 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
194 # 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
195 # 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
196
11817
476eaa38e2d6 Renamed 'set_default_options()' to 'initialize_options()', and
Greg Ward <gward@python.net>
parents: 11815
diff changeset
197 def finalize_options (self):
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
198
12039
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
199 # 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
200 # '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
201 # 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
202 # 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
203 # 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
204 # 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
205 # 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
206 # 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
207 # 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
208 # here.
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
209
12039
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
210 # 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
211 # 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
212
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
213 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
214 (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
215 raise DistutilsOptionError, \
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
216 ("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
217 "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
218
12039
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
219 # Next, stuff that's wrong (or dubious) only on certain platforms.
11859
2d8740647e99 Unfinished, untested implementation of the lovely baroque installation scheme
Greg Ward <gward@python.net>
parents: 11817
diff changeset
220 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
221 if self.home and (self.prefix or self.exec_prefix):
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
222 raise DistutilsOptionError, \
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
223 ("must supply either home or prefix/exec-prefix -- " +
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
224 "not both")
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
225 else:
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
226 if self.exec_prefix:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
227 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
228 self.exec_prefix = None
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
229 if self.home:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
230 self.warn("home 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
231 self.home = None
10928
5ed9a2dd18d9 Hacked 'set_final_options()' to set (hopefully) appropriate values for
Greg Ward <gward@python.net>
parents: 10807
diff changeset
232
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
233 # 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
234 # 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
235 # 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
236 # 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
237 # 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
238 # 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
239 # 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
240
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
241 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
242
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
243 if os.name == 'posix':
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
244 self.finalize_unix()
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
245 else:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
246 self.finalize_other()
11859
2d8740647e99 Unfinished, untested implementation of the lovely baroque installation scheme
Greg Ward <gward@python.net>
parents: 11817
diff changeset
247
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
248 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
249
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
250 # 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
251 # 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
252 # $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
253 # 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
254
12777
38da864a0c80 Support for the "install_headers" command:
Greg Ward <gward@python.net>
parents: 12743
diff changeset
255 py_version = (string.split(sys.version))[0]
14614
33e2ef339e50 Typo fix.
Greg Ward <gward@python.net>
parents: 14575
diff changeset
256 (prefix, exec_prefix) = get_config_vars('prefix', 'exec_prefix')
12777
38da864a0c80 Support for the "install_headers" command:
Greg Ward <gward@python.net>
parents: 12743
diff changeset
257 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
258 'dist_version': self.distribution.get_version(),
38da864a0c80 Support for the "install_headers" command:
Greg Ward <gward@python.net>
parents: 12743
diff changeset
259 'dist_fullname': self.distribution.get_fullname(),
38da864a0c80 Support for the "install_headers" command:
Greg Ward <gward@python.net>
parents: 12743
diff changeset
260 'py_version': py_version,
38da864a0c80 Support for the "install_headers" command:
Greg Ward <gward@python.net>
parents: 12743
diff changeset
261 'py_version_short': py_version[0:3],
14575
ba5421ff0256 Adjust to the new sysconfig regime: use 'get_config_vars()' instead
Greg Ward <gward@python.net>
parents: 14540
diff changeset
262 'sys_prefix': prefix,
ba5421ff0256 Adjust to the new sysconfig regime: use 'get_config_vars()' instead
Greg Ward <gward@python.net>
parents: 14540
diff changeset
263 'prefix': prefix,
ba5421ff0256 Adjust to the new sysconfig regime: use 'get_config_vars()' instead
Greg Ward <gward@python.net>
parents: 14540
diff changeset
264 '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
265 'exec_prefix': exec_prefix,
12498
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
266 }
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
267 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
268
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
269 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
270
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
271 # 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
272 # everything else.
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
273 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
274 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
275
12786
f768d4dad9a6 Only print debugging output if DEBUG (imported from distutils.core) is true.
Greg Ward <gward@python.net>
parents: 12783
diff changeset
276 if DEBUG:
f768d4dad9a6 Only print debugging output if DEBUG (imported from distutils.core) is true.
Greg Ward <gward@python.net>
parents: 12783
diff changeset
277 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
278 print "config vars:"
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
279 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
280
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
281 # 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
282 # directories.
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
283 self.expand_dirs()
11302
8028908a9889 Added 'install_path' option for giving non-packagized module
Greg Ward <gward@python.net>
parents: 11282
diff changeset
284
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
285 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
286
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
287 # 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
288 # 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
289 # 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
290 # 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
291 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
292 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
293 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
294 else:
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
295 self.install_lib = self.install_purelib
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
296
14744
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
297
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
298 # 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
299 # convention.
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
300 self.convert_paths('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
301 'scripts', 'data', 'headers')
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
302
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
303 # 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
304 # 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
305 # 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
306 # get their own directories.
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
307 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
308 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
309 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
310
12508
b76bacccd346 Added the "--root" option as a sort of meta-install-base; if supplied,
Greg Ward <gward@python.net>
parents: 12498
diff changeset
311 # 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
312 # 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
313 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
314 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
315 '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
316
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
317 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
318
12039
740ec08e6ec1 Revised tons of comments to reflect the current state of affairs better.
Greg Ward <gward@python.net>
parents: 12038
diff changeset
319 # 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
320 self.set_undefined_options('build',
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
321 ('build_base', 'build_base'),
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
322 ('build_lib', 'build_lib'))
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
323
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
324 # 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
325 # documentation completely!
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
326
11817
476eaa38e2d6 Renamed 'set_default_options()' to 'initialize_options()', and
Greg Ward <gward@python.net>
parents: 11815
diff changeset
327 # finalize_options ()
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
328
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
329
12508
b76bacccd346 Added the "--root" option as a sort of meta-install-base; if supplied,
Greg Ward <gward@python.net>
parents: 12498
diff changeset
330 def dump_dirs (self, msg):
12786
f768d4dad9a6 Only print debugging output if DEBUG (imported from distutils.core) is true.
Greg Ward <gward@python.net>
parents: 12783
diff changeset
331 if DEBUG:
f768d4dad9a6 Only print debugging output if DEBUG (imported from distutils.core) is true.
Greg Ward <gward@python.net>
parents: 12783
diff changeset
332 from distutils.fancy_getopt import longopt_xlate
f768d4dad9a6 Only print debugging output if DEBUG (imported from distutils.core) is true.
Greg Ward <gward@python.net>
parents: 12783
diff changeset
333 print msg + ":"
f768d4dad9a6 Only print debugging output if DEBUG (imported from distutils.core) is true.
Greg Ward <gward@python.net>
parents: 12783
diff changeset
334 for opt in self.user_options:
f768d4dad9a6 Only print debugging output if DEBUG (imported from distutils.core) is true.
Greg Ward <gward@python.net>
parents: 12783
diff changeset
335 opt_name = opt[0]
f768d4dad9a6 Only print debugging output if DEBUG (imported from distutils.core) is true.
Greg Ward <gward@python.net>
parents: 12783
diff changeset
336 if opt_name[-1] == "=":
f768d4dad9a6 Only print debugging output if DEBUG (imported from distutils.core) is true.
Greg Ward <gward@python.net>
parents: 12783
diff changeset
337 opt_name = opt_name[0:-1]
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
338 opt_name = string.translate(opt_name, longopt_xlate)
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
339 val = getattr(self, opt_name)
12786
f768d4dad9a6 Only print debugging output if DEBUG (imported from distutils.core) is true.
Greg Ward <gward@python.net>
parents: 12783
diff changeset
340 print " %s: %s" % (opt_name, val)
12508
b76bacccd346 Added the "--root" option as a sort of meta-install-base; if supplied,
Greg Ward <gward@python.net>
parents: 12498
diff changeset
341
b76bacccd346 Added the "--root" option as a sort of meta-install-base; if supplied,
Greg Ward <gward@python.net>
parents: 12498
diff changeset
342
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
343 def finalize_unix (self):
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
344
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
345 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
346 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
347 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
348 self.install_platlib is None) or
12777
38da864a0c80 Support for the "install_headers" command:
Greg Ward <gward@python.net>
parents: 12743
diff changeset
349 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
350 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
351 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
352 raise DistutilsOptionError, \
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
353 "install-base or install-platbase supplied, but " + \
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
354 "installation scheme is incomplete"
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
355 return
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
356
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
357 if self.home is not None:
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
358 self.install_base = self.install_platbase = self.home
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
359 self.select_scheme("unix_home")
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
360 else:
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
361 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
362 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
363 raise DistutilsOptionError, \
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
364 "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
365
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
366 self.prefix = os.path.normpath(sys.prefix)
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
367 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
368
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
369 else:
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
370 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
371 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
372
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
373 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
374 self.install_platbase = self.exec_prefix
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
375 self.select_scheme("unix_prefix")
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
376
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
377 # finalize_unix ()
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
378
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
379
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
380 def finalize_other (self): # Windows and Mac OS for now
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
381
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
382 if self.prefix is None:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
383 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
384
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
385 self.install_base = self.install_platbase = self.prefix
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
386 try:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
387 self.select_scheme(os.name)
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
388 except KeyError:
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
389 raise DistutilsPlatformError, \
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
390 "I don't know how to install stuff on '%s'" % os.name
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
391
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
392 # finalize_other ()
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
393
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
394
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
395 def select_scheme (self, name):
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
396 # it's the caller's problem if they supply a bad name!
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
397 scheme = INSTALL_SCHEMES[name]
14744
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
398 for key in SCHEME_KEYS:
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
399 attrname = 'install_' + key
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
400 if getattr(self, attrname) is None:
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
401 setattr(self, attrname, scheme[key])
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
402
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
403
12498
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
404 def _expand_attrs (self, attrs):
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
405 for attr in attrs:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
406 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
407 if val is not None:
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
408 if os.name == 'posix':
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
409 val = os.path.expanduser(val)
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
410 val = subst_vars(val, self.config_vars)
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
411 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
412
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
413
12498
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
414 def expand_basedirs (self):
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
415 self._expand_attrs(['install_base',
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
416 'install_platbase',
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
417 'root'])
12498
0d75555ed6eb Hacked things up a bit so that configuration variables are expanded
Greg Ward <gward@python.net>
parents: 12153
diff changeset
418
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
419 def expand_dirs (self):
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
420 self._expand_attrs(['install_purelib',
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
421 'install_platlib',
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
422 'install_lib',
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
423 'install_headers',
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
424 'install_scripts',
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
425 'install_data',])
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
426
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
427
14744
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
428 def convert_paths (self, *names):
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
429 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
430 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
431 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
432
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
433
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
434 def handle_extra_path (self):
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
435
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
436 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
437 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
438
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
439 if self.extra_path is not None:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
440 if type(self.extra_path) is StringType:
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
441 self.extra_path = string.split(self.extra_path, ',')
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
442
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
443 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
444 path_file = extra_dirs = self.extra_path[0]
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
445 elif len(self.extra_path) == 2:
12031
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
446 (path_file, extra_dirs) = self.extra_path
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
447 else:
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
448 raise DistutilsOptionError, \
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
449 "'extra_path' option must be a list, tuple, or " + \
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
450 "comma-separated string with 1 or 2 elements"
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
451
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
452 # 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
453 # should be in setup scripts)
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
454 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
455
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
456 else:
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
457 path_file = None
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
458 extra_dirs = ''
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
459
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
460 # 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
461 # 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
462 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
463 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
464
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
465 # handle_extra_path ()
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
466
a05d8338fac5 Yet another complete rewrite. Hopefully the *last* complete rewrite of
Greg Ward <gward@python.net>
parents: 11897
diff changeset
467
14744
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
468 def change_roots (self, *names):
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
469 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
470 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
471 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
472
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
473
14939
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
474 # -- Command execution methods -------------------------------------
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
475
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
476 def run (self):
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
477
10928
5ed9a2dd18d9 Hacked 'set_final_options()' to set (hopefully) appropriate values for
Greg Ward <gward@python.net>
parents: 10807
diff changeset
478 # 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
479 if not self.skip_build:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
480 self.run_command('build')
10928
5ed9a2dd18d9 Hacked 'set_final_options()' to set (hopefully) appropriate values for
Greg Ward <gward@python.net>
parents: 10807
diff changeset
481
12722
052afb74952e Changed the semantics of the 'sub_commands' list: instead of function
Greg Ward <gward@python.net>
parents: 12698
diff changeset
482 # 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
483 for cmd_name in self.get_sub_commands():
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
484 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
485
8028908a9889 Added 'install_path' option for giving non-packagized module
Greg Ward <gward@python.net>
parents: 11282
diff changeset
486 if self.path_file:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
487 self.create_path_file()
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
488
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
489 # 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
490 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
491 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
492 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
493 root_len = len(self.root)
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
494 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
495 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
496 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
497 (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
498 "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
499 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
500
15214
7d45249b1477 Lyle Johnson: use 'normcase()' in addition to 'normpath()' when testing if
Greg Ward <gward@python.net>
parents: 14983
diff changeset
501 sys_path = map(os.path.normpath, sys.path)
15216
a3975d2811f0 Untabified.
Greg Ward <gward@python.net>
parents: 15214
diff changeset
502 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
503 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
504 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
505 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
506 install_lib not in sys_path):
14744
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
507 self.warn(("modules installed to '%s', which is not in " +
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
508 "Python's module search path (sys.path) -- " +
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
509 "you'll have to change the search path yourself") %
4f95cf1b2664 Changed all paths in the INSTALL_SCHEMES dict to Unix syntax, and added
Greg Ward <gward@python.net>
parents: 14625
diff changeset
510 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
511
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
512 # run ()
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
513
14939
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
514 def create_path_file (self):
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
515 filename = os.path.join(self.install_libbase,
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
516 self.path_file + ".pth")
14939
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
517 if self.install_path_file:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
518 self.execute(write_file,
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
519 (filename, [self.extra_dirs]),
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
520 "creating %s" % filename)
14939
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
521 else:
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
522 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
523
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
524
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
525 # -- Reporting methods ---------------------------------------------
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
526
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
527 def get_outputs (self):
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
528 # This command doesn't have any outputs of its own, so just
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
529 # get the outputs of all its sub-commands.
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
530 outputs = []
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
531 for cmd_name in self.get_sub_commands():
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
532 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
533 # 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
534 # 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
535 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
536 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
537 outputs.append(filename)
14939
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
538
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
539 return outputs
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
540
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
541 def get_inputs (self):
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
542 # XXX gee, this looks familiar ;-(
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
543 inputs = []
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
544 for cmd_name in self.get_sub_commands():
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
545 cmd = self.get_finalized_command(cmd_name)
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14939
diff changeset
546 inputs.extend(cmd.get_inputs())
14939
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
547
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
548 return inputs
1629ef738b2f Moved some things around for better organization.
Greg Ward <gward@python.net>
parents: 14829
diff changeset
549
11302
8028908a9889 Added 'install_path' option for giving non-packagized module
Greg Ward <gward@python.net>
parents: 11282
diff changeset
550
14625
af36ba5061f6 Factored the "sub-command" machinery out to Command. Mainly, this
Greg Ward <gward@python.net>
parents: 14614
diff changeset
551 # -- 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
552
12722
052afb74952e Changed the semantics of the 'sub_commands' list: instead of function
Greg Ward <gward@python.net>
parents: 12698
diff changeset
553 def has_lib (self):
052afb74952e Changed the semantics of the 'sub_commands' list: instead of function
Greg Ward <gward@python.net>
parents: 12698
diff changeset
554 """Return true if the current distribution has any Python
052afb74952e Changed the semantics of the 'sub_commands' list: instead of function
Greg Ward <gward@python.net>
parents: 12698
diff changeset
555 modules to install."""
052afb74952e Changed the semantics of the 'sub_commands' list: instead of function
Greg Ward <gward@python.net>
parents: 12698
diff changeset
556 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
557 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
558
12777
38da864a0c80 Support for the "install_headers" command:
Greg Ward <gward@python.net>
parents: 12743
diff changeset
559 def has_headers (self):
38da864a0c80 Support for the "install_headers" command:
Greg Ward <gward@python.net>
parents: 12743
diff changeset
560 return self.distribution.has_headers()
38da864a0c80 Support for the "install_headers" command:
Greg Ward <gward@python.net>
parents: 12743
diff changeset
561
12722
052afb74952e Changed the semantics of the 'sub_commands' list: instead of function
Greg Ward <gward@python.net>
parents: 12698
diff changeset
562 def has_scripts (self):
052afb74952e Changed the semantics of the 'sub_commands' list: instead of function
Greg Ward <gward@python.net>
parents: 12698
diff changeset
563 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
564
052afb74952e Changed the semantics of the 'sub_commands' list: instead of function
Greg Ward <gward@python.net>
parents: 12698
diff changeset
565 def has_data (self):
052afb74952e Changed the semantics of the 'sub_commands' list: instead of function
Greg Ward <gward@python.net>
parents: 12698
diff changeset
566 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
567
052afb74952e Changed the semantics of the 'sub_commands' list: instead of function
Greg Ward <gward@python.net>
parents: 12698
diff changeset
568
14625
af36ba5061f6 Factored the "sub-command" machinery out to Command. Mainly, this
Greg Ward <gward@python.net>
parents: 14614
diff changeset
569 # '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
570 # 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
571 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
572 ('install_headers', has_headers),
af36ba5061f6 Factored the "sub-command" machinery out to Command. Mainly, this
Greg Ward <gward@python.net>
parents: 14614
diff changeset
573 ('install_scripts', has_scripts),
af36ba5061f6 Factored the "sub-command" machinery out to Command. Mainly, this
Greg Ward <gward@python.net>
parents: 14614
diff changeset
574 ('install_data', has_data),
af36ba5061f6 Factored the "sub-command" machinery out to Command. Mainly, this
Greg Ward <gward@python.net>
parents: 14614
diff changeset
575 ]
af36ba5061f6 Factored the "sub-command" machinery out to Command. Mainly, this
Greg Ward <gward@python.net>
parents: 14614
diff changeset
576
12743
e878a647e06e Normalized all the end-of-class lines.
Greg Ward <gward@python.net>
parents: 12722
diff changeset
577 # class install