mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
Changed to reflect the new "command options" regime -- in particular,
we no longer explicitly pull distribution options out of our Distribution object, but rather let the Distribution put them into the command object.
This commit is contained in:
parent
42926ddc7e
commit
71eb8644d7
2 changed files with 22 additions and 14 deletions
|
@ -61,6 +61,7 @@ class BuildExt (Command):
|
||||||
|
|
||||||
|
|
||||||
def set_default_options (self):
|
def set_default_options (self):
|
||||||
|
self.extensions = None
|
||||||
self.dir = None
|
self.dir = None
|
||||||
self.include_dirs = None
|
self.include_dirs = None
|
||||||
self.define = None
|
self.define = None
|
||||||
|
@ -90,10 +91,14 @@ class BuildExt (Command):
|
||||||
def run (self):
|
def run (self):
|
||||||
|
|
||||||
self.set_final_options ()
|
self.set_final_options ()
|
||||||
(extensions, package) = \
|
|
||||||
self.distribution.get_options ('ext_modules', 'package')
|
|
||||||
|
|
||||||
# 'extensions', as supplied by setup.py, is a list of 2-tuples.
|
# XXX we should care about the package we compile extensions
|
||||||
|
# into!
|
||||||
|
|
||||||
|
#(extensions, package) = \
|
||||||
|
# self.distribution.get_options ('ext_modules', 'package')
|
||||||
|
|
||||||
|
# 'self.extensions', as supplied by setup.py, is a list of 2-tuples.
|
||||||
# Each tuple is simple:
|
# Each tuple is simple:
|
||||||
# (ext_name, build_info)
|
# (ext_name, build_info)
|
||||||
# build_info is a dictionary containing everything specific to
|
# build_info is a dictionary containing everything specific to
|
||||||
|
@ -101,13 +106,16 @@ class BuildExt (Command):
|
||||||
# should be handled by general distutils options passed from
|
# should be handled by general distutils options passed from
|
||||||
# setup.py down to right here, but that's not taken care of yet.)
|
# setup.py down to right here, but that's not taken care of yet.)
|
||||||
|
|
||||||
|
if not self.extensions:
|
||||||
|
return
|
||||||
|
|
||||||
# First, sanity-check the 'extensions' list
|
# First, sanity-check the 'self.extensions' list
|
||||||
self.check_extensions_list (extensions)
|
self.check_extensions_list (self.extensions)
|
||||||
|
|
||||||
# Setup the CCompiler object that we'll use to do all the
|
# Setup the CCompiler object that we'll use to do all the
|
||||||
# compiling and linking
|
# compiling and linking
|
||||||
self.compiler = new_compiler (verbose=self.distribution.verbose,
|
self.compiler = new_compiler (plat=os.environ.get ('PLAT'),
|
||||||
|
verbose=self.distribution.verbose,
|
||||||
dry_run=self.distribution.dry_run)
|
dry_run=self.distribution.dry_run)
|
||||||
if self.include_dirs is not None:
|
if self.include_dirs is not None:
|
||||||
self.compiler.set_include_dirs (self.include_dirs)
|
self.compiler.set_include_dirs (self.include_dirs)
|
||||||
|
@ -128,7 +136,7 @@ class BuildExt (Command):
|
||||||
self.compiler.set_link_objects (self.link_objects)
|
self.compiler.set_link_objects (self.link_objects)
|
||||||
|
|
||||||
# Now the real loop over extensions
|
# Now the real loop over extensions
|
||||||
self.build_extensions (extensions)
|
self.build_extensions (self.extensions)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,10 +20,14 @@ class BuildPy (Command):
|
||||||
|
|
||||||
def set_default_options (self):
|
def set_default_options (self):
|
||||||
self.dir = None
|
self.dir = None
|
||||||
|
self.modules = None
|
||||||
|
self.package = None
|
||||||
|
|
||||||
def set_final_options (self):
|
def set_final_options (self):
|
||||||
self.set_undefined_options ('build',
|
self.set_undefined_options ('build',
|
||||||
('libdir', 'dir'))
|
('libdir', 'dir'))
|
||||||
|
if self.package is None:
|
||||||
|
self.package = ''
|
||||||
|
|
||||||
|
|
||||||
def run (self):
|
def run (self):
|
||||||
|
@ -43,10 +47,6 @@ class BuildPy (Command):
|
||||||
|
|
||||||
self.set_final_options ()
|
self.set_final_options ()
|
||||||
|
|
||||||
(modules, package) = \
|
|
||||||
self.distribution.get_options ('py_modules', 'package')
|
|
||||||
package = package or ''
|
|
||||||
|
|
||||||
infiles = []
|
infiles = []
|
||||||
outfiles = []
|
outfiles = []
|
||||||
missing = []
|
missing = []
|
||||||
|
@ -56,20 +56,20 @@ class BuildPy (Command):
|
||||||
# input files.
|
# input files.
|
||||||
|
|
||||||
# it's ok not to have *any* py files, right?
|
# it's ok not to have *any* py files, right?
|
||||||
if not modules:
|
if not self.modules:
|
||||||
return
|
return
|
||||||
|
|
||||||
# XXX we should allow for wildcards, so eg. the Distutils setup.py
|
# XXX we should allow for wildcards, so eg. the Distutils setup.py
|
||||||
# file would just have to say
|
# file would just have to say
|
||||||
# py_modules = ['distutils.*', 'distutils.command.*']
|
# py_modules = ['distutils.*', 'distutils.command.*']
|
||||||
# without having to list each one explicitly.
|
# without having to list each one explicitly.
|
||||||
for m in modules:
|
for m in self.modules:
|
||||||
fn = apply (os.path.join, tuple (string.split (m, '.'))) + '.py'
|
fn = apply (os.path.join, tuple (string.split (m, '.'))) + '.py'
|
||||||
if not os.path.exists (fn):
|
if not os.path.exists (fn):
|
||||||
missing.append (fn)
|
missing.append (fn)
|
||||||
else:
|
else:
|
||||||
infiles.append (fn)
|
infiles.append (fn)
|
||||||
outfiles.append (os.path.join (self.dir, package, fn))
|
outfiles.append (os.path.join (self.dir, self.package, fn))
|
||||||
|
|
||||||
# Blow up if any input files were not found.
|
# Blow up if any input files were not found.
|
||||||
if missing:
|
if missing:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue