diff --git a/setup.py b/setup.py index daed3de5..5acf8f41 100644 --- a/setup.py +++ b/setup.py @@ -19,15 +19,6 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -import os -import sys -from typing import List -from typing import Tuple - -import pkg_resources -import setuptools.command.build_py -import setuptools.command.test -from setuptools import Command from setuptools import find_packages from setuptools import setup @@ -38,63 +29,6 @@ with open("requirements.txt") as f: requirements = [r for r in f.read().split("\n") if len(r)] -class BuildPyCommand(setuptools.command.build_py.build_py): - """Custom build command.""" - - def run(self): - self.run_command('build_proto_modules') - setuptools.command.build_py.build_py.run(self) - - -def build_package_protos(package_root, strict_mode=False): - # Import grpc_tools here because it is not available at top of module. - from grpc_tools import protoc - - proto_files = [] - inclusion_root = os.path.abspath(package_root) - for root, _, files in os.walk(inclusion_root): - for filename in files: - if filename.endswith('.proto'): - proto_files.append(os.path.abspath(os.path.join(root, - filename))) - - well_known_protos_include = pkg_resources.resource_filename( - 'grpc_tools', '_proto') - - for proto_file in proto_files: - command = [ - 'grpc_tools.protoc', - '--proto_path={}'.format(inclusion_root), - '--proto_path={}'.format(well_known_protos_include), - '--python_out={}'.format(inclusion_root), - '--grpc_python_out={}'.format(inclusion_root), - '--mypy_out={}'.format(inclusion_root), - ] + [proto_file] - if protoc.main(command) != 0: - if strict_mode: - raise Exception('error: {} failed'.format(command)) - else: - sys.stderr.write('warning: {} failed'.format(command)) - - -class BuildPackageProtos(Command): - """Command to generate project *_pb2.py modules from proto files.""" - - description = 'build grpc protobuf modules' - user_options: List[Tuple[str, str, str]] = [] - - def initialize_options(self): - pass - - def finalize_options(self): - pass - - def run(self): - # import grpc_tools.command - # grpc_tools.command.build_package_protos('.') - build_package_protos('.') - - setup( name="squeaknode", version=__version__, @@ -102,7 +36,7 @@ setup( packages=find_packages(), include_package_data=True, zip_safe=False, - setup_requires=['grpcio-tools==1.39.0', 'wheel==0.37.1'], + setup_requires=['wheel==0.37.1'], install_requires=requirements, extras_require={ "test": ["pytest", "coverage"], @@ -113,8 +47,4 @@ setup( 'squeaknode = squeaknode.main:main', ], }, - cmdclass={ - 'build_proto_modules': BuildPackageProtos, - 'build_py': BuildPyCommand, - }, ) diff --git a/tox.ini b/tox.ini index dfa046b6..ddd7b223 100644 --- a/tox.ini +++ b/tox.ini @@ -19,5 +19,3 @@ commands = [testenv:setup] basepython = python3.8 -commands = - {envbindir}/python setup.py build_proto_modules