mirror of
https://github.com/python/cpython.git
synced 2025-09-17 14:16:02 +00:00
cleaned up distutils.command.build
This commit is contained in:
parent
3f7cba1b65
commit
1c6ebc22bc
1 changed files with 5 additions and 15 deletions
|
@ -9,13 +9,11 @@ from distutils.core import Command
|
||||||
from distutils.errors import DistutilsOptionError
|
from distutils.errors import DistutilsOptionError
|
||||||
from distutils.util import get_platform
|
from distutils.util import get_platform
|
||||||
|
|
||||||
|
def show_compilers():
|
||||||
def show_compilers ():
|
|
||||||
from distutils.ccompiler import show_compilers
|
from distutils.ccompiler import show_compilers
|
||||||
show_compilers()
|
show_compilers()
|
||||||
|
|
||||||
|
class build(Command):
|
||||||
class build (Command):
|
|
||||||
|
|
||||||
description = "build everything needed to install"
|
description = "build everything needed to install"
|
||||||
|
|
||||||
|
@ -53,7 +51,7 @@ class build (Command):
|
||||||
"list available compilers", show_compilers),
|
"list available compilers", show_compilers),
|
||||||
]
|
]
|
||||||
|
|
||||||
def initialize_options (self):
|
def initialize_options(self):
|
||||||
self.build_base = 'build'
|
self.build_base = 'build'
|
||||||
# these are decided only after 'build_base' has its final value
|
# these are decided only after 'build_base' has its final value
|
||||||
# (unless overridden by the user or client)
|
# (unless overridden by the user or client)
|
||||||
|
@ -68,8 +66,7 @@ class build (Command):
|
||||||
self.force = 0
|
self.force = 0
|
||||||
self.executable = None
|
self.executable = None
|
||||||
|
|
||||||
def finalize_options (self):
|
def finalize_options(self):
|
||||||
|
|
||||||
if self.plat_name is None:
|
if self.plat_name is None:
|
||||||
self.plat_name = get_platform()
|
self.plat_name = get_platform()
|
||||||
else:
|
else:
|
||||||
|
@ -118,11 +115,8 @@ class build (Command):
|
||||||
|
|
||||||
if self.executable is None:
|
if self.executable is None:
|
||||||
self.executable = os.path.normpath(sys.executable)
|
self.executable = os.path.normpath(sys.executable)
|
||||||
# finalize_options ()
|
|
||||||
|
|
||||||
|
|
||||||
def run (self):
|
|
||||||
|
|
||||||
|
def run(self):
|
||||||
# Run all relevant sub-commands. This will be some subset of:
|
# Run all relevant sub-commands. This will be some subset of:
|
||||||
# - build_py - pure Python modules
|
# - build_py - pure Python modules
|
||||||
# - build_clib - standalone C libraries
|
# - build_clib - standalone C libraries
|
||||||
|
@ -131,7 +125,6 @@ class build (Command):
|
||||||
for cmd_name in self.get_sub_commands():
|
for cmd_name in self.get_sub_commands():
|
||||||
self.run_command(cmd_name)
|
self.run_command(cmd_name)
|
||||||
|
|
||||||
|
|
||||||
# -- Predicates for the sub-command list ---------------------------
|
# -- Predicates for the sub-command list ---------------------------
|
||||||
|
|
||||||
def has_pure_modules (self):
|
def has_pure_modules (self):
|
||||||
|
@ -146,11 +139,8 @@ class build (Command):
|
||||||
def has_scripts (self):
|
def has_scripts (self):
|
||||||
return self.distribution.has_scripts()
|
return self.distribution.has_scripts()
|
||||||
|
|
||||||
|
|
||||||
sub_commands = [('build_py', has_pure_modules),
|
sub_commands = [('build_py', has_pure_modules),
|
||||||
('build_clib', has_c_libraries),
|
('build_clib', has_c_libraries),
|
||||||
('build_ext', has_ext_modules),
|
('build_ext', has_ext_modules),
|
||||||
('build_scripts', has_scripts),
|
('build_scripts', has_scripts),
|
||||||
]
|
]
|
||||||
|
|
||||||
# class build
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue