aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/tools/cython/Cython/Build/Cythonize.py
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:44:49 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:49 +0300
commit718c552901d703c502ccbefdfc3c9028d608b947 (patch)
tree46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/tools/cython/Cython/Build/Cythonize.py
parente9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff)
downloadydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/tools/cython/Cython/Build/Cythonize.py')
-rw-r--r--contrib/tools/cython/Cython/Build/Cythonize.py94
1 files changed, 47 insertions, 47 deletions
diff --git a/contrib/tools/cython/Cython/Build/Cythonize.py b/contrib/tools/cython/Cython/Build/Cythonize.py
index c85b6eabab..caa3cebc0e 100644
--- a/contrib/tools/cython/Cython/Build/Cythonize.py
+++ b/contrib/tools/cython/Cython/Build/Cythonize.py
@@ -21,27 +21,27 @@ except ImportError:
class _FakePool(object):
def map_async(self, func, args):
- try:
- from itertools import imap
- except ImportError:
- imap=map
+ try:
+ from itertools import imap
+ except ImportError:
+ imap=map
for _ in imap(func, args):
pass
- def close(self):
- pass
-
- def terminate(self):
- pass
-
- def join(self):
- pass
+ def close(self):
+ pass
+ def terminate(self):
+ pass
+ def join(self):
+ pass
+
+
def parse_directives(option, name, value, parser):
dest = option.dest
old_directives = dict(getattr(parser.values, dest,
- Options.get_directive_defaults()))
+ Options.get_directive_defaults()))
directives = Options.parse_directive_list(
value, relaxed_bool=True, current_settings=old_directives)
setattr(parser.values, dest, directives)
@@ -60,13 +60,13 @@ def parse_options(option, name, value, parser):
setattr(parser.values, dest, options)
-def parse_compile_time_env(option, name, value, parser):
- dest = option.dest
- old_env = dict(getattr(parser.values, dest, {}))
- new_env = Options.parse_compile_time_env(value, current_settings=old_env)
- setattr(parser.values, dest, new_env)
-
-
+def parse_compile_time_env(option, name, value, parser):
+ dest = option.dest
+ old_env = dict(getattr(parser.values, dest, {}))
+ new_env = Options.parse_compile_time_env(value, current_settings=old_env)
+ setattr(parser.values, dest, new_env)
+
+
def find_package_base(path):
base_dir, package_path = os.path.split(path)
while os.path.isfile(os.path.join(base_dir, '__init__.py')):
@@ -77,9 +77,9 @@ def find_package_base(path):
def cython_compile(path_pattern, options):
pool = None
- all_paths = map(os.path.abspath, extended_iglob(path_pattern))
+ all_paths = map(os.path.abspath, extended_iglob(path_pattern))
try:
- for path in all_paths:
+ for path in all_paths:
if options.build_inplace:
base_dir = path
while not os.path.isdir(base_dir) or is_package_dir(base_dir):
@@ -89,7 +89,7 @@ def cython_compile(path_pattern, options):
if os.path.isdir(path):
# recursively compiling a package
- paths = [os.path.join(path, '**', '*.{py,pyx}')]
+ paths = [os.path.join(path, '**', '*.{py,pyx}')]
else:
# assume it's a file(-like thing)
paths = [path]
@@ -100,7 +100,7 @@ def cython_compile(path_pattern, options):
exclude_failures=options.keep_going,
exclude=options.excludes,
compiler_directives=options.directives,
- compile_time_env=options.compile_time_env,
+ compile_time_env=options.compile_time_env,
force=options.force,
quiet=options.quiet,
depfile=options.depfile,
@@ -153,26 +153,26 @@ def parse_args(args):
from optparse import OptionParser
parser = OptionParser(usage='%prog [options] [sources and packages]+')
- parser.add_option('-X', '--directive', metavar='NAME=VALUE,...',
- dest='directives', default={}, type="str",
- action='callback', callback=parse_directives,
+ parser.add_option('-X', '--directive', metavar='NAME=VALUE,...',
+ dest='directives', default={}, type="str",
+ action='callback', callback=parse_directives,
help='set a compiler directive')
- parser.add_option('-E', '--compile-time-env', metavar='NAME=VALUE,...',
- dest='compile_time_env', default={}, type="str",
- action='callback', callback=parse_compile_time_env,
- help='set a compile time environment variable')
- parser.add_option('-s', '--option', metavar='NAME=VALUE',
- dest='options', default={}, type="str",
- action='callback', callback=parse_options,
+ parser.add_option('-E', '--compile-time-env', metavar='NAME=VALUE,...',
+ dest='compile_time_env', default={}, type="str",
+ action='callback', callback=parse_compile_time_env,
+ help='set a compile time environment variable')
+ parser.add_option('-s', '--option', metavar='NAME=VALUE',
+ dest='options', default={}, type="str",
+ action='callback', callback=parse_options,
help='set a cythonize option')
- parser.add_option('-2', dest='language_level', action='store_const', const=2, default=None,
- help='use Python 2 syntax mode by default')
- parser.add_option('-3', dest='language_level', action='store_const', const=3,
- help='use Python 3 syntax mode by default')
- parser.add_option('--3str', dest='language_level', action='store_const', const='3str',
+ parser.add_option('-2', dest='language_level', action='store_const', const=2, default=None,
+ help='use Python 2 syntax mode by default')
+ parser.add_option('-3', dest='language_level', action='store_const', const=3,
help='use Python 3 syntax mode by default')
- parser.add_option('-a', '--annotate', dest='annotate', action='store_true',
- help='generate annotated HTML page for source files')
+ parser.add_option('--3str', dest='language_level', action='store_const', const='3str',
+ help='use Python 3 syntax mode by default')
+ parser.add_option('-a', '--annotate', dest='annotate', action='store_true',
+ help='generate annotated HTML page for source files')
parser.add_option('-x', '--exclude', metavar='PATTERN', dest='excludes',
action='append', default=[],
@@ -204,9 +204,9 @@ def parse_args(args):
options.build = True
if multiprocessing is None:
options.parallel = 0
- if options.language_level:
- assert options.language_level in (2, 3, '3str')
- options.options['language_level'] = options.language_level
+ if options.language_level:
+ assert options.language_level in (2, 3, '3str')
+ options.options['language_level'] = options.language_level
return options, args
@@ -218,9 +218,9 @@ def main(args=None):
Options.error_on_unknown_names = False
Options.error_on_uninitialized = False
- if options.annotate:
- Options.annotate = True
-
+ if options.annotate:
+ Options.annotate = True
+
for path in paths:
cython_compile(path, options)