<commit_before># Copyright 2010-2012 RethinkDB, all rights reserved.

from setuptools import setup, Extension
from distutils.command.build_ext import build_ext
from distutils.errors import DistutilsPlatformError, CCompilerError, DistutilsExecError
import sys

class build_ext_nofail(build_ext):
    # This class can replace the build_ext command with one that does not fail
    # when the extension fails to build.

    def run(self):
        try:
            build_ext.run(self)
        except DistutilsPlatformError as e:
            self._failed(e)

    def build_extension(self, ext):
        try:
            build_ext.build_extension(self, ext)
        except (CCompilerError, DistutilsExecError) as e:
            self._failed(e)
        else:
            try:
                import google.protobuf.internal.cpp_message
            except ImportError:
                print >> sys.stderr, "*** WARNING: The installed protobuf library does not seem to include the C++ extension"
                print >> sys.stderr, "*** WARNING: The RethinkDB driver will fallback to using the pure python implementation"

    def _failed(self, e):
            print >> sys.stderr, "*** WARNING: Unable to compile the C++ extension"
            print >> sys.stderr, e
            print >> sys.stderr, "*** WARNING: Defaulting to the python implementation"

setup(name="rethinkdb"
     ,version="1.8.0-0"
     ,description="This package provides the Python driver library for the RethinkDB database server."
     ,url="http://rethinkdb.com"
     ,maintainer="RethinkDB Inc."
     ,maintainer_email="<EMAIL>"
     ,packages=['rethinkdb']
     ,install_requires=['protobuf']
     ,ext_modules=[Extension('rethinkdb_pbcpp', sources=['./rethinkdb/pbcpp.cpp', './rethinkdb/ql2.pb.cc'],
                             include_dirs=['./rethinkdb'], libraries=['protobuf'])]
     ,cmdclass={"build_ext":build_ext_nofail}
)<commit_msg>fix setup script for Python 3<commit_after># Copyright 2010-2012 RethinkDB, all rights reserved.

from setuptools import setup, Extension
from distutils.command.build_ext import build_ext
from distutils.errors import DistutilsPlatformError, CCompilerError, DistutilsExecError
import sys

class build_ext_nofail(build_ext):
    # This class can replace the build_ext command with one that does not fail
    # when the extension fails to build.

    def run(self):
        try:
            build_ext.run(self)
        except DistutilsPlatformError as e:
            self._failed(e)

    def build_extension(self, ext):
        try:
            build_ext.build_extension(self, ext)
        except (CCompilerError, DistutilsExecError) as e:
            self._failed(e)
        else:
            try:
                import google.protobuf.internal.cpp_message
            except ImportError:
                print("*** WARNING: The installed protobuf library does not seem to include the C++ extension", file=sys.stderr)
                print("*** WARNING: The RethinkDB driver will fallback to using the pure python implementation", file=sys.stderr) 

    def _failed(self, e):
            print("*** WARNING: Unable to compile the C++ extension", file=sys.stderr)
            print(e, file=sys.stderr)
            print("*** WARNING: Defaulting to the python implementation", file=sys.stderr)

setup(name="rethinkdb"
     ,version="1.8.0-0"
     ,description="This package provides the Python driver library for the RethinkDB database server."
     ,url="http://rethinkdb.com"
     ,maintainer="RethinkDB Inc."
     ,maintainer_email="<EMAIL>"
     ,packages=['rethinkdb']
     ,install_requires=['protobuf']
     ,ext_modules=[Extension('rethinkdb_pbcpp', sources=['./rethinkdb/pbcpp.cpp', './rethinkdb/ql2.pb.cc'],
                             include_dirs=['./rethinkdb'], libraries=['protobuf'])]
     ,cmdclass={"build_ext":build_ext_nofail}
)
{'fraction_non_alphanumeric': 0.10440414507772021, 'fraction_numerical': 0.006994818652849741, 'mean_word_length': 2.919796954314721, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5359794', 'n_tokens_mistral': 1109, 'n_tokens_neox': 1075, 'n_words': 304}