]> git.proxmox.com Git - mirror_edk2.git/blame - AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/command/install.py
EmbeddedPkg: Extend NvVarStoreFormattedLib LIBRARY_CLASS
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.2 / Lib / distutils / command / install.py
CommitLineData
4710c53d 1"""distutils.command.install\r
2\r
3Implements the Distutils 'install' command."""\r
4\r
5from distutils import log\r
6\r
7# This module should be kept compatible with Python 2.1.\r
8\r
9__revision__ = "$Id$"\r
10\r
11import sys, os, string\r
12from types import *\r
13from distutils.core import Command\r
14from distutils.debug import DEBUG\r
15from distutils.sysconfig import get_config_vars\r
16from distutils.errors import DistutilsPlatformError\r
17from distutils.file_util import write_file\r
18from distutils.util import convert_path, subst_vars, change_root\r
19from distutils.util import get_platform\r
20from distutils.errors import DistutilsOptionError\r
21from site import USER_BASE\r
22from site import USER_SITE\r
23\r
24\r
25if sys.version < "2.2":\r
26 WINDOWS_SCHEME = {\r
27 'purelib': '$base',\r
28 'platlib': '$base',\r
29 'headers': '$base/Include/$dist_name',\r
30 'scripts': '$base/Scripts',\r
31 'data' : '$base',\r
32 }\r
33else:\r
34 WINDOWS_SCHEME = {\r
35 'purelib': '$base/Lib/site-packages',\r
36 'platlib': '$base/Lib/site-packages',\r
37 'headers': '$base/Include/$dist_name',\r
38 'scripts': '$base/Scripts',\r
39 'data' : '$base',\r
40 }\r
41\r
42INSTALL_SCHEMES = {\r
43 'unix_prefix': {\r
44 'purelib': '$base/lib/python$py_version_short/site-packages',\r
45 'platlib': '$platbase/lib/python$py_version_short/site-packages',\r
46 'headers': '$base/include/python$py_version_short/$dist_name',\r
47 'scripts': '$base/bin',\r
48 'data' : '$base',\r
49 },\r
50 'unix_home': {\r
51 'purelib': '$base/lib/python',\r
52 'platlib': '$base/lib/python',\r
53 'headers': '$base/include/python/$dist_name',\r
54 'scripts': '$base/bin',\r
55 'data' : '$base',\r
56 },\r
57 'unix_user': {\r
58 'purelib': '$usersite',\r
59 'platlib': '$usersite',\r
60 'headers': '$userbase/include/python$py_version_short/$dist_name',\r
61 'scripts': '$userbase/bin',\r
62 'data' : '$userbase',\r
63 },\r
64 'nt': WINDOWS_SCHEME,\r
65 'nt_user': {\r
66 'purelib': '$usersite',\r
67 'platlib': '$usersite',\r
68 'headers': '$userbase/Python$py_version_nodot/Include/$dist_name',\r
69 'scripts': '$userbase/Scripts',\r
70 'data' : '$userbase',\r
71 },\r
72 'os2': {\r
73 'purelib': '$base/Lib/site-packages',\r
74 'platlib': '$base/Lib/site-packages',\r
75 'headers': '$base/Include/$dist_name',\r
76 'scripts': '$base/Scripts',\r
77 'data' : '$base',\r
78 },\r
79 'os2_home': {\r
80 'purelib': '$usersite',\r
81 'platlib': '$usersite',\r
82 'headers': '$userbase/include/python$py_version_short/$dist_name',\r
83 'scripts': '$userbase/bin',\r
84 'data' : '$userbase',\r
85 },\r
86 }\r
87\r
88# The keys to an installation scheme; if any new types of files are to be\r
89# installed, be sure to add an entry to every installation scheme above,\r
90# and to SCHEME_KEYS here.\r
91SCHEME_KEYS = ('purelib', 'platlib', 'headers', 'scripts', 'data')\r
92\r
93\r
94class install (Command):\r
95\r
96 description = "install everything from build directory"\r
97\r
98 user_options = [\r
99 # Select installation scheme and set base director(y|ies)\r
100 ('prefix=', None,\r
101 "installation prefix"),\r
102 ('exec-prefix=', None,\r
103 "(Unix only) prefix for platform-specific files"),\r
104 ('home=', None,\r
105 "(Unix only) home directory to install under"),\r
106 ('user', None,\r
107 "install in user site-package '%s'" % USER_SITE),\r
108\r
109 # Or, just set the base director(y|ies)\r
110 ('install-base=', None,\r
111 "base installation directory (instead of --prefix or --home)"),\r
112 ('install-platbase=', None,\r
113 "base installation directory for platform-specific files " +\r
114 "(instead of --exec-prefix or --home)"),\r
115 ('root=', None,\r
116 "install everything relative to this alternate root directory"),\r
117\r
118 # Or, explicitly set the installation scheme\r
119 ('install-purelib=', None,\r
120 "installation directory for pure Python module distributions"),\r
121 ('install-platlib=', None,\r
122 "installation directory for non-pure module distributions"),\r
123 ('install-lib=', None,\r
124 "installation directory for all module distributions " +\r
125 "(overrides --install-purelib and --install-platlib)"),\r
126\r
127 ('install-headers=', None,\r
128 "installation directory for C/C++ headers"),\r
129 ('install-scripts=', None,\r
130 "installation directory for Python scripts"),\r
131 ('install-data=', None,\r
132 "installation directory for data files"),\r
133\r
134 # Byte-compilation options -- see install_lib.py for details, as\r
135 # these are duplicated from there (but only install_lib does\r
136 # anything with them).\r
137 ('compile', 'c', "compile .py to .pyc [default]"),\r
138 ('no-compile', None, "don't compile .py files"),\r
139 ('optimize=', 'O',\r
140 "also compile with optimization: -O1 for \"python -O\", "\r
141 "-O2 for \"python -OO\", and -O0 to disable [default: -O0]"),\r
142\r
143 # Miscellaneous control options\r
144 ('force', 'f',\r
145 "force installation (overwrite any existing files)"),\r
146 ('skip-build', None,\r
147 "skip rebuilding everything (for testing/debugging)"),\r
148\r
149 # Where to install documentation (eventually!)\r
150 #('doc-format=', None, "format of documentation to generate"),\r
151 #('install-man=', None, "directory for Unix man pages"),\r
152 #('install-html=', None, "directory for HTML documentation"),\r
153 #('install-info=', None, "directory for GNU info files"),\r
154\r
155 ('record=', None,\r
156 "filename in which to record list of installed files"),\r
157 ]\r
158\r
159 boolean_options = ['compile', 'force', 'skip-build', 'user']\r
160 negative_opt = {'no-compile' : 'compile'}\r
161\r
162\r
163 def initialize_options (self):\r
164\r
165 # High-level options: these select both an installation base\r
166 # and scheme.\r
167 self.prefix = None\r
168 self.exec_prefix = None\r
169 self.home = None\r
170 self.user = 0\r
171\r
172 # These select only the installation base; it's up to the user to\r
173 # specify the installation scheme (currently, that means supplying\r
174 # the --install-{platlib,purelib,scripts,data} options).\r
175 self.install_base = None\r
176 self.install_platbase = None\r
177 self.root = None\r
178\r
179 # These options are the actual installation directories; if not\r
180 # supplied by the user, they are filled in using the installation\r
181 # scheme implied by prefix/exec-prefix/home and the contents of\r
182 # that installation scheme.\r
183 self.install_purelib = None # for pure module distributions\r
184 self.install_platlib = None # non-pure (dists w/ extensions)\r
185 self.install_headers = None # for C/C++ headers\r
186 self.install_lib = None # set to either purelib or platlib\r
187 self.install_scripts = None\r
188 self.install_data = None\r
189 self.install_userbase = USER_BASE\r
190 self.install_usersite = USER_SITE\r
191\r
192 self.compile = None\r
193 self.optimize = None\r
194\r
195 # These two are for putting non-packagized distributions into their\r
196 # own directory and creating a .pth file if it makes sense.\r
197 # 'extra_path' comes from the setup file; 'install_path_file' can\r
198 # be turned off if it makes no sense to install a .pth file. (But\r
199 # better to install it uselessly than to guess wrong and not\r
200 # install it when it's necessary and would be used!) Currently,\r
201 # 'install_path_file' is always true unless some outsider meddles\r
202 # with it.\r
203 self.extra_path = None\r
204 self.install_path_file = 1\r
205\r
206 # 'force' forces installation, even if target files are not\r
207 # out-of-date. 'skip_build' skips running the "build" command,\r
208 # handy if you know it's not necessary. 'warn_dir' (which is *not*\r
209 # a user option, it's just there so the bdist_* commands can turn\r
210 # it off) determines whether we warn about installing to a\r
211 # directory not in sys.path.\r
212 self.force = 0\r
213 self.skip_build = 0\r
214 self.warn_dir = 1\r
215\r
216 # These are only here as a conduit from the 'build' command to the\r
217 # 'install_*' commands that do the real work. ('build_base' isn't\r
218 # actually used anywhere, but it might be useful in future.) They\r
219 # are not user options, because if the user told the install\r
220 # command where the build directory is, that wouldn't affect the\r
221 # build command.\r
222 self.build_base = None\r
223 self.build_lib = None\r
224\r
225 # Not defined yet because we don't know anything about\r
226 # documentation yet.\r
227 #self.install_man = None\r
228 #self.install_html = None\r
229 #self.install_info = None\r
230\r
231 self.record = None\r
232\r
233\r
234 # -- Option finalizing methods -------------------------------------\r
235 # (This is rather more involved than for most commands,\r
236 # because this is where the policy for installing third-\r
237 # party Python modules on various platforms given a wide\r
238 # array of user input is decided. Yes, it's quite complex!)\r
239\r
240 def finalize_options (self):\r
241\r
242 # This method (and its pliant slaves, like 'finalize_unix()',\r
243 # 'finalize_other()', and 'select_scheme()') is where the default\r
244 # installation directories for modules, extension modules, and\r
245 # anything else we care to install from a Python module\r
246 # distribution. Thus, this code makes a pretty important policy\r
247 # statement about how third-party stuff is added to a Python\r
248 # installation! Note that the actual work of installation is done\r
249 # by the relatively simple 'install_*' commands; they just take\r
250 # their orders from the installation directory options determined\r
251 # here.\r
252\r
253 # Check for errors/inconsistencies in the options; first, stuff\r
254 # that's wrong on any platform.\r
255\r
256 if ((self.prefix or self.exec_prefix or self.home) and\r
257 (self.install_base or self.install_platbase)):\r
258 raise DistutilsOptionError, \\r
259 ("must supply either prefix/exec-prefix/home or " +\r
260 "install-base/install-platbase -- not both")\r
261\r
262 if self.home and (self.prefix or self.exec_prefix):\r
263 raise DistutilsOptionError, \\r
264 "must supply either home or prefix/exec-prefix -- not both"\r
265\r
266 if self.user and (self.prefix or self.exec_prefix or self.home or\r
267 self.install_base or self.install_platbase):\r
268 raise DistutilsOptionError("can't combine user with with prefix/"\r
269 "exec_prefix/home or install_(plat)base")\r
270\r
271 # Next, stuff that's wrong (or dubious) only on certain platforms.\r
272 if os.name != "posix":\r
273 if self.exec_prefix:\r
274 self.warn("exec-prefix option ignored on this platform")\r
275 self.exec_prefix = None\r
276\r
277 # Now the interesting logic -- so interesting that we farm it out\r
278 # to other methods. The goal of these methods is to set the final\r
279 # values for the install_{lib,scripts,data,...} options, using as\r
280 # input a heady brew of prefix, exec_prefix, home, install_base,\r
281 # install_platbase, user-supplied versions of\r
282 # install_{purelib,platlib,lib,scripts,data,...}, and the\r
283 # INSTALL_SCHEME dictionary above. Phew!\r
284\r
285 self.dump_dirs("pre-finalize_{unix,other}")\r
286\r
287 if os.name == 'posix':\r
288 self.finalize_unix()\r
289 else:\r
290 self.finalize_other()\r
291\r
292 self.dump_dirs("post-finalize_{unix,other}()")\r
293\r
294 # Expand configuration variables, tilde, etc. in self.install_base\r
295 # and self.install_platbase -- that way, we can use $base or\r
296 # $platbase in the other installation directories and not worry\r
297 # about needing recursive variable expansion (shudder).\r
298\r
299 py_version = (string.split(sys.version))[0]\r
300 (prefix, exec_prefix) = get_config_vars('prefix', 'exec_prefix')\r
301 self.config_vars = {'dist_name': self.distribution.get_name(),\r
302 'dist_version': self.distribution.get_version(),\r
303 'dist_fullname': self.distribution.get_fullname(),\r
304 'py_version': py_version,\r
305 'py_version_short': py_version[0:3],\r
306 'py_version_nodot': py_version[0] + py_version[2],\r
307 'sys_prefix': prefix,\r
308 'prefix': prefix,\r
309 'sys_exec_prefix': exec_prefix,\r
310 'exec_prefix': exec_prefix,\r
311 'userbase': self.install_userbase,\r
312 'usersite': self.install_usersite,\r
313 }\r
314 self.expand_basedirs()\r
315\r
316 self.dump_dirs("post-expand_basedirs()")\r
317\r
318 # Now define config vars for the base directories so we can expand\r
319 # everything else.\r
320 self.config_vars['base'] = self.install_base\r
321 self.config_vars['platbase'] = self.install_platbase\r
322\r
323 if DEBUG:\r
324 from pprint import pprint\r
325 print "config vars:"\r
326 pprint(self.config_vars)\r
327\r
328 # Expand "~" and configuration variables in the installation\r
329 # directories.\r
330 self.expand_dirs()\r
331\r
332 self.dump_dirs("post-expand_dirs()")\r
333\r
334 # Create directories in the home dir:\r
335 if self.user:\r
336 self.create_home_path()\r
337\r
338 # Pick the actual directory to install all modules to: either\r
339 # install_purelib or install_platlib, depending on whether this\r
340 # module distribution is pure or not. Of course, if the user\r
341 # already specified install_lib, use their selection.\r
342 if self.install_lib is None:\r
343 if self.distribution.ext_modules: # has extensions: non-pure\r
344 self.install_lib = self.install_platlib\r
345 else:\r
346 self.install_lib = self.install_purelib\r
347\r
348\r
349 # Convert directories from Unix /-separated syntax to the local\r
350 # convention.\r
351 self.convert_paths('lib', 'purelib', 'platlib',\r
352 'scripts', 'data', 'headers',\r
353 'userbase', 'usersite')\r
354\r
355 # Well, we're not actually fully completely finalized yet: we still\r
356 # have to deal with 'extra_path', which is the hack for allowing\r
357 # non-packagized module distributions (hello, Numerical Python!) to\r
358 # get their own directories.\r
359 self.handle_extra_path()\r
360 self.install_libbase = self.install_lib # needed for .pth file\r
361 self.install_lib = os.path.join(self.install_lib, self.extra_dirs)\r
362\r
363 # If a new root directory was supplied, make all the installation\r
364 # dirs relative to it.\r
365 if self.root is not None:\r
366 self.change_roots('libbase', 'lib', 'purelib', 'platlib',\r
367 'scripts', 'data', 'headers')\r
368\r
369 self.dump_dirs("after prepending root")\r
370\r
371 # Find out the build directories, ie. where to install from.\r
372 self.set_undefined_options('build',\r
373 ('build_base', 'build_base'),\r
374 ('build_lib', 'build_lib'))\r
375\r
376 # Punt on doc directories for now -- after all, we're punting on\r
377 # documentation completely!\r
378\r
379 # finalize_options ()\r
380\r
381\r
382 def dump_dirs (self, msg):\r
383 if DEBUG:\r
384 from distutils.fancy_getopt import longopt_xlate\r
385 print msg + ":"\r
386 for opt in self.user_options:\r
387 opt_name = opt[0]\r
388 if opt_name[-1] == "=":\r
389 opt_name = opt_name[0:-1]\r
390 if opt_name in self.negative_opt:\r
391 opt_name = string.translate(self.negative_opt[opt_name],\r
392 longopt_xlate)\r
393 val = not getattr(self, opt_name)\r
394 else:\r
395 opt_name = string.translate(opt_name, longopt_xlate)\r
396 val = getattr(self, opt_name)\r
397 print " %s: %s" % (opt_name, val)\r
398\r
399\r
400 def finalize_unix (self):\r
401\r
402 if self.install_base is not None or self.install_platbase is not None:\r
403 if ((self.install_lib is None and\r
404 self.install_purelib is None and\r
405 self.install_platlib is None) or\r
406 self.install_headers is None or\r
407 self.install_scripts is None or\r
408 self.install_data is None):\r
409 raise DistutilsOptionError, \\r
410 ("install-base or install-platbase supplied, but "\r
411 "installation scheme is incomplete")\r
412 return\r
413\r
414 if self.user:\r
415 if self.install_userbase is None:\r
416 raise DistutilsPlatformError(\r
417 "User base directory is not specified")\r
418 self.install_base = self.install_platbase = self.install_userbase\r
419 self.select_scheme("unix_user")\r
420 elif self.home is not None:\r
421 self.install_base = self.install_platbase = self.home\r
422 self.select_scheme("unix_home")\r
423 else:\r
424 if self.prefix is None:\r
425 if self.exec_prefix is not None:\r
426 raise DistutilsOptionError, \\r
427 "must not supply exec-prefix without prefix"\r
428\r
429 self.prefix = os.path.normpath(sys.prefix)\r
430 self.exec_prefix = os.path.normpath(sys.exec_prefix)\r
431\r
432 else:\r
433 if self.exec_prefix is None:\r
434 self.exec_prefix = self.prefix\r
435\r
436 self.install_base = self.prefix\r
437 self.install_platbase = self.exec_prefix\r
438 self.select_scheme("unix_prefix")\r
439\r
440 # finalize_unix ()\r
441\r
442\r
443 def finalize_other (self): # Windows and Mac OS for now\r
444\r
445 if self.user:\r
446 if self.install_userbase is None:\r
447 raise DistutilsPlatformError(\r
448 "User base directory is not specified")\r
449 self.install_base = self.install_platbase = self.install_userbase\r
450 self.select_scheme(os.name + "_user")\r
451 elif self.home is not None:\r
452 self.install_base = self.install_platbase = self.home\r
453 self.select_scheme("unix_home")\r
454 else:\r
455 if self.prefix is None:\r
456 self.prefix = os.path.normpath(sys.prefix)\r
457\r
458 self.install_base = self.install_platbase = self.prefix\r
459 try:\r
460 self.select_scheme(os.name)\r
461 except KeyError:\r
462 raise DistutilsPlatformError, \\r
463 "I don't know how to install stuff on '%s'" % os.name\r
464\r
465 # finalize_other ()\r
466\r
467\r
468 def select_scheme (self, name):\r
469 # it's the caller's problem if they supply a bad name!\r
470 scheme = INSTALL_SCHEMES[name]\r
471 for key in SCHEME_KEYS:\r
472 attrname = 'install_' + key\r
473 if getattr(self, attrname) is None:\r
474 setattr(self, attrname, scheme[key])\r
475\r
476\r
477 def _expand_attrs (self, attrs):\r
478 for attr in attrs:\r
479 val = getattr(self, attr)\r
480 if val is not None:\r
481 if os.name == 'posix' or os.name == 'nt':\r
482 val = os.path.expanduser(val)\r
483 val = subst_vars(val, self.config_vars)\r
484 setattr(self, attr, val)\r
485\r
486\r
487 def expand_basedirs (self):\r
488 self._expand_attrs(['install_base',\r
489 'install_platbase',\r
490 'root'])\r
491\r
492 def expand_dirs (self):\r
493 self._expand_attrs(['install_purelib',\r
494 'install_platlib',\r
495 'install_lib',\r
496 'install_headers',\r
497 'install_scripts',\r
498 'install_data',])\r
499\r
500\r
501 def convert_paths (self, *names):\r
502 for name in names:\r
503 attr = "install_" + name\r
504 setattr(self, attr, convert_path(getattr(self, attr)))\r
505\r
506\r
507 def handle_extra_path (self):\r
508\r
509 if self.extra_path is None:\r
510 self.extra_path = self.distribution.extra_path\r
511\r
512 if self.extra_path is not None:\r
513 if type(self.extra_path) is StringType:\r
514 self.extra_path = string.split(self.extra_path, ',')\r
515\r
516 if len(self.extra_path) == 1:\r
517 path_file = extra_dirs = self.extra_path[0]\r
518 elif len(self.extra_path) == 2:\r
519 (path_file, extra_dirs) = self.extra_path\r
520 else:\r
521 raise DistutilsOptionError, \\r
522 ("'extra_path' option must be a list, tuple, or "\r
523 "comma-separated string with 1 or 2 elements")\r
524\r
525 # convert to local form in case Unix notation used (as it\r
526 # should be in setup scripts)\r
527 extra_dirs = convert_path(extra_dirs)\r
528\r
529 else:\r
530 path_file = None\r
531 extra_dirs = ''\r
532\r
533 # XXX should we warn if path_file and not extra_dirs? (in which\r
534 # case the path file would be harmless but pointless)\r
535 self.path_file = path_file\r
536 self.extra_dirs = extra_dirs\r
537\r
538 # handle_extra_path ()\r
539\r
540\r
541 def change_roots (self, *names):\r
542 for name in names:\r
543 attr = "install_" + name\r
544 setattr(self, attr, change_root(self.root, getattr(self, attr)))\r
545\r
546 def create_home_path(self):\r
547 """Create directories under ~\r
548 """\r
549 if not self.user:\r
550 return\r
551 home = convert_path(os.path.expanduser("~"))\r
552 for name, path in self.config_vars.iteritems():\r
553 if path.startswith(home) and not os.path.isdir(path):\r
554 self.debug_print("os.makedirs('%s', 0700)" % path)\r
555 os.makedirs(path, 0700)\r
556\r
557 # -- Command execution methods -------------------------------------\r
558\r
559 def run (self):\r
560\r
561 # Obviously have to build before we can install\r
562 if not self.skip_build:\r
563 self.run_command('build')\r
564 # If we built for any other platform, we can't install.\r
565 build_plat = self.distribution.get_command_obj('build').plat_name\r
566 # check warn_dir - it is a clue that the 'install' is happening\r
567 # internally, and not to sys.path, so we don't check the platform\r
568 # matches what we are running.\r
569 if self.warn_dir and build_plat != get_platform():\r
570 raise DistutilsPlatformError("Can't install when "\r
571 "cross-compiling")\r
572\r
573 # Run all sub-commands (at least those that need to be run)\r
574 for cmd_name in self.get_sub_commands():\r
575 self.run_command(cmd_name)\r
576\r
577 if self.path_file:\r
578 self.create_path_file()\r
579\r
580 # write list of installed files, if requested.\r
581 if self.record:\r
582 outputs = self.get_outputs()\r
583 if self.root: # strip any package prefix\r
584 root_len = len(self.root)\r
585 for counter in xrange(len(outputs)):\r
586 outputs[counter] = outputs[counter][root_len:]\r
587 self.execute(write_file,\r
588 (self.record, outputs),\r
589 "writing list of installed files to '%s'" %\r
590 self.record)\r
591\r
592 sys_path = map(os.path.normpath, sys.path)\r
593 sys_path = map(os.path.normcase, sys_path)\r
594 install_lib = os.path.normcase(os.path.normpath(self.install_lib))\r
595 if (self.warn_dir and\r
596 not (self.path_file and self.install_path_file) and\r
597 install_lib not in sys_path):\r
598 log.debug(("modules installed to '%s', which is not in "\r
599 "Python's module search path (sys.path) -- "\r
600 "you'll have to change the search path yourself"),\r
601 self.install_lib)\r
602\r
603 # run ()\r
604\r
605 def create_path_file (self):\r
606 filename = os.path.join(self.install_libbase,\r
607 self.path_file + ".pth")\r
608 if self.install_path_file:\r
609 self.execute(write_file,\r
610 (filename, [self.extra_dirs]),\r
611 "creating %s" % filename)\r
612 else:\r
613 self.warn("path file '%s' not created" % filename)\r
614\r
615\r
616 # -- Reporting methods ---------------------------------------------\r
617\r
618 def get_outputs (self):\r
619 # Assemble the outputs of all the sub-commands.\r
620 outputs = []\r
621 for cmd_name in self.get_sub_commands():\r
622 cmd = self.get_finalized_command(cmd_name)\r
623 # Add the contents of cmd.get_outputs(), ensuring\r
624 # that outputs doesn't contain duplicate entries\r
625 for filename in cmd.get_outputs():\r
626 if filename not in outputs:\r
627 outputs.append(filename)\r
628\r
629 if self.path_file and self.install_path_file:\r
630 outputs.append(os.path.join(self.install_libbase,\r
631 self.path_file + ".pth"))\r
632\r
633 return outputs\r
634\r
635 def get_inputs (self):\r
636 # XXX gee, this looks familiar ;-(\r
637 inputs = []\r
638 for cmd_name in self.get_sub_commands():\r
639 cmd = self.get_finalized_command(cmd_name)\r
640 inputs.extend(cmd.get_inputs())\r
641\r
642 return inputs\r
643\r
644\r
645 # -- Predicates for sub-command list -------------------------------\r
646\r
647 def has_lib (self):\r
648 """Return true if the current distribution has any Python\r
649 modules to install."""\r
650 return (self.distribution.has_pure_modules() or\r
651 self.distribution.has_ext_modules())\r
652\r
653 def has_headers (self):\r
654 return self.distribution.has_headers()\r
655\r
656 def has_scripts (self):\r
657 return self.distribution.has_scripts()\r
658\r
659 def has_data (self):\r
660 return self.distribution.has_data_files()\r
661\r
662\r
663 # 'sub_commands': a list of commands this command might have to run to\r
664 # get its work done. See cmd.py for more info.\r
665 sub_commands = [('install_lib', has_lib),\r
666 ('install_headers', has_headers),\r
667 ('install_scripts', has_scripts),\r
668 ('install_data', has_data),\r
669 ('install_egg_info', lambda self:True),\r
670 ]\r
671\r
672# class install\r