annotate Lib/distutils/command/build_py.py @ 54294:dba767bc3155 legacy-trunk

remove mention of old ctypes version
author Benjamin Peterson <benjamin@python.org>
date Sat, 23 May 2009 20:59:09 +0000
parents a5229237eb50
children a501573c23f2
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.build_py
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 'build_py' command."""
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
4
11897
017e592c0fd2 Changed '__rcsid__' to '__revision__'.
Greg Ward <gward@python.net>
parents: 11884
diff changeset
5 __revision__ = "$Id$"
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
6
45468
1d84bf5f9478 Patch #2167 from calvin: Remove unused imports
Christian Heimes <christian@cheimes.de>
parents: 41929
diff changeset
7 import string, os
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
8 from types import *
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
9 from glob import glob
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
10
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
11 from distutils.core import Command
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
12 from distutils.errors import *
21856
2f616474eaec package_dir must be converted from the distutils path conventions to
Thomas Heller <theller@ctypes.org>
parents: 21268
diff changeset
13 from distutils.util import convert_path
23668
ca87119255eb Make setup.py less chatty by default.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 22833
diff changeset
14 from distutils import log
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
15
11813
eaeda4621f7d Renamed all command classes so they're exactly the same as the name of the
Greg Ward <gward@python.net>
parents: 11690
diff changeset
16 class build_py (Command):
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
17
11683
47f75a17b103 Added 'description' class attribute to every command class (to help the
Greg Ward <gward@python.net>
parents: 11658
diff changeset
18 description = "\"build\" pure Python modules (copy to build directory)"
47f75a17b103 Added 'description' class attribute to every command class (to help the
Greg Ward <gward@python.net>
parents: 11658
diff changeset
19
11815
03902bc0214a Renamed all 'options' class attributes to 'user_options'.
Greg Ward <gward@python.net>
parents: 11813
diff changeset
20 user_options = [
11884
758a87f4cb2c Build reorg: change 'build_dir' option to 'build_lib'.
Greg Ward <gward@python.net>
parents: 11817
diff changeset
21 ('build-lib=', 'd', "directory to \"build\" (copy) to"),
14963
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
22 ('compile', 'c', "compile .py to .pyc"),
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
23 ('no-compile', None, "don't compile .py files [default]"),
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
24 ('optimize=', 'O',
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
25 "also compile with optimization: -O1 for \"python -O\", "
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
26 "-O2 for \"python -OO\", and -O0 to disable [default: -O0]"),
14434
34379127ee3b Typo fix.
Greg Ward <gward@python.net>
parents: 14237
diff changeset
27 ('force', 'f', "forcibly build everything (ignore file timestamps)"),
11815
03902bc0214a Renamed all 'options' class attributes to 'user_options'.
Greg Ward <gward@python.net>
parents: 11813
diff changeset
28 ]
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
29
14963
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
30 boolean_options = ['compile', 'force']
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
31 negative_opt = {'no-compile' : 'compile'}
14829
b1f220f636ed Added 'boolean_options' list to support config file parsing.
Greg Ward <gward@python.net>
parents: 14434
diff changeset
32
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
33
11817
476eaa38e2d6 Renamed 'set_default_options()' to 'initialize_options()', and
Greg Ward <gward@python.net>
parents: 11815
diff changeset
34 def initialize_options (self):
11884
758a87f4cb2c Build reorg: change 'build_dir' option to 'build_lib'.
Greg Ward <gward@python.net>
parents: 11817
diff changeset
35 self.build_lib = None
12847
4916d40d9677 Renamed 'modules' option to 'py_modules', for consistency with Distribution
Greg Ward <gward@python.net>
parents: 12760
diff changeset
36 self.py_modules = None
11262
810c25d5041c Changed to reflect the new "command options" regime -- in particular,
Greg Ward <gward@python.net>
parents: 11247
diff changeset
37 self.package = None
32328
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
38 self.package_data = None
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
39 self.package_dir = None
14963
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
40 self.compile = 0
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
41 self.optimize = 0
12314
20a5cbf9fcc0 Added '--force' option -- very clear what it means for building (ignore
Greg Ward <gward@python.net>
parents: 12094
diff changeset
42 self.force = None
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
43
11817
476eaa38e2d6 Renamed 'set_default_options()' to 'initialize_options()', and
Greg Ward <gward@python.net>
parents: 11815
diff changeset
44 def finalize_options (self):
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
45 self.set_undefined_options('build',
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
46 ('build_lib', 'build_lib'),
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
47 ('force', 'force'))
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
48
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
49 # Get the distribution options that are aliases for build_py
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
50 # options -- list of packages and list of modules.
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
51 self.packages = self.distribution.packages
12847
4916d40d9677 Renamed 'modules' option to 'py_modules', for consistency with Distribution
Greg Ward <gward@python.net>
parents: 12760
diff changeset
52 self.py_modules = self.distribution.py_modules
32328
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
53 self.package_data = self.distribution.package_data
21856
2f616474eaec package_dir must be converted from the distutils path conventions to
Thomas Heller <theller@ctypes.org>
parents: 21268
diff changeset
54 self.package_dir = {}
2f616474eaec package_dir must be converted from the distutils path conventions to
Thomas Heller <theller@ctypes.org>
parents: 21268
diff changeset
55 if self.distribution.package_dir:
2f616474eaec package_dir must be converted from the distutils path conventions to
Thomas Heller <theller@ctypes.org>
parents: 21268
diff changeset
56 for name, path in self.distribution.package_dir.items():
2f616474eaec package_dir must be converted from the distutils path conventions to
Thomas Heller <theller@ctypes.org>
parents: 21268
diff changeset
57 self.package_dir[name] = convert_path(path)
32366
509072c3fa26 fix bug: list of data files was initialized too soon in build_py
Fred Drake <fdrake@acm.org>
parents: 32328
diff changeset
58 self.data_files = self.get_data_files()
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
59
14963
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
60 # Ick, copied straight from install_lib.py (fancy_getopt needs a
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
61 # type system! Hell, *everything* needs a type system!!!)
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
62 if type(self.optimize) is not IntType:
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
63 try:
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
64 self.optimize = int(self.optimize)
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
65 assert 0 <= self.optimize <= 2
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
66 except (ValueError, AssertionError):
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
67 raise DistutilsOptionError, "optimize must be 0, 1, or 2"
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
68
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
69 def run (self):
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
70
11545
7555990e8db9 Fixed 'find_package_modules()' to ensure that we never build (and thus
Greg Ward <gward@python.net>
parents: 11521
diff changeset
71 # XXX copy_file by default preserves atime and mtime. IMHO this is
7555990e8db9 Fixed 'find_package_modules()' to ensure that we never build (and thus
Greg Ward <gward@python.net>
parents: 11521
diff changeset
72 # the right thing to do, but perhaps it should be an option -- in
7555990e8db9 Fixed 'find_package_modules()' to ensure that we never build (and thus
Greg Ward <gward@python.net>
parents: 11521
diff changeset
73 # particular, a site administrator might want installed files to
7555990e8db9 Fixed 'find_package_modules()' to ensure that we never build (and thus
Greg Ward <gward@python.net>
parents: 11521
diff changeset
74 # reflect the time of installation rather than the last
7555990e8db9 Fixed 'find_package_modules()' to ensure that we never build (and thus
Greg Ward <gward@python.net>
parents: 11521
diff changeset
75 # modification time before the installed release.
7555990e8db9 Fixed 'find_package_modules()' to ensure that we never build (and thus
Greg Ward <gward@python.net>
parents: 11521
diff changeset
76
7555990e8db9 Fixed 'find_package_modules()' to ensure that we never build (and thus
Greg Ward <gward@python.net>
parents: 11521
diff changeset
77 # XXX copy_file by default preserves mode, which appears to be the
7555990e8db9 Fixed 'find_package_modules()' to ensure that we never build (and thus
Greg Ward <gward@python.net>
parents: 11521
diff changeset
78 # wrong thing to do: if a file is read-only in the working
7555990e8db9 Fixed 'find_package_modules()' to ensure that we never build (and thus
Greg Ward <gward@python.net>
parents: 11521
diff changeset
79 # directory, we want it to be installed read/write so that the next
7555990e8db9 Fixed 'find_package_modules()' to ensure that we never build (and thus
Greg Ward <gward@python.net>
parents: 11521
diff changeset
80 # installation of the same module distribution can overwrite it
7555990e8db9 Fixed 'find_package_modules()' to ensure that we never build (and thus
Greg Ward <gward@python.net>
parents: 11521
diff changeset
81 # without problems. (This might be a Unix-specific issue.) Thus
7555990e8db9 Fixed 'find_package_modules()' to ensure that we never build (and thus
Greg Ward <gward@python.net>
parents: 11521
diff changeset
82 # we turn off 'preserve_mode' when copying to the build directory,
7555990e8db9 Fixed 'find_package_modules()' to ensure that we never build (and thus
Greg Ward <gward@python.net>
parents: 11521
diff changeset
83 # since the build directory is supposed to be exactly what the
7555990e8db9 Fixed 'find_package_modules()' to ensure that we never build (and thus
Greg Ward <gward@python.net>
parents: 11521
diff changeset
84 # installation will look like (ie. we preserve mode when
7555990e8db9 Fixed 'find_package_modules()' to ensure that we never build (and thus
Greg Ward <gward@python.net>
parents: 11521
diff changeset
85 # installing).
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
86
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
87 # Two options control which modules will be installed: 'packages'
12847
4916d40d9677 Renamed 'modules' option to 'py_modules', for consistency with Distribution
Greg Ward <gward@python.net>
parents: 12760
diff changeset
88 # and 'py_modules'. The former lets us work with whole packages, not
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
89 # specifying individual modules at all; the latter is for
28114
14463f478240 [Patch #695090 from Bernhard Herzog] Allow specifying both py_modules and packages
Andrew M. Kuchling <amk@amk.ca>
parents: 26285
diff changeset
90 # specifying modules one-at-a-time.
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
91
12847
4916d40d9677 Renamed 'modules' option to 'py_modules', for consistency with Distribution
Greg Ward <gward@python.net>
parents: 12760
diff changeset
92 if self.py_modules:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
93 self.build_modules()
28114
14463f478240 [Patch #695090 from Bernhard Herzog] Allow specifying both py_modules and packages
Andrew M. Kuchling <amk@amk.ca>
parents: 26285
diff changeset
94 if self.packages:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
95 self.build_packages()
32328
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
96 self.build_package_data()
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
97
14963
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
98 self.byte_compile(self.get_outputs(include_bytecode=0))
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
99
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
100 # run ()
21268
d296e6bb17e5 Whitespace normalization.
Fred Drake <fdrake@acm.org>
parents: 14963
diff changeset
101
32328
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
102 def get_data_files (self):
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
103 """Generate list of '(package,src_dir,build_dir,filenames)' tuples"""
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
104 data = []
32378
a9a4b0df512a If self.packages is None (this can happen, I saw it), return
Sjoerd Mullender <sjoerd@acm.org>
parents: 32366
diff changeset
105 if not self.packages:
a9a4b0df512a If self.packages is None (this can happen, I saw it), return
Sjoerd Mullender <sjoerd@acm.org>
parents: 32366
diff changeset
106 return data
32328
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
107 for package in self.packages:
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
108 # Locate package source directory
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
109 src_dir = self.get_package_dir(package)
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
110
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
111 # Compute package build directory
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
112 build_dir = os.path.join(*([self.build_lib] + package.split('.')))
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
113
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
114 # Length of path to strip from found files
41929
24efa2e448bc SF 1668596/1720897: distutils now copies data files
Neal Norwitz <nnorwitz@gmail.com>
parents: 33965
diff changeset
115 plen = 0
24efa2e448bc SF 1668596/1720897: distutils now copies data files
Neal Norwitz <nnorwitz@gmail.com>
parents: 33965
diff changeset
116 if src_dir:
24efa2e448bc SF 1668596/1720897: distutils now copies data files
Neal Norwitz <nnorwitz@gmail.com>
parents: 33965
diff changeset
117 plen = len(src_dir)+1
32328
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
118
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
119 # Strip directory from globbed filenames
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
120 filenames = [
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
121 file[plen:] for file in self.find_data_files(package, src_dir)
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
122 ]
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
123 data.append((package, src_dir, build_dir, filenames))
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
124 return data
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
125
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
126 def find_data_files (self, package, src_dir):
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
127 """Return filenames for package's data files in 'src_dir'"""
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
128 globs = (self.package_data.get('', [])
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
129 + self.package_data.get(package, []))
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
130 files = []
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
131 for pattern in globs:
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
132 # Each pattern has to be converted to a platform-specific path
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
133 filelist = glob(os.path.join(src_dir, convert_path(pattern)))
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
134 # Files that match more than one pattern are only added once
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
135 files.extend([fn for fn in filelist if fn not in files])
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
136 return files
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
137
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
138 def build_package_data (self):
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
139 """Copy data files into build directory"""
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
140 lastdir = None
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
141 for package, src_dir, build_dir, filenames in self.data_files:
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
142 for filename in filenames:
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
143 target = os.path.join(build_dir, filename)
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
144 self.mkpath(os.path.dirname(target))
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
145 self.copy_file(os.path.join(src_dir, filename), target,
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
146 preserve_mode=False)
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
147
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
148 def get_package_dir (self, package):
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
149 """Return the directory, relative to the top of the source
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
150 distribution, where package 'package' should be found
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
151 (at least according to the 'package_dir' option, if any)."""
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
152
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
153 path = string.split(package, '.')
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
154
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
155 if not self.package_dir:
11521
ba07fff72511 [from 1999-11-04]
Greg Ward <gward@python.net>
parents: 11365
diff changeset
156 if path:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
157 return apply(os.path.join, path)
11521
ba07fff72511 [from 1999-11-04]
Greg Ward <gward@python.net>
parents: 11365
diff changeset
158 else:
ba07fff72511 [from 1999-11-04]
Greg Ward <gward@python.net>
parents: 11365
diff changeset
159 return ''
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
160 else:
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
161 tail = []
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
162 while path:
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
163 try:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
164 pdir = self.package_dir[string.join(path, '.')]
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
165 except KeyError:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
166 tail.insert(0, path[-1])
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
167 del path[-1]
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
168 else:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
169 tail.insert(0, pdir)
48260
2be17d368a9c Update distutils so that it triggers no warnings when run under -3.
Brett Cannon <bcannon@gmail.com>
parents: 45468
diff changeset
170 return os.path.join(*tail)
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
171 else:
12760
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
172 # Oops, got all the way through 'path' without finding a
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
173 # match in package_dir. If package_dir defines a directory
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
174 # for the root (nameless) package, then fallback on it;
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
175 # otherwise, we might as well have not consulted
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
176 # package_dir at all, as we just use the directory implied
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
177 # by 'tail' (which should be the same as the original value
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
178 # of 'path' at this point).
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
179 pdir = self.package_dir.get('')
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
180 if pdir is not None:
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
181 tail.insert(0, pdir)
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
182
11521
ba07fff72511 [from 1999-11-04]
Greg Ward <gward@python.net>
parents: 11365
diff changeset
183 if tail:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
184 return apply(os.path.join, tail)
11521
ba07fff72511 [from 1999-11-04]
Greg Ward <gward@python.net>
parents: 11365
diff changeset
185 else:
ba07fff72511 [from 1999-11-04]
Greg Ward <gward@python.net>
parents: 11365
diff changeset
186 return ''
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
187
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
188 # get_package_dir ()
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
189
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
190
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
191 def check_package (self, package, package_dir):
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
192
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
193 # Empty dir name means current directory, which we can probably
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
194 # assume exists. Also, os.path.exists and isdir don't know about
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
195 # my "empty string means current dir" convention, so we have to
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
196 # circumvent them.
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
197 if package_dir != "":
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
198 if not os.path.exists(package_dir):
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
199 raise DistutilsFileError, \
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
200 "package directory '%s' does not exist" % package_dir
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
201 if not os.path.isdir(package_dir):
11903
f8518f060bed Typo fix.
Greg Ward <gward@python.net>
parents: 11897
diff changeset
202 raise DistutilsFileError, \
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
203 ("supposed package directory '%s' exists, " +
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
204 "but is not a directory") % package_dir
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
205
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
206 # Require __init__.py for all but the "root package"
11521
ba07fff72511 [from 1999-11-04]
Greg Ward <gward@python.net>
parents: 11365
diff changeset
207 if package:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
208 init_py = os.path.join(package_dir, "__init__.py")
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
209 if os.path.isfile(init_py):
12760
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
210 return init_py
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
211 else:
23668
ca87119255eb Make setup.py less chatty by default.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 22833
diff changeset
212 log.warn(("package init file '%s' not found " +
ca87119255eb Make setup.py less chatty by default.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 22833
diff changeset
213 "(or not a regular file)"), init_py)
12760
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
214
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
215 # Either not in a package at all (__init__.py not expected), or
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
216 # __init__.py doesn't exist -- so don't return the filename.
23679
b18348bdca08 Make None return explicit
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 23668
diff changeset
217 return None
21268
d296e6bb17e5 Whitespace normalization.
Fred Drake <fdrake@acm.org>
parents: 14963
diff changeset
218
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
219 # check_package ()
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
220
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
221
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
222 def check_module (self, module, module_file):
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
223 if not os.path.isfile(module_file):
23668
ca87119255eb Make setup.py less chatty by default.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 22833
diff changeset
224 log.warn("file %s (for module %s) not found", module_file, module)
22833
c865cf8bee40 Revert 0/1 -> False/True change; I didn't intend to muck w/ distutils.
Tim Peters <tim.peters@gmail.com>
parents: 22830
diff changeset
225 return 0
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
226 else:
22833
c865cf8bee40 Revert 0/1 -> False/True change; I didn't intend to muck w/ distutils.
Tim Peters <tim.peters@gmail.com>
parents: 22830
diff changeset
227 return 1
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
228
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
229 # check_module ()
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
230
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
231
11339
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
232 def find_package_modules (self, package, package_dir):
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
233 self.check_package(package, package_dir)
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
234 module_files = glob(os.path.join(package_dir, "*.py"))
12094
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
235 modules = []
14237
d9643e9c90eb Added 'script_name' and 'script_args' instance attributes to Distribution.
Greg Ward <gward@python.net>
parents: 13987
diff changeset
236 setup_script = os.path.abspath(self.distribution.script_name)
11545
7555990e8db9 Fixed 'find_package_modules()' to ensure that we never build (and thus
Greg Ward <gward@python.net>
parents: 11521
diff changeset
237
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
238 for f in module_files:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
239 abs_f = os.path.abspath(f)
11545
7555990e8db9 Fixed 'find_package_modules()' to ensure that we never build (and thus
Greg Ward <gward@python.net>
parents: 11521
diff changeset
240 if abs_f != setup_script:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
241 module = os.path.splitext(os.path.basename(f))[0]
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
242 modules.append((package, module, f))
14237
d9643e9c90eb Added 'script_name' and 'script_args' instance attributes to Distribution.
Greg Ward <gward@python.net>
parents: 13987
diff changeset
243 else:
d9643e9c90eb Added 'script_name' and 'script_args' instance attributes to Distribution.
Greg Ward <gward@python.net>
parents: 13987
diff changeset
244 self.debug_print("excluding %s" % setup_script)
12094
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
245 return modules
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
246
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
247
11339
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
248 def find_modules (self):
12760
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
249 """Finds individually-specified Python modules, ie. those listed by
12847
4916d40d9677 Renamed 'modules' option to 'py_modules', for consistency with Distribution
Greg Ward <gward@python.net>
parents: 12760
diff changeset
250 module name in 'self.py_modules'. Returns a list of tuples (package,
12760
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
251 module_base, filename): 'package' is a tuple of the path through
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
252 package-space to the module; 'module_base' is the bare (no
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
253 packages, no dots) module name, and 'filename' is the path to the
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
254 ".py" file (relative to the distribution root) that implements the
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
255 module.
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
256 """
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
257
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
258 # Map package names to tuples of useful info about the package:
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
259 # (package_dir, checked)
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
260 # package_dir - the directory where we'll find source files for
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
261 # this package
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
262 # checked - true if we have checked that the package directory
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
263 # is valid (exists, contains __init__.py, ... ?)
11339
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
264 packages = {}
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
265
12760
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
266 # List of (package, module, filename) tuples to return
11339
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
267 modules = []
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
268
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
269 # We treat modules-in-packages almost the same as toplevel modules,
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
270 # just the "package" for a toplevel is empty (either an empty
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
271 # string or empty list, depending on context). Differences:
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
272 # - don't check for __init__.py in directory for empty package
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
273
12847
4916d40d9677 Renamed 'modules' option to 'py_modules', for consistency with Distribution
Greg Ward <gward@python.net>
parents: 12760
diff changeset
274 for module in self.py_modules:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
275 path = string.split(module, '.')
13987
f3bfcee745a7 Fix long-hidden inconsistency in internal interface: 'find_modules()' now
Greg Ward <gward@python.net>
parents: 12847
diff changeset
276 package = string.join(path[0:-1], '.')
11339
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
277 module_base = path[-1]
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
278
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
279 try:
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
280 (package_dir, checked) = packages[package]
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
281 except KeyError:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
282 package_dir = self.get_package_dir(package)
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
283 checked = 0
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
284
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
285 if not checked:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
286 init_py = self.check_package(package, package_dir)
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
287 packages[package] = (package_dir, 1)
12760
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
288 if init_py:
0f1e4e3935d7 Fixed a couple of long-hidden bugs (amazing what you find when you
Greg Ward <gward@python.net>
parents: 12743
diff changeset
289 modules.append((package, "__init__", init_py))
10437
3bc8f53041c0 First checkin of real Distutils command modules.
Greg Ward <gward@python.net>
parents:
diff changeset
290
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
291 # XXX perhaps we should also check for just .pyc files
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
292 # (so greedy closed-source bastards can distribute Python
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
293 # modules too)
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
294 module_file = os.path.join(package_dir, module_base + ".py")
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
295 if not self.check_module(module, module_file):
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
296 continue
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
297
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
298 modules.append((package, module_base, module_file))
11339
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
299
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
300 return modules
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
301
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
302 # find_modules ()
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
303
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
304
12094
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
305 def find_all_modules (self):
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
306 """Compute the list of all modules that will be built, whether
12847
4916d40d9677 Renamed 'modules' option to 'py_modules', for consistency with Distribution
Greg Ward <gward@python.net>
parents: 12760
diff changeset
307 they are specified one-module-at-a-time ('self.py_modules') or
12094
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
308 by whole packages ('self.packages'). Return a list of tuples
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
309 (package, module, module_file), just like 'find_modules()' and
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
310 'find_package_modules()' do."""
11339
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
311
28114
14463f478240 [Patch #695090 from Bernhard Herzog] Allow specifying both py_modules and packages
Andrew M. Kuchling <amk@amk.ca>
parents: 26285
diff changeset
312 modules = []
12847
4916d40d9677 Renamed 'modules' option to 'py_modules', for consistency with Distribution
Greg Ward <gward@python.net>
parents: 12760
diff changeset
313 if self.py_modules:
28114
14463f478240 [Patch #695090 from Bernhard Herzog] Allow specifying both py_modules and packages
Andrew M. Kuchling <amk@amk.ca>
parents: 26285
diff changeset
314 modules.extend(self.find_modules())
14463f478240 [Patch #695090 from Bernhard Herzog] Allow specifying both py_modules and packages
Andrew M. Kuchling <amk@amk.ca>
parents: 26285
diff changeset
315 if self.packages:
11339
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
316 for package in self.packages:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
317 package_dir = self.get_package_dir(package)
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
318 m = self.find_package_modules(package, package_dir)
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
319 modules.extend(m)
11339
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
320
12094
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
321 return modules
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
322
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
323 # find_all_modules ()
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
324
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
325
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
326 def get_source_files (self):
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
327
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
328 modules = self.find_all_modules()
11339
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
329 filenames = []
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
330 for module in modules:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
331 filenames.append(module[-1])
11339
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
332
12094
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
333 return filenames
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
334
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
335
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
336 def get_module_outfile (self, build_dir, package, module):
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
337 outfile_path = [build_dir] + list(package) + [module + ".py"]
48260
2be17d368a9c Update distutils so that it triggers no warnings when run under -3.
Brett Cannon <bcannon@gmail.com>
parents: 45468
diff changeset
338 return os.path.join(*outfile_path)
12094
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
339
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
340
14963
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
341 def get_outputs (self, include_bytecode=1):
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
342 modules = self.find_all_modules()
12094
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
343 outputs = []
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
344 for (package, module, module_file) in modules:
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
345 package = string.split(package, '.')
14963
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
346 filename = self.get_module_outfile(self.build_lib, package, module)
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
347 outputs.append(filename)
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
348 if include_bytecode:
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
349 if self.compile:
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
350 outputs.append(filename + "c")
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
351 if self.optimize > 0:
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
352 outputs.append(filename + "o")
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
353
32328
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
354 outputs += [
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
355 os.path.join(build_dir, filename)
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
356 for package, src_dir, build_dir, filenames in self.data_files
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
357 for filename in filenames
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
358 ]
f49471953689 Add support for package data.
Fred Drake <fdrake@acm.org>
parents: 28114
diff changeset
359
12094
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
360 return outputs
11339
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
361
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
362
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
363 def build_module (self, module, module_file, package):
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
364 if type(package) is StringType:
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
365 package = string.split(package, '.')
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
366 elif type(package) not in (ListType, TupleType):
11521
ba07fff72511 [from 1999-11-04]
Greg Ward <gward@python.net>
parents: 11365
diff changeset
367 raise TypeError, \
ba07fff72511 [from 1999-11-04]
Greg Ward <gward@python.net>
parents: 11365
diff changeset
368 "'package' must be a string (dot-separated), list, or tuple"
11339
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
369
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
370 # Now put the module source file into the "build" area -- this is
11884
758a87f4cb2c Build reorg: change 'build_dir' option to 'build_lib'.
Greg Ward <gward@python.net>
parents: 11817
diff changeset
371 # easy, we just copy it somewhere under self.build_lib (the build
11339
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
372 # directory for Python source).
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
373 outfile = self.get_module_outfile(self.build_lib, package, module)
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
374 dir = os.path.dirname(outfile)
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
375 self.mkpath(dir)
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
376 return self.copy_file(module_file, outfile, preserve_mode=0)
11339
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
377
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
378
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
379 def build_modules (self):
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
380
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
381 modules = self.find_modules()
12094
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
382 for (package, module, module_file) in modules:
11339
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
383
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
384 # Now "build" the module -- ie. copy the source file to
11884
758a87f4cb2c Build reorg: change 'build_dir' option to 'build_lib'.
Greg Ward <gward@python.net>
parents: 11817
diff changeset
385 # self.build_lib (the build directory for Python source).
11339
6f7507ef2b11 Renamed 'dir' option to be consistent with other commands.
Greg Ward <gward@python.net>
parents: 11299
diff changeset
386 # (Actually, it gets copied to the directory for this package
11884
758a87f4cb2c Build reorg: change 'build_dir' option to 'build_lib'.
Greg Ward <gward@python.net>
parents: 11817
diff changeset
387 # under self.build_lib.)
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
388 self.build_module(module, module_file, package)
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
389
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
390 # build_modules ()
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
391
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
392
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
393 def build_packages (self):
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
394
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
395 for package in self.packages:
12094
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
396
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
397 # Get list of (package, module, module_file) tuples based on
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
398 # scanning the package directory. 'package' is only included
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
399 # in the tuple so that 'find_modules()' and
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
400 # 'find_package_tuples()' have a consistent interface; it's
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
401 # ignored here (apart from a sanity check). Also, 'module' is
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
402 # the *unqualified* module name (ie. no dots, no package -- we
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
403 # already know its package!), and 'module_file' is the path to
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
404 # the .py file, relative to the current directory
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
405 # (ie. including 'package_dir').
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
406 package_dir = self.get_package_dir(package)
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
407 modules = self.find_package_modules(package, package_dir)
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
408
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
409 # Now loop over the modules we found, "building" each one (just
11884
758a87f4cb2c Build reorg: change 'build_dir' option to 'build_lib'.
Greg Ward <gward@python.net>
parents: 11817
diff changeset
410 # copy it to self.build_lib).
12094
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
411 for (package_, module, module_file) in modules:
8d1c69bdc4f2 Deleted some crufty comments and code.
Greg Ward <gward@python.net>
parents: 11903
diff changeset
412 assert package == package_
14948
7acb8bbc215b Standardized whitespace around function calls.
Greg Ward <gward@python.net>
parents: 14943
diff changeset
413 self.build_module(module, module_file, package)
11299
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
414
6d646f7e1a1c Basically a complete rewrite to support dealing with modules in whole
Greg Ward <gward@python.net>
parents: 11280
diff changeset
415 # build_packages ()
14963
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
416
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
417
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
418 def byte_compile (self, files):
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
419 from distutils.util import byte_compile
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
420 prefix = self.build_lib
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
421 if prefix[-1] != os.sep:
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
422 prefix = prefix + os.sep
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
423
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
424 # XXX this code is essentially the same as the 'byte_compile()
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
425 # method of the "install_lib" command, except for the determination
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
426 # of the 'prefix' string. Hmmm.
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
427
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
428 if self.compile:
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
429 byte_compile(files, optimize=0,
23668
ca87119255eb Make setup.py less chatty by default.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 22833
diff changeset
430 force=self.force, prefix=prefix, dry_run=self.dry_run)
14963
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
431 if self.optimize > 0:
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
432 byte_compile(files, optimize=self.optimize,
23668
ca87119255eb Make setup.py less chatty by default.
Jeremy Hylton <jeremy@alum.mit.edu>
parents: 22833
diff changeset
433 force=self.force, prefix=prefix, dry_run=self.dry_run)
14963
73d09322f2c3 Added the ability to do byte-compilation at build time, currently off
Greg Ward <gward@python.net>
parents: 14948
diff changeset
434
12743
e878a647e06e Normalized all the end-of-class lines.
Greg Ward <gward@python.net>
parents: 12318
diff changeset
435 # class build_py