diff options
| author | heretic <[email protected]> | 2022-02-10 16:45:46 +0300 |
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:45:46 +0300 |
| commit | 81eddc8c0b55990194e112b02d127b87d54164a9 (patch) | |
| tree | 9142afc54d335ea52910662635b898e79e192e49 /contrib/libs/grpc/src/python/grpcio/commands.py | |
| parent | 397cbe258b9e064f49c4ca575279f02f39fef76e (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/grpc/src/python/grpcio/commands.py')
| -rw-r--r-- | contrib/libs/grpc/src/python/grpcio/commands.py | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/contrib/libs/grpc/src/python/grpcio/commands.py b/contrib/libs/grpc/src/python/grpcio/commands.py index fddf5bf58f5..8240beb2958 100644 --- a/contrib/libs/grpc/src/python/grpcio/commands.py +++ b/contrib/libs/grpc/src/python/grpcio/commands.py @@ -13,8 +13,8 @@ # limitations under the License. """Provides distutils command classes for the GRPC Python setup process.""" -from __future__ import print_function - +from __future__ import print_function + import distutils import glob import os @@ -101,7 +101,7 @@ class SphinxDocumentation(setuptools.Command): target_dir = os.path.join(GRPC_STEM, 'doc', 'build') exit_code = sphinx.cmd.build.build_main( ['-b', 'html', '-W', '--keep-going', source_dir, target_dir]) - if exit_code != 0: + if exit_code != 0: raise CommandError( "Documentation generation has warnings or errors") @@ -151,10 +151,10 @@ def check_and_update_cythonization(extensions): for source in extension.sources: base, file_ext = os.path.splitext(source) if file_ext == '.pyx': - generated_pyx_source = next((base + gen_ext for gen_ext in ( - '.c', - '.cpp', - ) if os.path.isfile(base + gen_ext)), None) + generated_pyx_source = next((base + gen_ext for gen_ext in ( + '.c', + '.cpp', + ) if os.path.isfile(base + gen_ext)), None) if generated_pyx_source: generated_pyx_sources.append(generated_pyx_source) else: @@ -196,7 +196,7 @@ def try_cythonize(extensions, linetracing=False, mandatory=True): return Cython.Build.cythonize( extensions, include_path=[ - include_dir for extension in extensions + include_dir for extension in extensions for include_dir in extension.include_dirs ] + [CYTHON_STEM], compiler_directives=cython_compiler_directives) @@ -217,13 +217,13 @@ class BuildExt(build_ext.build_ext): """Test if default compiler is okay with specifying c++ version when invoked in C mode. GCC is okay with this, while clang is not. """ - if platform.system() != 'Windows': - return False + if platform.system() != 'Windows': + return False # TODO(lidiz) Remove the generated a.out for success tests. - cc_test = subprocess.Popen(['cc', '-x', 'c', '-std=c++11', '-'], - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + cc_test = subprocess.Popen(['cc', '-x', 'c', '-std=c++11', '-'], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) _, cc_err = cc_test.communicate(input=b'int main(){return 0;}') return not 'invalid argument' in str(cc_err) @@ -273,10 +273,10 @@ class Gather(setuptools.Command): """Command to gather project dependencies.""" description = 'gather dependencies for grpcio' - user_options = [ - ('test', 't', 'flag indicating to gather test dependencies'), - ('install', 'i', 'flag indicating to gather install dependencies') - ] + user_options = [ + ('test', 't', 'flag indicating to gather test dependencies'), + ('install', 'i', 'flag indicating to gather install dependencies') + ] def initialize_options(self): self.test = False @@ -292,43 +292,43 @@ class Gather(setuptools.Command): self.distribution.install_requires) if self.test and self.distribution.tests_require: self.distribution.fetch_build_eggs(self.distribution.tests_require) - - -class Clean(setuptools.Command): - """Command to clean build artifacts.""" - - description = 'Clean build artifacts.' - user_options = [ - ('all', 'a', 'a phony flag to allow our script to continue'), - ] - - _FILE_PATTERNS = ( - 'python_build', - 'src/python/grpcio/__pycache__/', - 'src/python/grpcio/grpc/_cython/cygrpc.cpp', - 'src/python/grpcio/grpc/_cython/*.so', - 'src/python/grpcio/grpcio.egg-info/', - ) - _CURRENT_DIRECTORY = os.path.normpath( - os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../..")) - - def initialize_options(self): - self.all = False - - def finalize_options(self): - pass - - def run(self): - for path_spec in self._FILE_PATTERNS: - this_glob = os.path.normpath( - os.path.join(Clean._CURRENT_DIRECTORY, path_spec)) - abs_paths = glob.glob(this_glob) - for path in abs_paths: - if not str(path).startswith(Clean._CURRENT_DIRECTORY): - raise ValueError( - "Cowardly refusing to delete {}.".format(path)) - print("Removing {}".format(os.path.relpath(path))) - if os.path.isfile(path): - os.remove(str(path)) - else: - shutil.rmtree(str(path)) + + +class Clean(setuptools.Command): + """Command to clean build artifacts.""" + + description = 'Clean build artifacts.' + user_options = [ + ('all', 'a', 'a phony flag to allow our script to continue'), + ] + + _FILE_PATTERNS = ( + 'python_build', + 'src/python/grpcio/__pycache__/', + 'src/python/grpcio/grpc/_cython/cygrpc.cpp', + 'src/python/grpcio/grpc/_cython/*.so', + 'src/python/grpcio/grpcio.egg-info/', + ) + _CURRENT_DIRECTORY = os.path.normpath( + os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../..")) + + def initialize_options(self): + self.all = False + + def finalize_options(self): + pass + + def run(self): + for path_spec in self._FILE_PATTERNS: + this_glob = os.path.normpath( + os.path.join(Clean._CURRENT_DIRECTORY, path_spec)) + abs_paths = glob.glob(this_glob) + for path in abs_paths: + if not str(path).startswith(Clean._CURRENT_DIRECTORY): + raise ValueError( + "Cowardly refusing to delete {}.".format(path)) + print("Removing {}".format(os.path.relpath(path))) + if os.path.isfile(path): + os.remove(str(path)) + else: + shutil.rmtree(str(path)) |
