Commit 336ca7b1 authored by Stefan Behnel's avatar Stefan Behnel

Minor code reformatting.

parent 58e75071
...@@ -18,12 +18,12 @@ try: ...@@ -18,12 +18,12 @@ try:
except ImportError: except ImportError:
basestring = str basestring = str
from . import Errors
# Do not import Parsing here, import it when needed, because Parsing imports # Do not import Parsing here, import it when needed, because Parsing imports
# Nodes, which globally needs debug command line options initialized to set a # Nodes, which globally needs debug command line options initialized to set a
# conditional metaclass. These options are processed by CmdLine called from # conditional metaclass. These options are processed by CmdLine called from
# main() in this file. # main() in this file.
# import Parsing # import Parsing
from . import Errors
from .StringEncoding import EncodedString from .StringEncoding import EncodedString
from .Scanning import PyrexScanner, FileSourceDescriptor from .Scanning import PyrexScanner, FileSourceDescriptor
from .Errors import PyrexError, CompileError, error, warning from .Errors import PyrexError, CompileError, error, warning
...@@ -38,6 +38,7 @@ module_name_pattern = re.compile(r"[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_ ...@@ -38,6 +38,7 @@ module_name_pattern = re.compile(r"[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_
verbose = 0 verbose = 0
class CompilationData(object): class CompilationData(object):
# Bundles the information that is passed from transform to transform. # Bundles the information that is passed from transform to transform.
# (For now, this is only) # (For now, this is only)
...@@ -52,6 +53,7 @@ class CompilationData(object): ...@@ -52,6 +53,7 @@ class CompilationData(object):
# result CompilationResult # result CompilationResult
pass pass
class Context(object): class Context(object):
# This class encapsulates the context needed for compiling # This class encapsulates the context needed for compiling
# one or more Cython implementation files along with their # one or more Cython implementation files along with their
...@@ -239,7 +241,7 @@ class Context(object): ...@@ -239,7 +241,7 @@ class Context(object):
pxd = self.search_include_directories(qualified_name, ".pxd", pos, sys_path=sys_path) pxd = self.search_include_directories(qualified_name, ".pxd", pos, sys_path=sys_path)
if pxd is None: # XXX Keep this until Includes/Deprecated is removed if pxd is None: # XXX Keep this until Includes/Deprecated is removed
if (qualified_name.startswith('python') or if (qualified_name.startswith('python') or
qualified_name in ('stdlib', 'stdio', 'stl')): qualified_name in ('stdlib', 'stdio', 'stl')):
standard_include_path = os.path.abspath(os.path.normpath( standard_include_path = os.path.abspath(os.path.normpath(
os.path.join(os.path.dirname(__file__), os.path.pardir, 'Includes'))) os.path.join(os.path.dirname(__file__), os.path.pardir, 'Includes')))
deprecated_include_path = os.path.join(standard_include_path, 'Deprecated') deprecated_include_path = os.path.join(standard_include_path, 'Deprecated')
...@@ -426,6 +428,7 @@ class Context(object): ...@@ -426,6 +428,7 @@ class Context(object):
pass pass
result.c_file = None result.c_file = None
def get_output_filename(source_filename, cwd, options): def get_output_filename(source_filename, cwd, options):
if options.cplus: if options.cplus:
c_suffix = ".cpp" c_suffix = ".cpp"
...@@ -441,6 +444,7 @@ def get_output_filename(source_filename, cwd, options): ...@@ -441,6 +444,7 @@ def get_output_filename(source_filename, cwd, options):
else: else:
return suggested_file_name return suggested_file_name
def create_default_resultobj(compilation_source, options): def create_default_resultobj(compilation_source, options):
result = CompilationResult() result = CompilationResult()
result.main_source_file = compilation_source.source_desc.filename result.main_source_file = compilation_source.source_desc.filename
...@@ -451,6 +455,7 @@ def create_default_resultobj(compilation_source, options): ...@@ -451,6 +455,7 @@ def create_default_resultobj(compilation_source, options):
result.embedded_metadata = options.embedded_metadata result.embedded_metadata = options.embedded_metadata
return result return result
def run_pipeline(source, options, full_module_name=None, context=None): def run_pipeline(source, options, full_module_name=None, context=None):
from . import Pipeline from . import Pipeline
...@@ -496,11 +501,11 @@ def run_pipeline(source, options, full_module_name=None, context=None): ...@@ -496,11 +501,11 @@ def run_pipeline(source, options, full_module_name=None, context=None):
return result return result
#------------------------------------------------------------------------ # ------------------------------------------------------------------------
# #
# Main Python entry points # Main Python entry points
# #
#------------------------------------------------------------------------ # ------------------------------------------------------------------------
class CompilationSource(object): class CompilationSource(object):
""" """
...@@ -512,6 +517,7 @@ class CompilationSource(object): ...@@ -512,6 +517,7 @@ class CompilationSource(object):
self.full_module_name = full_module_name self.full_module_name = full_module_name
self.cwd = cwd self.cwd = cwd
class CompilationOptions(object): class CompilationOptions(object):
""" """
Options to the Cython compiler: Options to the Cython compiler:
...@@ -678,6 +684,7 @@ def compile_multiple(sources, options): ...@@ -678,6 +684,7 @@ def compile_multiple(sources, options):
processed.add(source) processed.add(source)
return results return results
def compile(source, options = None, full_module_name = None, **kwds): def compile(source, options = None, full_module_name = None, **kwds):
""" """
compile(source [, options], [, <option> = <value>]...) compile(source [, options], [, <option> = <value>]...)
...@@ -694,14 +701,17 @@ def compile(source, options = None, full_module_name = None, **kwds): ...@@ -694,14 +701,17 @@ def compile(source, options = None, full_module_name = None, **kwds):
else: else:
return compile_multiple(source, options) return compile_multiple(source, options)
#------------------------------------------------------------------------
# ------------------------------------------------------------------------
# #
# Main command-line entry point # Main command-line entry point
# #
#------------------------------------------------------------------------ # ------------------------------------------------------------------------
def setuptools_main(): def setuptools_main():
return main(command_line = 1) return main(command_line = 1)
def main(command_line = 0): def main(command_line = 0):
args = sys.argv[1:] args = sys.argv[1:]
any_failures = 0 any_failures = 0
...@@ -727,12 +737,11 @@ def main(command_line = 0): ...@@ -727,12 +737,11 @@ def main(command_line = 0):
sys.exit(1) sys.exit(1)
# ------------------------------------------------------------------------
#------------------------------------------------------------------------
# #
# Set the default options depending on the platform # Set the default options depending on the platform
# #
#------------------------------------------------------------------------ # ------------------------------------------------------------------------
default_options = dict( default_options = dict(
show_version = 0, show_version = 0,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment