mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
Some more style improvements
This commit is contained in:
parent
28f46e1839
commit
022640dea0
1 changed files with 4 additions and 25 deletions
|
@ -18,8 +18,9 @@ the "typical" Unix-style command-line C compiler:
|
||||||
__revision__ = "$Id$"
|
__revision__ = "$Id$"
|
||||||
|
|
||||||
import os, sys
|
import os, sys
|
||||||
from types import *
|
from types import StringType, NoneType
|
||||||
from copy import copy
|
from copy import copy
|
||||||
|
|
||||||
from distutils import sysconfig
|
from distutils import sysconfig
|
||||||
from distutils.dep_util import newer
|
from distutils.dep_util import newer
|
||||||
from distutils.ccompiler import \
|
from distutils.ccompiler import \
|
||||||
|
@ -43,8 +44,7 @@ from distutils import log
|
||||||
# should just happily stuff them into the preprocessor/compiler/linker
|
# should just happily stuff them into the preprocessor/compiler/linker
|
||||||
# options and carry on.
|
# options and carry on.
|
||||||
|
|
||||||
|
class UnixCCompiler(CCompiler):
|
||||||
class UnixCCompiler (CCompiler):
|
|
||||||
|
|
||||||
compiler_type = 'unix'
|
compiler_type = 'unix'
|
||||||
|
|
||||||
|
@ -85,8 +85,7 @@ class UnixCCompiler (CCompiler):
|
||||||
verbose=0,
|
verbose=0,
|
||||||
dry_run=0,
|
dry_run=0,
|
||||||
force=0):
|
force=0):
|
||||||
CCompiler.__init__ (self, verbose, dry_run, force)
|
CCompiler.__init__(self, verbose, dry_run, force)
|
||||||
|
|
||||||
|
|
||||||
def preprocess(self,
|
def preprocess(self,
|
||||||
source,
|
source,
|
||||||
|
@ -95,7 +94,6 @@ class UnixCCompiler (CCompiler):
|
||||||
include_dirs=None,
|
include_dirs=None,
|
||||||
extra_preargs=None,
|
extra_preargs=None,
|
||||||
extra_postargs=None):
|
extra_postargs=None):
|
||||||
|
|
||||||
(_, macros, include_dirs) = \
|
(_, macros, include_dirs) = \
|
||||||
self._fix_compile_args(None, macros, include_dirs)
|
self._fix_compile_args(None, macros, include_dirs)
|
||||||
pp_opts = gen_preprocess_options(macros, include_dirs)
|
pp_opts = gen_preprocess_options(macros, include_dirs)
|
||||||
|
@ -119,7 +117,6 @@ class UnixCCompiler (CCompiler):
|
||||||
except DistutilsExecError, msg:
|
except DistutilsExecError, msg:
|
||||||
raise CompileError, msg
|
raise CompileError, msg
|
||||||
|
|
||||||
|
|
||||||
def compile(self,
|
def compile(self,
|
||||||
sources,
|
sources,
|
||||||
output_dir=None,
|
output_dir=None,
|
||||||
|
@ -128,7 +125,6 @@ class UnixCCompiler (CCompiler):
|
||||||
debug=0,
|
debug=0,
|
||||||
extra_preargs=None,
|
extra_preargs=None,
|
||||||
extra_postargs=None):
|
extra_postargs=None):
|
||||||
|
|
||||||
(output_dir, macros, include_dirs) = \
|
(output_dir, macros, include_dirs) = \
|
||||||
self._fix_compile_args(output_dir, macros, include_dirs)
|
self._fix_compile_args(output_dir, macros, include_dirs)
|
||||||
(objects, skip_sources) = self._prep_compile(sources, output_dir)
|
(objects, skip_sources) = self._prep_compile(sources, output_dir)
|
||||||
|
@ -161,15 +157,11 @@ class UnixCCompiler (CCompiler):
|
||||||
# Return *all* object filenames, not just the ones we just built.
|
# Return *all* object filenames, not just the ones we just built.
|
||||||
return objects
|
return objects
|
||||||
|
|
||||||
# compile ()
|
|
||||||
|
|
||||||
|
|
||||||
def create_static_lib(self,
|
def create_static_lib(self,
|
||||||
objects,
|
objects,
|
||||||
output_libname,
|
output_libname,
|
||||||
output_dir=None,
|
output_dir=None,
|
||||||
debug=0):
|
debug=0):
|
||||||
|
|
||||||
(objects, output_dir) = self._fix_object_args(objects, output_dir)
|
(objects, output_dir) = self._fix_object_args(objects, output_dir)
|
||||||
|
|
||||||
output_filename = \
|
output_filename = \
|
||||||
|
@ -194,9 +186,6 @@ class UnixCCompiler (CCompiler):
|
||||||
else:
|
else:
|
||||||
log.debug("skipping %s (up-to-date)", output_filename)
|
log.debug("skipping %s (up-to-date)", output_filename)
|
||||||
|
|
||||||
# create_static_lib ()
|
|
||||||
|
|
||||||
|
|
||||||
def link(self,
|
def link(self,
|
||||||
target_desc,
|
target_desc,
|
||||||
objects,
|
objects,
|
||||||
|
@ -210,7 +199,6 @@ class UnixCCompiler (CCompiler):
|
||||||
extra_preargs=None,
|
extra_preargs=None,
|
||||||
extra_postargs=None,
|
extra_postargs=None,
|
||||||
build_temp=None):
|
build_temp=None):
|
||||||
|
|
||||||
(objects, output_dir) = self._fix_object_args(objects, output_dir)
|
(objects, output_dir) = self._fix_object_args(objects, output_dir)
|
||||||
(libraries, library_dirs, runtime_library_dirs) = \
|
(libraries, library_dirs, runtime_library_dirs) = \
|
||||||
self._fix_lib_args(libraries, library_dirs, runtime_library_dirs)
|
self._fix_lib_args(libraries, library_dirs, runtime_library_dirs)
|
||||||
|
@ -243,9 +231,6 @@ class UnixCCompiler (CCompiler):
|
||||||
else:
|
else:
|
||||||
log.debug("skipping %s (up-to-date)", output_filename)
|
log.debug("skipping %s (up-to-date)", output_filename)
|
||||||
|
|
||||||
# link ()
|
|
||||||
|
|
||||||
|
|
||||||
# -- Miscellaneous methods -----------------------------------------
|
# -- Miscellaneous methods -----------------------------------------
|
||||||
# These are all used by the 'gen_lib_options() function, in
|
# These are all used by the 'gen_lib_options() function, in
|
||||||
# ccompiler.py.
|
# ccompiler.py.
|
||||||
|
@ -275,9 +260,7 @@ class UnixCCompiler (CCompiler):
|
||||||
def library_option(self, lib):
|
def library_option(self, lib):
|
||||||
return "-l" + lib
|
return "-l" + lib
|
||||||
|
|
||||||
|
|
||||||
def find_library_file(self, dirs, lib, debug=0):
|
def find_library_file(self, dirs, lib, debug=0):
|
||||||
|
|
||||||
for dir in dirs:
|
for dir in dirs:
|
||||||
shared = os.path.join(
|
shared = os.path.join(
|
||||||
dir, self.library_filename(lib, lib_type='shared'))
|
dir, self.library_filename(lib, lib_type='shared'))
|
||||||
|
@ -300,7 +283,3 @@ class UnixCCompiler (CCompiler):
|
||||||
else:
|
else:
|
||||||
# Oops, didn't find it in *any* of 'dirs'
|
# Oops, didn't find it in *any* of 'dirs'
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# find_library_file ()
|
|
||||||
|
|
||||||
# class UnixCCompiler
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue