From d790dd6a5cb116245a8054692a1e10713d7512ac Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Thu, 11 Aug 2016 17:32:50 -0700 Subject: Fix python build --- setup.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index cad300c144..895fd663d6 100644 --- a/setup.py +++ b/setup.py @@ -52,6 +52,11 @@ PYTHON_STEM = os.path.join('src', 'python', 'grpcio') CORE_INCLUDE = ('include', '.',) BORINGSSL_INCLUDE = (os.path.join('third_party', 'boringssl', 'include'),) ZLIB_INCLUDE = (os.path.join('third_party', 'zlib'),) +CARES_INCLUDE = (os.path.join('third_party', 'c-ares'), os.path.join('src', 'c-ares'),) +if "linux" in sys.platform: + CARES_INCLUDE += (os.path.join('src', 'c-ares', 'config_linux'),) +if "darwin" in sys.platform: + CARES_INCLUDE += (os.path.join('src', 'c-ares', 'config_darwin'),) # Ensure we're in the proper directory whether or not we're being used by pip. os.chdir(os.path.dirname(os.path.abspath(__file__))) @@ -129,7 +134,7 @@ CYTHON_HELPER_C_FILES = () CORE_C_FILES = tuple(grpc_core_dependencies.CORE_SOURCE_FILES) EXTENSION_INCLUDE_DIRECTORIES = ( - (PYTHON_STEM,) + CORE_INCLUDE + BORINGSSL_INCLUDE + ZLIB_INCLUDE) + (PYTHON_STEM,) + CORE_INCLUDE + BORINGSSL_INCLUDE + ZLIB_INCLUDE + CARES_INCLUDE) EXTENSION_LIBRARIES = () if "linux" in sys.platform: @@ -141,7 +146,7 @@ if "win32" in sys.platform: DEFINE_MACROS = ( ('OPENSSL_NO_ASM', 1), ('_WIN32_WINNT', 0x600), - ('GPR_BACKWARDS_COMPATIBILITY_MODE', 1),) + ('GPR_BACKWARDS_COMPATIBILITY_MODE', 1), ('HAVE_CONFIG_H', 1),) if "win32" in sys.platform: DEFINE_MACROS += (('OPENSSL_WINDOWS', 1), ('WIN32_LEAN_AND_MEAN', 1),) if '64bit' in platform.architecture()[0]: -- cgit v1.2.3 From f64bf28e87356ca2ea26dfcfcb576de565180ad0 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Thu, 11 Aug 2016 21:21:32 -0700 Subject: Build c-ares without running ./configure --- .gitmodules | 1 + Makefile | 6 +++--- build.yaml | 9 ++++----- setup.py | 14 ++++++++------ src/c-ares/gen_build_yaml.py | 3 +-- templates/Makefile.template | 5 +++-- third_party/c-ares | 2 +- tools/buildgen/plugins/expand_bin_attrs.py | 2 ++ tools/buildgen/plugins/expand_filegroups.py | 1 + tools/distrib/check_copyright.py | 4 +++- 10 files changed, 27 insertions(+), 20 deletions(-) (limited to 'setup.py') diff --git a/.gitmodules b/.gitmodules index 3dd8247048..01b8fab98d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -20,3 +20,4 @@ [submodule "third_party/c-ares"] path = third_party/c-ares url = https://github.com/c-ares/c-ares.git + branch = cares-1_11_0 diff --git a/Makefile b/Makefile index f67e1f352f..58b3977582 100644 --- a/Makefile +++ b/Makefile @@ -1252,8 +1252,6 @@ $(LIBDIR)/$(CONFIG)/c-ares/libcares.a: third_party/c-ares/configure $(Q)$(MAKE) -C third_party/c-ares $(Q)mkdir -p $(LIBDIR)/$(CONFIG)/c-ares $(Q)cp third_party/c-ares/.libs/libcares.a $(LIBDIR)/$(CONFIG) - # $(Q)[ -f third_party/c-ares/.libs/libcares.2.dylib ] && cp third_party/c-ares/.libs/libcares.2.dylib $(LIBDIR)/$(CONFIG)/c-ares - # $(Q)[ -f third_party/c-ares/.libs/libcares.dylib ] && cp third_party/c-ares/.libs/libcares.dylib $(LIBDIR)/$(CONFIG)/c-ares $(OBJDIR)/$(CONFIG)/src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper.o: third_party/c-ares/configure $(OBJDIR)/$(CONFIG)/src/core/ext/resolver/dns/c_ares/grpc_ares_ev_driver_posix.o: third_party/c-ares/configure @@ -6615,8 +6613,10 @@ PUBLIC_HEADERS_C += \ LIBARES_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBARES_SRC)))) +$(LIBARES_OBJS): CPPFLAGS += -Ithird_party/c-ares -Isrc/c-ares $(if $(subst Linux,,$(SYSTEM)),,-Isrc/c-ares/config_linux) -fvisibility=hidden -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DHAVE_CONFIG_H +$(LIBARES_OBJS): CFLAGS += -Wno-sign-conversion -Wno-invalid-source-encoding -$(LIBDIR)/$(CONFIG)/libares.a: $(ZLIB_DEP) $(LIBARES_OBJS) $(CARES_DEP) +$(LIBDIR)/$(CONFIG)/libares.a: $(ZLIB_DEP) third_party/c-ares/configure $(LIBARES_OBJS) $(CARES_DEP) $(E) "[AR] Creating $@" $(Q) mkdir -p `dirname $@` $(Q) rm -f $(LIBDIR)/$(CONFIG)/libares.a diff --git a/build.yaml b/build.yaml index a8df258151..d636287403 100644 --- a/build.yaml +++ b/build.yaml @@ -3375,11 +3375,10 @@ configs: timeout_multiplier: 1.5 defaults: ares: - CFLAGS: -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas - -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) - -DHAVE_CONFIG_H - CPPFLAGS: -Ithird_party/boringssl/include -fvisibility=hidden -DOPENSSL_NO_ASM - -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX + CFLAGS: -Wno-sign-conversion -Wno-invalid-source-encoding + CPPFLAGS: -Ithird_party/c-ares -Isrc/c-ares $(if $(subst Linux,,$(SYSTEM)),,-Isrc/c-ares/config_linux) + -fvisibility=hidden -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 + -DNOMINMAX -DHAVE_CONFIG_H boringssl: CFLAGS: -Wno-sign-conversion -Wno-conversion -Wno-unused-value -Wno-unknown-pragmas -Wno-implicit-function-declaration -Wno-unused-variable -Wno-sign-compare $(NO_W_EXTRA_SEMI) diff --git a/setup.py b/setup.py index 895fd663d6..e59f4286b4 100644 --- a/setup.py +++ b/setup.py @@ -52,11 +52,12 @@ PYTHON_STEM = os.path.join('src', 'python', 'grpcio') CORE_INCLUDE = ('include', '.',) BORINGSSL_INCLUDE = (os.path.join('third_party', 'boringssl', 'include'),) ZLIB_INCLUDE = (os.path.join('third_party', 'zlib'),) -CARES_INCLUDE = (os.path.join('third_party', 'c-ares'), os.path.join('src', 'c-ares'),) -if "linux" in sys.platform: - CARES_INCLUDE += (os.path.join('src', 'c-ares', 'config_linux'),) -if "darwin" in sys.platform: - CARES_INCLUDE += (os.path.join('src', 'c-ares', 'config_darwin'),) +CARES_INCLUDE = ( + os.path.join('third_party', 'c-ares'), os.path.join('src', 'c-ares'),) +if 'linux' in sys.platform: + CARES_INCLUDE += (os.path.join('src', 'c-ares', 'config_linux'),) +if 'darwin' in sys.platform: + CARES_INCLUDE += (os.path.join('src', 'c-ares', 'config_darwin'),) # Ensure we're in the proper directory whether or not we're being used by pip. os.chdir(os.path.dirname(os.path.abspath(__file__))) @@ -134,7 +135,8 @@ CYTHON_HELPER_C_FILES = () CORE_C_FILES = tuple(grpc_core_dependencies.CORE_SOURCE_FILES) EXTENSION_INCLUDE_DIRECTORIES = ( - (PYTHON_STEM,) + CORE_INCLUDE + BORINGSSL_INCLUDE + ZLIB_INCLUDE + CARES_INCLUDE) + (PYTHON_STEM,) + CORE_INCLUDE + BORINGSSL_INCLUDE + ZLIB_INCLUDE + + CARES_INCLUDE) EXTENSION_LIBRARIES = () if "linux" in sys.platform: diff --git a/src/c-ares/gen_build_yaml.py b/src/c-ares/gen_build_yaml.py index 6cde19a915..1081b4b311 100755 --- a/src/c-ares/gen_build_yaml.py +++ b/src/c-ares/gen_build_yaml.py @@ -59,10 +59,9 @@ try: gen_ares_build(x) return 'third_party/c-ares/ares_build.h' - - out['libs'] = [{ 'name': 'ares', + 'defaults': 'ares', 'build': 'private', 'language': 'c', 'secure': 'no', diff --git a/templates/Makefile.template b/templates/Makefile.template index b06aa17263..8e4c87b640 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -894,8 +894,6 @@ $(Q)$(MAKE) -C third_party/c-ares $(Q)mkdir -p $(LIBDIR)/$(CONFIG)/c-ares $(Q)cp third_party/c-ares/.libs/libcares.a $(LIBDIR)/$(CONFIG) - # $(Q)[ -f third_party/c-ares/.libs/libcares.2.dylib ] && cp third_party/c-ares/.libs/libcares.2.dylib $(LIBDIR)/$(CONFIG)/c-ares - # $(Q)[ -f third_party/c-ares/.libs/libcares.dylib ] && cp third_party/c-ares/.libs/libcares.dylib $(LIBDIR)/$(CONFIG)/c-ares $(OBJDIR)/$(CONFIG)/src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper.o: third_party/c-ares/configure $(OBJDIR)/$(CONFIG)/src/core/ext/resolver/dns/c_ares/grpc_ares_ev_driver_posix.o: third_party/c-ares/configure @@ -1499,6 +1497,9 @@ % if lib.name != 'z': $(ZLIB_DEP) \ % endif + % if lib.name == 'ares': + third_party/c-ares/configure \ + % endif % endif % if lib.language == 'c++': $(PROTOBUF_DEP)\ diff --git a/third_party/c-ares b/third_party/c-ares index 7d3e99fd5c..e7fe2744db 160000 --- a/third_party/c-ares +++ b/third_party/c-ares @@ -1 +1 @@ -Subproject commit 7d3e99fd5c57d61a420f2e1419989740916fbeb2 +Subproject commit e7fe2744db383c4489b7adc2b74f8ec3069367e4 diff --git a/tools/buildgen/plugins/expand_bin_attrs.py b/tools/buildgen/plugins/expand_bin_attrs.py index dc72bf3b9d..f52168a9d3 100755 --- a/tools/buildgen/plugins/expand_bin_attrs.py +++ b/tools/buildgen/plugins/expand_bin_attrs.py @@ -52,9 +52,11 @@ def mako_plugin(dictionary): tgt['ci_platforms'] = sorted(tgt.get('ci_platforms', tgt['platforms'])) tgt['boringssl'] = tgt.get('boringssl', False) tgt['zlib'] = tgt.get('zlib', False) + tgt['ares'] = tgt.get('ares', False) tgt['gtest'] = tgt.get('gtest', False) libs = dictionary.get('libs') for lib in libs: lib['boringssl'] = lib.get('boringssl', False) lib['zlib'] = lib.get('zlib', False) + lib['ares'] = lib.get('ares', False) diff --git a/tools/buildgen/plugins/expand_filegroups.py b/tools/buildgen/plugins/expand_filegroups.py index 477e69c869..6cee27ee46 100755 --- a/tools/buildgen/plugins/expand_filegroups.py +++ b/tools/buildgen/plugins/expand_filegroups.py @@ -57,6 +57,7 @@ FILEGROUP_DEFAULTS = { 'language': 'c', 'boringssl': False, 'zlib': False, + 'ares': False, } diff --git a/tools/distrib/check_copyright.py b/tools/distrib/check_copyright.py index 4577ab3d11..3757c90afd 100755 --- a/tools/distrib/check_copyright.py +++ b/tools/distrib/check_copyright.py @@ -108,7 +108,9 @@ RE_LICENSE = dict( if args.precommit: FILE_LIST_COMMAND = 'git status -z | grep -Poz \'(?<=^[MARC][MARCD ] )[^\s]+\'' else: - FILE_LIST_COMMAND = 'git ls-tree -r --name-only -r HEAD | grep -v ^third_party/' + FILE_LIST_COMMAND = 'git ls-tree -r --name-only -r HEAD | ' \ + 'grep -v ^third_party/ |' \ + 'grep -v "\(ares_config.h\|ares_build.h\)"' def load(name): with open(name) as f: -- cgit v1.2.3 From 88d4e779b92aa5a9c4ad5384fe73dee152d10127 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Tue, 16 Aug 2016 22:34:02 -0700 Subject: Fix python build on windows --- package.json | 2 +- setup.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'setup.py') diff --git a/package.json b/package.json index 4b175fe4c5..c74dbe45e3 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "test": "./node_modules/.bin/mocha src/node/test && npm run-script lint", "gen_docs": "./node_modules/.bin/jsdoc -c src/node/jsdoc_conf.json", "coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha src/node/test", - "install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build --library='static_library'" + "install": "./node_modules/.bin/node-pre-gyp install --fallback-to-build --library=static_library" }, "bundledDependencies": ["node-pre-gyp"], "dependencies": { diff --git a/setup.py b/setup.py index a408d24ff9..1ef03cff15 100644 --- a/setup.py +++ b/setup.py @@ -148,11 +148,13 @@ if "win32" in sys.platform: DEFINE_MACROS = ( ('OPENSSL_NO_ASM', 1), ('_WIN32_WINNT', 0x600), - ('GPR_BACKWARDS_COMPATIBILITY_MODE', 1), ('HAVE_CONFIG_H', 1),) + ('GPR_BACKWARDS_COMPATIBILITY_MODE', 1),) if "win32" in sys.platform: DEFINE_MACROS += (('OPENSSL_WINDOWS', 1), ('WIN32_LEAN_AND_MEAN', 1),) if '64bit' in platform.architecture()[0]: DEFINE_MACROS += (('MS_WIN64', 1),) +else: + DEFINE_MACROS += (('HAVE_CONFIG_H', 1),) LDFLAGS = tuple(EXTRA_LINK_ARGS) CFLAGS = tuple(EXTRA_COMPILE_ARGS) -- cgit v1.2.3 From e35d722988cf36962b38ee2a40acbe5ea9cad69f Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Tue, 16 Aug 2016 23:41:47 -0700 Subject: Trying to fix python on windows --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 1ef03cff15..f7ba8911e2 100644 --- a/setup.py +++ b/setup.py @@ -150,7 +150,8 @@ DEFINE_MACROS = ( ('OPENSSL_NO_ASM', 1), ('_WIN32_WINNT', 0x600), ('GPR_BACKWARDS_COMPATIBILITY_MODE', 1),) if "win32" in sys.platform: - DEFINE_MACROS += (('OPENSSL_WINDOWS', 1), ('WIN32_LEAN_AND_MEAN', 1),) + DEFINE_MACROS += (('OPENSSL_WINDOWS', 1), ('WIN32_LEAN_AND_MEAN', 1), + ('CARES_STATICLIB', 1),) if '64bit' in platform.architecture()[0]: DEFINE_MACROS += (('MS_WIN64', 1),) else: -- cgit v1.2.3 From e5d99668be7a39d316332725e7a21f07550fe552 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Mon, 7 Nov 2016 18:52:28 -0800 Subject: Fix python build --- setup.py | 3 --- 1 file changed, 3 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 2c663b826c..69bd4331ba 100644 --- a/setup.py +++ b/setup.py @@ -52,16 +52,13 @@ PYTHON_STEM = os.path.join('src', 'python', 'grpcio') CORE_INCLUDE = ('include', '.',) BORINGSSL_INCLUDE = (os.path.join('third_party', 'boringssl', 'include'),) ZLIB_INCLUDE = (os.path.join('third_party', 'zlib'),) -<<<<<<< HEAD CARES_INCLUDE = ( os.path.join('third_party', 'c-ares'), os.path.join('src', 'c-ares'),) if 'linux' in sys.platform: CARES_INCLUDE += (os.path.join('src', 'c-ares', 'config_linux'),) if 'darwin' in sys.platform: CARES_INCLUDE += (os.path.join('src', 'c-ares', 'config_darwin'),) -======= README = os.path.join(PYTHON_STEM, 'README.rst') ->>>>>>> upstream/master # Ensure we're in the proper directory whether or not we're being used by pip. os.chdir(os.path.dirname(os.path.abspath(__file__))) -- cgit v1.2.3 From 6694bb079a74c0636acd6c107d0c3b9c32317338 Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Mon, 23 Jan 2017 17:09:51 -0800 Subject: Migrate to the new c-ares dir --- CMakeLists.txt | 98 +++---- Makefile | 108 +++---- binding.gyp | 2 +- build.yaml | 4 +- grpc.gemspec | 146 +++++----- setup.py | 80 +++--- src/c-ares/gen_build_yaml.py | 168 +++++------ src/python/grpcio/grpc_core_dependencies.py | 98 +++---- templates/Makefile.template | 8 +- templates/binding.gyp.template | 2 +- tools/run_tests/generated/sources_and_headers.json | 54 ++-- vsprojects/vcxproj/ares/ares.vcxproj | 146 +++++----- vsprojects/vcxproj/ares/ares.vcxproj.filters | 315 ++++++++++----------- 13 files changed, 605 insertions(+), 624 deletions(-) (limited to 'setup.py') diff --git a/CMakeLists.txt b/CMakeLists.txt index 71232cce0b..b1f5fb07fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4419,55 +4419,55 @@ endif (gRPC_BUILD_TESTS) if (gRPC_BUILD_TESTS) add_library(ares - third_party/c-ares/ares__close_sockets.c - third_party/c-ares/ares__get_hostent.c - third_party/c-ares/ares__read_line.c - third_party/c-ares/ares__timeval.c - third_party/c-ares/ares_cancel.c - third_party/c-ares/ares_create_query.c - third_party/c-ares/ares_data.c - third_party/c-ares/ares_destroy.c - third_party/c-ares/ares_expand_name.c - third_party/c-ares/ares_expand_string.c - third_party/c-ares/ares_fds.c - third_party/c-ares/ares_free_hostent.c - third_party/c-ares/ares_free_string.c - third_party/c-ares/ares_getenv.c - third_party/c-ares/ares_gethostbyaddr.c - third_party/c-ares/ares_gethostbyname.c - third_party/c-ares/ares_getnameinfo.c - third_party/c-ares/ares_getopt.c - third_party/c-ares/ares_getsock.c - third_party/c-ares/ares_init.c - third_party/c-ares/ares_library_init.c - third_party/c-ares/ares_llist.c - third_party/c-ares/ares_mkquery.c - third_party/c-ares/ares_nowarn.c - third_party/c-ares/ares_options.c - third_party/c-ares/ares_parse_a_reply.c - third_party/c-ares/ares_parse_aaaa_reply.c - third_party/c-ares/ares_parse_mx_reply.c - third_party/c-ares/ares_parse_naptr_reply.c - third_party/c-ares/ares_parse_ns_reply.c - third_party/c-ares/ares_parse_ptr_reply.c - third_party/c-ares/ares_parse_soa_reply.c - third_party/c-ares/ares_parse_srv_reply.c - third_party/c-ares/ares_parse_txt_reply.c - third_party/c-ares/ares_platform.c - third_party/c-ares/ares_process.c - third_party/c-ares/ares_query.c - third_party/c-ares/ares_search.c - third_party/c-ares/ares_send.c - third_party/c-ares/ares_strcasecmp.c - third_party/c-ares/ares_strdup.c - third_party/c-ares/ares_strerror.c - third_party/c-ares/ares_timeout.c - third_party/c-ares/ares_version.c - third_party/c-ares/ares_writev.c - third_party/c-ares/bitncmp.c - third_party/c-ares/inet_net_pton.c - third_party/c-ares/inet_ntop.c - third_party/c-ares/windows_port.c + third_party/cares/cares/ares__close_sockets.c + third_party/cares/cares/ares__get_hostent.c + third_party/cares/cares/ares__read_line.c + third_party/cares/cares/ares__timeval.c + third_party/cares/cares/ares_cancel.c + third_party/cares/cares/ares_create_query.c + third_party/cares/cares/ares_data.c + third_party/cares/cares/ares_destroy.c + third_party/cares/cares/ares_expand_name.c + third_party/cares/cares/ares_expand_string.c + third_party/cares/cares/ares_fds.c + third_party/cares/cares/ares_free_hostent.c + third_party/cares/cares/ares_free_string.c + third_party/cares/cares/ares_getenv.c + third_party/cares/cares/ares_gethostbyaddr.c + third_party/cares/cares/ares_gethostbyname.c + third_party/cares/cares/ares_getnameinfo.c + third_party/cares/cares/ares_getopt.c + third_party/cares/cares/ares_getsock.c + third_party/cares/cares/ares_init.c + third_party/cares/cares/ares_library_init.c + third_party/cares/cares/ares_llist.c + third_party/cares/cares/ares_mkquery.c + third_party/cares/cares/ares_nowarn.c + third_party/cares/cares/ares_options.c + third_party/cares/cares/ares_parse_a_reply.c + third_party/cares/cares/ares_parse_aaaa_reply.c + third_party/cares/cares/ares_parse_mx_reply.c + third_party/cares/cares/ares_parse_naptr_reply.c + third_party/cares/cares/ares_parse_ns_reply.c + third_party/cares/cares/ares_parse_ptr_reply.c + third_party/cares/cares/ares_parse_soa_reply.c + third_party/cares/cares/ares_parse_srv_reply.c + third_party/cares/cares/ares_parse_txt_reply.c + third_party/cares/cares/ares_platform.c + third_party/cares/cares/ares_process.c + third_party/cares/cares/ares_query.c + third_party/cares/cares/ares_search.c + third_party/cares/cares/ares_send.c + third_party/cares/cares/ares_strcasecmp.c + third_party/cares/cares/ares_strdup.c + third_party/cares/cares/ares_strerror.c + third_party/cares/cares/ares_timeout.c + third_party/cares/cares/ares_version.c + third_party/cares/cares/ares_writev.c + third_party/cares/cares/bitncmp.c + third_party/cares/cares/inet_net_pton.c + third_party/cares/cares/inet_ntop.c + third_party/cares/cares/windows_port.c ) diff --git a/Makefile b/Makefile index b640cda516..343e46dbc8 100644 --- a/Makefile +++ b/Makefile @@ -495,7 +495,7 @@ SHARED_VERSION_CORE = -2 SHARED_VERSION_CPP = -1 SHARED_VERSION_CSHARP = -1 else ifeq ($(SYSTEM),Darwin) -EXECUTABLE_SUFFIX = +EXECUTABLE_SUFFIX = SHARED_EXT_CORE = dylib SHARED_EXT_CPP = dylib SHARED_EXT_CSHARP = dylib @@ -504,7 +504,7 @@ SHARED_VERSION_CORE = SHARED_VERSION_CPP = SHARED_VERSION_CSHARP = else -EXECUTABLE_SUFFIX = +EXECUTABLE_SUFFIX = SHARED_EXT_CORE = so.$(CORE_VERSION) SHARED_EXT_CPP = so.$(CPP_VERSION) SHARED_EXT_CSHARP = so.$(CSHARP_VERSION) @@ -648,7 +648,7 @@ else HAS_EMBEDDED_PROTOBUF = true endif -ifeq ($(wildcard third_party/c-ares/ares.h),) +ifeq ($(wildcard third_party/cares/cares/ares.h),) HAS_EMBEDDED_CARES = false else HAS_EMBEDDED_CARES = true @@ -703,7 +703,7 @@ ifeq ($(EMBED_CARES),true) CARES_DEP = $(LIBDIR)/$(CONFIG)/libares.a CARES_MERGE_OBJS = $(LIBARES_OBJS) CARES_MERGE_LIBS = $(LIBDIR)/$(CONFIG)/libares.a -CPPFLAGS := -Ithird_party/c-ares -Isrc/c-ares $(CPPFLAGS) +CPPFLAGS := -Ithird_party/cares -Ithird_party/cares/cares $(CPPFLAGS) LDFLAGS := -L$(LIBDIR)/$(CONFIG)/c-ares $(LDFLAGS) else ifeq ($(HAS_PKG_CONFIG),true) @@ -7238,61 +7238,61 @@ endif LIBARES_SRC = \ - third_party/c-ares/ares__close_sockets.c \ - third_party/c-ares/ares__get_hostent.c \ - third_party/c-ares/ares__read_line.c \ - third_party/c-ares/ares__timeval.c \ - third_party/c-ares/ares_cancel.c \ - third_party/c-ares/ares_create_query.c \ - third_party/c-ares/ares_data.c \ - third_party/c-ares/ares_destroy.c \ - third_party/c-ares/ares_expand_name.c \ - third_party/c-ares/ares_expand_string.c \ - third_party/c-ares/ares_fds.c \ - third_party/c-ares/ares_free_hostent.c \ - third_party/c-ares/ares_free_string.c \ - third_party/c-ares/ares_getenv.c \ - third_party/c-ares/ares_gethostbyaddr.c \ - third_party/c-ares/ares_gethostbyname.c \ - third_party/c-ares/ares_getnameinfo.c \ - third_party/c-ares/ares_getopt.c \ - third_party/c-ares/ares_getsock.c \ - third_party/c-ares/ares_init.c \ - third_party/c-ares/ares_library_init.c \ - third_party/c-ares/ares_llist.c \ - third_party/c-ares/ares_mkquery.c \ - third_party/c-ares/ares_nowarn.c \ - third_party/c-ares/ares_options.c \ - third_party/c-ares/ares_parse_a_reply.c \ - third_party/c-ares/ares_parse_aaaa_reply.c \ - third_party/c-ares/ares_parse_mx_reply.c \ - third_party/c-ares/ares_parse_naptr_reply.c \ - third_party/c-ares/ares_parse_ns_reply.c \ - third_party/c-ares/ares_parse_ptr_reply.c \ - third_party/c-ares/ares_parse_soa_reply.c \ - third_party/c-ares/ares_parse_srv_reply.c \ - third_party/c-ares/ares_parse_txt_reply.c \ - third_party/c-ares/ares_platform.c \ - third_party/c-ares/ares_process.c \ - third_party/c-ares/ares_query.c \ - third_party/c-ares/ares_search.c \ - third_party/c-ares/ares_send.c \ - third_party/c-ares/ares_strcasecmp.c \ - third_party/c-ares/ares_strdup.c \ - third_party/c-ares/ares_strerror.c \ - third_party/c-ares/ares_timeout.c \ - third_party/c-ares/ares_version.c \ - third_party/c-ares/ares_writev.c \ - third_party/c-ares/bitncmp.c \ - third_party/c-ares/inet_net_pton.c \ - third_party/c-ares/inet_ntop.c \ - third_party/c-ares/windows_port.c \ + third_party/cares/cares/ares__close_sockets.c \ + third_party/cares/cares/ares__get_hostent.c \ + third_party/cares/cares/ares__read_line.c \ + third_party/cares/cares/ares__timeval.c \ + third_party/cares/cares/ares_cancel.c \ + third_party/cares/cares/ares_create_query.c \ + third_party/cares/cares/ares_data.c \ + third_party/cares/cares/ares_destroy.c \ + third_party/cares/cares/ares_expand_name.c \ + third_party/cares/cares/ares_expand_string.c \ + third_party/cares/cares/ares_fds.c \ + third_party/cares/cares/ares_free_hostent.c \ + third_party/cares/cares/ares_free_string.c \ + third_party/cares/cares/ares_getenv.c \ + third_party/cares/cares/ares_gethostbyaddr.c \ + third_party/cares/cares/ares_gethostbyname.c \ + third_party/cares/cares/ares_getnameinfo.c \ + third_party/cares/cares/ares_getopt.c \ + third_party/cares/cares/ares_getsock.c \ + third_party/cares/cares/ares_init.c \ + third_party/cares/cares/ares_library_init.c \ + third_party/cares/cares/ares_llist.c \ + third_party/cares/cares/ares_mkquery.c \ + third_party/cares/cares/ares_nowarn.c \ + third_party/cares/cares/ares_options.c \ + third_party/cares/cares/ares_parse_a_reply.c \ + third_party/cares/cares/ares_parse_aaaa_reply.c \ + third_party/cares/cares/ares_parse_mx_reply.c \ + third_party/cares/cares/ares_parse_naptr_reply.c \ + third_party/cares/cares/ares_parse_ns_reply.c \ + third_party/cares/cares/ares_parse_ptr_reply.c \ + third_party/cares/cares/ares_parse_soa_reply.c \ + third_party/cares/cares/ares_parse_srv_reply.c \ + third_party/cares/cares/ares_parse_txt_reply.c \ + third_party/cares/cares/ares_platform.c \ + third_party/cares/cares/ares_process.c \ + third_party/cares/cares/ares_query.c \ + third_party/cares/cares/ares_search.c \ + third_party/cares/cares/ares_send.c \ + third_party/cares/cares/ares_strcasecmp.c \ + third_party/cares/cares/ares_strdup.c \ + third_party/cares/cares/ares_strerror.c \ + third_party/cares/cares/ares_timeout.c \ + third_party/cares/cares/ares_version.c \ + third_party/cares/cares/ares_writev.c \ + third_party/cares/cares/bitncmp.c \ + third_party/cares/cares/inet_net_pton.c \ + third_party/cares/cares/inet_ntop.c \ + third_party/cares/cares/windows_port.c \ PUBLIC_HEADERS_C += \ LIBARES_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBARES_SRC)))) -$(LIBARES_OBJS): CPPFLAGS += -Ithird_party/c-ares -Isrc/c-ares $(if $(subst Linux,,$(SYSTEM)),,-Isrc/c-ares/config_linux) $(if $(subst Darwin,,$(SYSTEM)),,-Isrc/c-ares/config_darwin) -fvisibility=hidden -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DHAVE_CONFIG_H +$(LIBARES_OBJS): CPPFLAGS += -Ithird_party/cares -Ithird_party/cares/cares $(if $(subst Linux,,$(SYSTEM)),,-Ithird_party/cares/config_linux) $(if $(subst Darwin,,$(SYSTEM)),,-Ithird_party/cares/config_darwin) -fvisibility=hidden -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DHAVE_CONFIG_H $(LIBARES_OBJS): CFLAGS += -Wno-sign-conversion -Wno-invalid-source-encoding $(LIBDIR)/$(CONFIG)/libares.a: $(ZLIB_DEP) $(LIBARES_OBJS) diff --git a/binding.gyp b/binding.gyp index b55c0cae0b..96fd178129 100644 --- a/binding.gyp +++ b/binding.gyp @@ -100,7 +100,7 @@ ['OS == "win"', { "include_dirs": [ "third_party/zlib", - "third_party/c-ares" + "third_party/cares/cares" ], "defines": [ '_WIN32_WINNT=0x0600', diff --git a/build.yaml b/build.yaml index 7c578d2fa5..6483ad1af9 100644 --- a/build.yaml +++ b/build.yaml @@ -3879,8 +3879,8 @@ configs: defaults: ares: CFLAGS: -Wno-sign-conversion -Wno-invalid-source-encoding - CPPFLAGS: -Ithird_party/c-ares -Isrc/c-ares $(if $(subst Linux,,$(SYSTEM)),,-Isrc/c-ares/config_linux) - $(if $(subst Darwin,,$(SYSTEM)),,-Isrc/c-ares/config_darwin) -fvisibility=hidden + CPPFLAGS: -Ithird_party/cares -Ithird_party/cares/cares $(if $(subst Linux,,$(SYSTEM)),,-Ithird_party/cares/config_linux) + $(if $(subst Darwin,,$(SYSTEM)),,-Ithird_party/cares/config_darwin) -fvisibility=hidden -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DHAVE_CONFIG_H benchmark: CPPFLAGS: -Ithird_party/benchmark/include -DHAVE_POSIX_REGEX diff --git a/grpc.gemspec b/grpc.gemspec index 317ea79df3..9cb73e5ef4 100755 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -1003,77 +1003,77 @@ Gem::Specification.new do |s| s.files += %w( third_party/zlib/trees.c ) s.files += %w( third_party/zlib/uncompr.c ) s.files += %w( third_party/zlib/zutil.c ) - s.files += %w( third_party/c-ares/ares.h ) - s.files += %w( third_party/c-ares/ares_data.h ) - s.files += %w( third_party/c-ares/ares_dns.h ) - s.files += %w( third_party/c-ares/ares_getenv.h ) - s.files += %w( third_party/c-ares/ares_getopt.h ) - s.files += %w( third_party/c-ares/ares_inet_net_pton.h ) - s.files += %w( third_party/c-ares/ares_iphlpapi.h ) - s.files += %w( third_party/c-ares/ares_ipv6.h ) - s.files += %w( third_party/c-ares/ares_library_init.h ) - s.files += %w( third_party/c-ares/ares_llist.h ) - s.files += %w( third_party/c-ares/ares_nowarn.h ) - s.files += %w( third_party/c-ares/ares_platform.h ) - s.files += %w( third_party/c-ares/ares_private.h ) - s.files += %w( third_party/c-ares/ares_rules.h ) - s.files += %w( third_party/c-ares/ares_setup.h ) - s.files += %w( third_party/c-ares/ares_strcasecmp.h ) - s.files += %w( third_party/c-ares/ares_strdup.h ) - s.files += %w( third_party/c-ares/ares_version.h ) - s.files += %w( third_party/c-ares/bitncmp.h ) - s.files += %w( third_party/c-ares/config-win32.h ) - s.files += %w( third_party/c-ares/setup_once.h ) - s.files += %w( src/c-ares/ares_build.h ) - s.files += %w( src/c-ares/config_linux/ares_config.h ) - s.files += %w( src/c-ares/config_darwin/ares_config.h ) - s.files += %w( third_party/c-ares/ares__close_sockets.c ) - s.files += %w( third_party/c-ares/ares__get_hostent.c ) - s.files += %w( third_party/c-ares/ares__read_line.c ) - s.files += %w( third_party/c-ares/ares__timeval.c ) - s.files += %w( third_party/c-ares/ares_cancel.c ) - s.files += %w( third_party/c-ares/ares_create_query.c ) - s.files += %w( third_party/c-ares/ares_data.c ) - s.files += %w( third_party/c-ares/ares_destroy.c ) - s.files += %w( third_party/c-ares/ares_expand_name.c ) - s.files += %w( third_party/c-ares/ares_expand_string.c ) - s.files += %w( third_party/c-ares/ares_fds.c ) - s.files += %w( third_party/c-ares/ares_free_hostent.c ) - s.files += %w( third_party/c-ares/ares_free_string.c ) - s.files += %w( third_party/c-ares/ares_getenv.c ) - s.files += %w( third_party/c-ares/ares_gethostbyaddr.c ) - s.files += %w( third_party/c-ares/ares_gethostbyname.c ) - s.files += %w( third_party/c-ares/ares_getnameinfo.c ) - s.files += %w( third_party/c-ares/ares_getopt.c ) - s.files += %w( third_party/c-ares/ares_getsock.c ) - s.files += %w( third_party/c-ares/ares_init.c ) - s.files += %w( third_party/c-ares/ares_library_init.c ) - s.files += %w( third_party/c-ares/ares_llist.c ) - s.files += %w( third_party/c-ares/ares_mkquery.c ) - s.files += %w( third_party/c-ares/ares_nowarn.c ) - s.files += %w( third_party/c-ares/ares_options.c ) - s.files += %w( third_party/c-ares/ares_parse_a_reply.c ) - s.files += %w( third_party/c-ares/ares_parse_aaaa_reply.c ) - s.files += %w( third_party/c-ares/ares_parse_mx_reply.c ) - s.files += %w( third_party/c-ares/ares_parse_naptr_reply.c ) - s.files += %w( third_party/c-ares/ares_parse_ns_reply.c ) - s.files += %w( third_party/c-ares/ares_parse_ptr_reply.c ) - s.files += %w( third_party/c-ares/ares_parse_soa_reply.c ) - s.files += %w( third_party/c-ares/ares_parse_srv_reply.c ) - s.files += %w( third_party/c-ares/ares_parse_txt_reply.c ) - s.files += %w( third_party/c-ares/ares_platform.c ) - s.files += %w( third_party/c-ares/ares_process.c ) - s.files += %w( third_party/c-ares/ares_query.c ) - s.files += %w( third_party/c-ares/ares_search.c ) - s.files += %w( third_party/c-ares/ares_send.c ) - s.files += %w( third_party/c-ares/ares_strcasecmp.c ) - s.files += %w( third_party/c-ares/ares_strdup.c ) - s.files += %w( third_party/c-ares/ares_strerror.c ) - s.files += %w( third_party/c-ares/ares_timeout.c ) - s.files += %w( third_party/c-ares/ares_version.c ) - s.files += %w( third_party/c-ares/ares_writev.c ) - s.files += %w( third_party/c-ares/bitncmp.c ) - s.files += %w( third_party/c-ares/inet_net_pton.c ) - s.files += %w( third_party/c-ares/inet_ntop.c ) - s.files += %w( third_party/c-ares/windows_port.c ) + s.files += %w( third_party/cares/cares/ares.h ) + s.files += %w( third_party/cares/cares/ares_data.h ) + s.files += %w( third_party/cares/cares/ares_dns.h ) + s.files += %w( third_party/cares/cares/ares_getenv.h ) + s.files += %w( third_party/cares/cares/ares_getopt.h ) + s.files += %w( third_party/cares/cares/ares_inet_net_pton.h ) + s.files += %w( third_party/cares/cares/ares_iphlpapi.h ) + s.files += %w( third_party/cares/cares/ares_ipv6.h ) + s.files += %w( third_party/cares/cares/ares_library_init.h ) + s.files += %w( third_party/cares/cares/ares_llist.h ) + s.files += %w( third_party/cares/cares/ares_nowarn.h ) + s.files += %w( third_party/cares/cares/ares_platform.h ) + s.files += %w( third_party/cares/cares/ares_private.h ) + s.files += %w( third_party/cares/cares/ares_rules.h ) + s.files += %w( third_party/cares/cares/ares_setup.h ) + s.files += %w( third_party/cares/cares/ares_strcasecmp.h ) + s.files += %w( third_party/cares/cares/ares_strdup.h ) + s.files += %w( third_party/cares/cares/ares_version.h ) + s.files += %w( third_party/cares/cares/bitncmp.h ) + s.files += %w( third_party/cares/cares/config-win32.h ) + s.files += %w( third_party/cares/cares/setup_once.h ) + s.files += %w( third_party/cares/ares_build.h ) + s.files += %w( third_party/cares/config_linux/ares_config.h ) + s.files += %w( third_party/cares/config_darwin/ares_config.h ) + s.files += %w( third_party/cares/cares/ares__close_sockets.c ) + s.files += %w( third_party/cares/cares/ares__get_hostent.c ) + s.files += %w( third_party/cares/cares/ares__read_line.c ) + s.files += %w( third_party/cares/cares/ares__timeval.c ) + s.files += %w( third_party/cares/cares/ares_cancel.c ) + s.files += %w( third_party/cares/cares/ares_create_query.c ) + s.files += %w( third_party/cares/cares/ares_data.c ) + s.files += %w( third_party/cares/cares/ares_destroy.c ) + s.files += %w( third_party/cares/cares/ares_expand_name.c ) + s.files += %w( third_party/cares/cares/ares_expand_string.c ) + s.files += %w( third_party/cares/cares/ares_fds.c ) + s.files += %w( third_party/cares/cares/ares_free_hostent.c ) + s.files += %w( third_party/cares/cares/ares_free_string.c ) + s.files += %w( third_party/cares/cares/ares_getenv.c ) + s.files += %w( third_party/cares/cares/ares_gethostbyaddr.c ) + s.files += %w( third_party/cares/cares/ares_gethostbyname.c ) + s.files += %w( third_party/cares/cares/ares_getnameinfo.c ) + s.files += %w( third_party/cares/cares/ares_getopt.c ) + s.files += %w( third_party/cares/cares/ares_getsock.c ) + s.files += %w( third_party/cares/cares/ares_init.c ) + s.files += %w( third_party/cares/cares/ares_library_init.c ) + s.files += %w( third_party/cares/cares/ares_llist.c ) + s.files += %w( third_party/cares/cares/ares_mkquery.c ) + s.files += %w( third_party/cares/cares/ares_nowarn.c ) + s.files += %w( third_party/cares/cares/ares_options.c ) + s.files += %w( third_party/cares/cares/ares_parse_a_reply.c ) + s.files += %w( third_party/cares/cares/ares_parse_aaaa_reply.c ) + s.files += %w( third_party/cares/cares/ares_parse_mx_reply.c ) + s.files += %w( third_party/cares/cares/ares_parse_naptr_reply.c ) + s.files += %w( third_party/cares/cares/ares_parse_ns_reply.c ) + s.files += %w( third_party/cares/cares/ares_parse_ptr_reply.c ) + s.files += %w( third_party/cares/cares/ares_parse_soa_reply.c ) + s.files += %w( third_party/cares/cares/ares_parse_srv_reply.c ) + s.files += %w( third_party/cares/cares/ares_parse_txt_reply.c ) + s.files += %w( third_party/cares/cares/ares_platform.c ) + s.files += %w( third_party/cares/cares/ares_process.c ) + s.files += %w( third_party/cares/cares/ares_query.c ) + s.files += %w( third_party/cares/cares/ares_search.c ) + s.files += %w( third_party/cares/cares/ares_send.c ) + s.files += %w( third_party/cares/cares/ares_strcasecmp.c ) + s.files += %w( third_party/cares/cares/ares_strdup.c ) + s.files += %w( third_party/cares/cares/ares_strerror.c ) + s.files += %w( third_party/cares/cares/ares_timeout.c ) + s.files += %w( third_party/cares/cares/ares_version.c ) + s.files += %w( third_party/cares/cares/ares_writev.c ) + s.files += %w( third_party/cares/cares/bitncmp.c ) + s.files += %w( third_party/cares/cares/inet_net_pton.c ) + s.files += %w( third_party/cares/cares/inet_ntop.c ) + s.files += %w( third_party/cares/cares/windows_port.c ) end diff --git a/setup.py b/setup.py index db3d7b1024..a505fefe51 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """A setup module for the GRPC Python package.""" -from distutils import cygwinccompiler + from distutils import extension as _extension from distutils import util import os @@ -53,24 +53,26 @@ CORE_INCLUDE = ('include', '.',) BORINGSSL_INCLUDE = (os.path.join('third_party', 'boringssl', 'include'),) ZLIB_INCLUDE = (os.path.join('third_party', 'zlib'),) CARES_INCLUDE = ( - os.path.join('third_party', 'c-ares'), os.path.join('src', 'c-ares'),) + os.path.join('third_party', 'cares'), + os.path.join('third_party', 'cares', 'cares'),) if 'linux' in sys.platform: - CARES_INCLUDE += (os.path.join('src', 'c-ares', 'config_linux'),) + CARES_INCLUDE += (os.path.join('third_party', 'cares', 'config_linux'),) if 'darwin' in sys.platform: - CARES_INCLUDE += (os.path.join('src', 'c-ares', 'config_darwin'),) -README = os.path.join(PYTHON_STEM, 'README.rst') + CARES_INCLUDE += (os.path.join('third_party', 'cares', 'config_darwin'),) # Ensure we're in the proper directory whether or not we're being used by pip. os.chdir(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, os.path.abspath(PYTHON_STEM)) # Break import-style to ensure we can actually find our in-repo dependencies. -import _spawn_patch +import _unixccompiler_patch import commands import grpc_core_dependencies import grpc_version -_spawn_patch.monkeypatch_spawn() +if 'win32' in sys.platform: + _unixccompiler_patch.monkeypatch_unix_compiler() + LICENSE = '3-clause BSD' @@ -86,11 +88,6 @@ BUILD_WITH_CYTHON = os.environ.get('GRPC_PYTHON_BUILD_WITH_CYTHON', False) ENABLE_CYTHON_TRACING = os.environ.get( 'GRPC_PYTHON_ENABLE_CYTHON_TRACING', False) -# Environment variable specifying whether or not there's interest in setting up -# documentation building. -ENABLE_DOCUMENTATION_BUILD = os.environ.get( - 'GRPC_PYTHON_ENABLE_DOCUMENTATION_BUILD', False) - # There are some situations (like on Windows) where CC, CFLAGS, and LDFLAGS are # entirely ignored/dropped/forgotten by distutils and its Cygwin/MinGW support. # We use these environment variables to thus get around that without locking @@ -101,8 +98,8 @@ ENABLE_DOCUMENTATION_BUILD = os.environ.get( EXTRA_ENV_COMPILE_ARGS = os.environ.get('GRPC_PYTHON_CFLAGS', None) EXTRA_ENV_LINK_ARGS = os.environ.get('GRPC_PYTHON_LDFLAGS', None) if EXTRA_ENV_COMPILE_ARGS is None: - EXTRA_ENV_COMPILE_ARGS = '' - if 'win32' in sys.platform and sys.version_info < (3, 5): + EXTRA_ENV_COMPILE_ARGS = '-fno-wrapv' + if 'win32' in sys.platform: # We use define flags here and don't directly add to DEFINE_MACROS below to # ensure that the expert user/builder has a way of turning it off (via the # envvars) without adding yet more GRPC-specific envvars. @@ -112,21 +109,21 @@ if EXTRA_ENV_COMPILE_ARGS is None: else: EXTRA_ENV_COMPILE_ARGS += ' -D_ftime=_ftime64 -D_timeb=__timeb64' elif "linux" in sys.platform or "darwin" in sys.platform: - EXTRA_ENV_COMPILE_ARGS += ' -fvisibility=hidden -fno-wrapv' + EXTRA_ENV_COMPILE_ARGS += ' -fvisibility=hidden' if EXTRA_ENV_LINK_ARGS is None: - EXTRA_ENV_LINK_ARGS = '' - if "linux" in sys.platform or "darwin" in sys.platform: - EXTRA_ENV_LINK_ARGS += ' -lpthread' - elif "win32" in sys.platform and sys.version_info < (3, 5): - msvcr = cygwinccompiler.get_msvcr()[0] + EXTRA_ENV_LINK_ARGS = '-lpthread' + if 'win32' in sys.platform: + # TODO(atash) check if this is actually safe to just import and call on + # non-Windows (to avoid breaking import style) + from distutils.cygwinccompiler import get_msvcr + msvcr = get_msvcr()[0] # TODO(atash) sift through the GCC specs to see if libstdc++ can have any # influence on the linkage outcome on MinGW for non-C++ programs. EXTRA_ENV_LINK_ARGS += ( ' -static-libgcc -static-libstdc++ -mcrtdll={msvcr} ' '-static'.format(msvcr=msvcr)) - if "linux" in sys.platform: + elif "linux" in sys.platform: EXTRA_ENV_LINK_ARGS += ' -Wl,-wrap,memcpy' - EXTRA_COMPILE_ARGS = shlex.split(EXTRA_ENV_COMPILE_ARGS) EXTRA_LINK_ARGS = shlex.split(EXTRA_ENV_LINK_ARGS) @@ -148,19 +145,16 @@ if "linux" in sys.platform: if not "win32" in sys.platform: EXTENSION_LIBRARIES += ('m',) if "win32" in sys.platform: - EXTENSION_LIBRARIES += ('advapi32', 'ws2_32',) + EXTENSION_LIBRARIES += ('ws2_32',) DEFINE_MACROS = ( ('OPENSSL_NO_ASM', 1), ('_WIN32_WINNT', 0x600), ('GPR_BACKWARDS_COMPATIBILITY_MODE', 1),) if "win32" in sys.platform: - DEFINE_MACROS += (('WIN32_LEAN_AND_MEAN', 1), ('CARES_STATICLIB', 1),) + DEFINE_MACROS += (('OPENSSL_WINDOWS', 1), ('WIN32_LEAN_AND_MEAN', 1), + ('CARES_STATICLIB', 1),) if '64bit' in platform.architecture()[0]: DEFINE_MACROS += (('MS_WIN64', 1),) - elif sys.version_info >= (3, 5): - # For some reason, this is needed to get access to inet_pton/inet_ntop - # on msvc, but only for 32 bits - DEFINE_MACROS += (('NTDDI_VERSION', 0x06000000),) else: DEFINE_MACROS += (('HAVE_CONFIG_H', 1),) @@ -171,6 +165,7 @@ if "linux" in sys.platform or "darwin" in sys.platform: pymodinit = '__attribute__((visibility ("default"))) {}'.format(pymodinit_type) DEFINE_MACROS += (('PyMODINIT_FUNC', pymodinit),) + # By default, Python3 distutils enforces compatibility of # c plugins (.so files) with the OSX version Python3 was built with. # For Python3.4, this is OSX 10.6, but we need Thread Local Support (__thread) @@ -213,32 +208,26 @@ PACKAGE_DIRECTORIES = { INSTALL_REQUIRES = ( 'six>=1.5.2', 'enum34>=1.0.4', + 'futures>=2.2.0', # TODO(atash): eventually split the grpcio package into a metapackage # depending on protobuf and the runtime component (independent of protobuf) 'protobuf>=3.0.0', ) -if not PY3: - INSTALL_REQUIRES += ('futures>=2.2.0',) - SETUP_REQUIRES = INSTALL_REQUIRES + ( 'sphinx>=1.3', 'sphinx_rtd_theme>=0.1.8', 'six>=1.10', - ) if ENABLE_DOCUMENTATION_BUILD else () - -try: - import Cython -except ImportError: - if BUILD_WITH_CYTHON: - sys.stderr.write( - "You requested a Cython build via GRPC_PYTHON_BUILD_WITH_CYTHON, " - "but do not have Cython installed. We won't stop you from using " - "other commands, but the extension files will fail to build.\n") - elif need_cython: - sys.stderr.write( - 'We could not find Cython. Setup may take 10-20 minutes.\n') - SETUP_REQUIRES += ('cython>=0.23',) +) +if BUILD_WITH_CYTHON: + sys.stderr.write( + "You requested a Cython build via GRPC_PYTHON_BUILD_WITH_CYTHON, " + "but do not have Cython installed. We won't stop you from using " + "other commands, but the extension files will fail to build.\n") +elif need_cython: + sys.stderr.write( + 'We could not find Cython. Setup may take 10-20 minutes.\n') + SETUP_REQUIRES += ('cython>=0.23',) COMMAND_CLASS = { 'doc': commands.SphinxDocumentation, @@ -272,7 +261,6 @@ setuptools.setup( name='grpcio', version=grpc_version.VERSION, license=LICENSE, - long_description=open(README).read(), ext_modules=CYTHON_EXTENSION_MODULES, packages=list(PACKAGES), package_dir=PACKAGE_DIRECTORIES, diff --git a/src/c-ares/gen_build_yaml.py b/src/c-ares/gen_build_yaml.py index 28ef7362d1..b2ae971f37 100755 --- a/src/c-ares/gen_build_yaml.py +++ b/src/c-ares/gen_build_yaml.py @@ -1,6 +1,6 @@ #!/usr/bin/env python2.7 -# Copyright 2016, Google Inc. +# Copyright 2015, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -40,24 +40,24 @@ out = {} try: def gen_ares_build(x): - subprocess.call("third_party/c-ares/buildconf", shell=True) - subprocess.call("third_party/c-ares/configure", shell=True) + subprocess.call("third_party/cares/cares/buildconf", shell=True) + subprocess.call("third_party/cares/cares/configure", shell=True) def config_platform(x): if 'linux' in sys.platform: - return 'src/c-ares/config_linux/ares_config.h' + return 'src/cares/cares/config_linux/ares_config.h' if 'darwin' in sys.platform: - return 'src/c-ares/config_darwin/ares_config.h' - if not os.path.isfile('third_party/c-ares/ares_config.h'): + return 'src/cares/cares/config_darwin/ares_config.h' + if not os.path.isfile('third_party/cares/cares/ares_config.h'): gen_ares_build(x) - return 'third_party/c-ares/ares_config.h' + return 'third_party/cares/cares/ares_config.h' def ares_build(x): - if os.path.isfile('src/c-ares/ares_build.h'): - return 'src/c-ares/ares_build.h' - if not os.path.isfile('third_party/c-ares/ares_build.h'): + if os.path.isfile('src/cares/cares/ares_build.h'): + return 'src/cares/cares/ares_build.h' + if not os.path.isfile('third_party/cares/cares/ares_build.h'): gen_ares_build(x) - return 'third_party/c-ares/ares_build.h' + return 'third_party/cares/cares/ares_build.h' out['libs'] = [{ 'name': 'ares', @@ -66,81 +66,81 @@ try: 'language': 'c', 'secure': 'no', 'src': [ - "third_party/c-ares/ares__close_sockets.c", - "third_party/c-ares/ares__get_hostent.c", - "third_party/c-ares/ares__read_line.c", - "third_party/c-ares/ares__timeval.c", - "third_party/c-ares/ares_cancel.c", - "third_party/c-ares/ares_create_query.c", - "third_party/c-ares/ares_data.c", - "third_party/c-ares/ares_destroy.c", - "third_party/c-ares/ares_expand_name.c", - "third_party/c-ares/ares_expand_string.c", - "third_party/c-ares/ares_fds.c", - "third_party/c-ares/ares_free_hostent.c", - "third_party/c-ares/ares_free_string.c", - "third_party/c-ares/ares_getenv.c", - "third_party/c-ares/ares_gethostbyaddr.c", - "third_party/c-ares/ares_gethostbyname.c", - "third_party/c-ares/ares_getnameinfo.c", - "third_party/c-ares/ares_getopt.c", - "third_party/c-ares/ares_getsock.c", - "third_party/c-ares/ares_init.c", - "third_party/c-ares/ares_library_init.c", - "third_party/c-ares/ares_llist.c", - "third_party/c-ares/ares_mkquery.c", - "third_party/c-ares/ares_nowarn.c", - "third_party/c-ares/ares_options.c", - "third_party/c-ares/ares_parse_a_reply.c", - "third_party/c-ares/ares_parse_aaaa_reply.c", - "third_party/c-ares/ares_parse_mx_reply.c", - "third_party/c-ares/ares_parse_naptr_reply.c", - "third_party/c-ares/ares_parse_ns_reply.c", - "third_party/c-ares/ares_parse_ptr_reply.c", - "third_party/c-ares/ares_parse_soa_reply.c", - "third_party/c-ares/ares_parse_srv_reply.c", - "third_party/c-ares/ares_parse_txt_reply.c", - "third_party/c-ares/ares_platform.c", - "third_party/c-ares/ares_process.c", - "third_party/c-ares/ares_query.c", - "third_party/c-ares/ares_search.c", - "third_party/c-ares/ares_send.c", - "third_party/c-ares/ares_strcasecmp.c", - "third_party/c-ares/ares_strdup.c", - "third_party/c-ares/ares_strerror.c", - "third_party/c-ares/ares_timeout.c", - "third_party/c-ares/ares_version.c", - "third_party/c-ares/ares_writev.c", - "third_party/c-ares/bitncmp.c", - "third_party/c-ares/inet_net_pton.c", - "third_party/c-ares/inet_ntop.c", - "third_party/c-ares/windows_port.c", + "third_party/cares/cares/ares__close_sockets.c", + "third_party/cares/cares/ares__get_hostent.c", + "third_party/cares/cares/ares__read_line.c", + "third_party/cares/cares/ares__timeval.c", + "third_party/cares/cares/ares_cancel.c", + "third_party/cares/cares/ares_create_query.c", + "third_party/cares/cares/ares_data.c", + "third_party/cares/cares/ares_destroy.c", + "third_party/cares/cares/ares_expand_name.c", + "third_party/cares/cares/ares_expand_string.c", + "third_party/cares/cares/ares_fds.c", + "third_party/cares/cares/ares_free_hostent.c", + "third_party/cares/cares/ares_free_string.c", + "third_party/cares/cares/ares_getenv.c", + "third_party/cares/cares/ares_gethostbyaddr.c", + "third_party/cares/cares/ares_gethostbyname.c", + "third_party/cares/cares/ares_getnameinfo.c", + "third_party/cares/cares/ares_getopt.c", + "third_party/cares/cares/ares_getsock.c", + "third_party/cares/cares/ares_init.c", + "third_party/cares/cares/ares_library_init.c", + "third_party/cares/cares/ares_llist.c", + "third_party/cares/cares/ares_mkquery.c", + "third_party/cares/cares/ares_nowarn.c", + "third_party/cares/cares/ares_options.c", + "third_party/cares/cares/ares_parse_a_reply.c", + "third_party/cares/cares/ares_parse_aaaa_reply.c", + "third_party/cares/cares/ares_parse_mx_reply.c", + "third_party/cares/cares/ares_parse_naptr_reply.c", + "third_party/cares/cares/ares_parse_ns_reply.c", + "third_party/cares/cares/ares_parse_ptr_reply.c", + "third_party/cares/cares/ares_parse_soa_reply.c", + "third_party/cares/cares/ares_parse_srv_reply.c", + "third_party/cares/cares/ares_parse_txt_reply.c", + "third_party/cares/cares/ares_platform.c", + "third_party/cares/cares/ares_process.c", + "third_party/cares/cares/ares_query.c", + "third_party/cares/cares/ares_search.c", + "third_party/cares/cares/ares_send.c", + "third_party/cares/cares/ares_strcasecmp.c", + "third_party/cares/cares/ares_strdup.c", + "third_party/cares/cares/ares_strerror.c", + "third_party/cares/cares/ares_timeout.c", + "third_party/cares/cares/ares_version.c", + "third_party/cares/cares/ares_writev.c", + "third_party/cares/cares/bitncmp.c", + "third_party/cares/cares/inet_net_pton.c", + "third_party/cares/cares/inet_ntop.c", + "third_party/cares/cares/windows_port.c", ], 'headers': [ - "third_party/c-ares/ares.h", - "third_party/c-ares/ares_data.h", - "third_party/c-ares/ares_dns.h", - "third_party/c-ares/ares_getenv.h", - "third_party/c-ares/ares_getopt.h", - "third_party/c-ares/ares_inet_net_pton.h", - "third_party/c-ares/ares_iphlpapi.h", - "third_party/c-ares/ares_ipv6.h", - "third_party/c-ares/ares_library_init.h", - "third_party/c-ares/ares_llist.h", - "third_party/c-ares/ares_nowarn.h", - "third_party/c-ares/ares_platform.h", - "third_party/c-ares/ares_private.h", - "third_party/c-ares/ares_rules.h", - "third_party/c-ares/ares_setup.h", - "third_party/c-ares/ares_strcasecmp.h", - "third_party/c-ares/ares_strdup.h", - "third_party/c-ares/ares_version.h", - "third_party/c-ares/bitncmp.h", - "third_party/c-ares/config-win32.h", - "third_party/c-ares/setup_once.h", - "src/c-ares/ares_build.h", - "src/c-ares/config_linux/ares_config.h", - "src/c-ares/config_darwin/ares_config.h" + "third_party/cares/cares/ares.h", + "third_party/cares/cares/ares_data.h", + "third_party/cares/cares/ares_dns.h", + "third_party/cares/cares/ares_getenv.h", + "third_party/cares/cares/ares_getopt.h", + "third_party/cares/cares/ares_inet_net_pton.h", + "third_party/cares/cares/ares_iphlpapi.h", + "third_party/cares/cares/ares_ipv6.h", + "third_party/cares/cares/ares_library_init.h", + "third_party/cares/cares/ares_llist.h", + "third_party/cares/cares/ares_nowarn.h", + "third_party/cares/cares/ares_platform.h", + "third_party/cares/cares/ares_private.h", + "third_party/cares/cares/ares_rules.h", + "third_party/cares/cares/ares_setup.h", + "third_party/cares/cares/ares_strcasecmp.h", + "third_party/cares/cares/ares_strdup.h", + "third_party/cares/cares/ares_version.h", + "third_party/cares/cares/bitncmp.h", + "third_party/cares/cares/config-win32.h", + "third_party/cares/cares/setup_once.h", + "third_party/cares/ares_build.h", + "third_party/cares/config_linux/ares_config.h", + "third_party/cares/config_darwin/ares_config.h" ], }] except: diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 72d8fe018a..786bdfee03 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -608,53 +608,53 @@ CORE_SOURCE_FILES = [ 'third_party/zlib/trees.c', 'third_party/zlib/uncompr.c', 'third_party/zlib/zutil.c', - 'third_party/c-ares/ares__close_sockets.c', - 'third_party/c-ares/ares__get_hostent.c', - 'third_party/c-ares/ares__read_line.c', - 'third_party/c-ares/ares__timeval.c', - 'third_party/c-ares/ares_cancel.c', - 'third_party/c-ares/ares_create_query.c', - 'third_party/c-ares/ares_data.c', - 'third_party/c-ares/ares_destroy.c', - 'third_party/c-ares/ares_expand_name.c', - 'third_party/c-ares/ares_expand_string.c', - 'third_party/c-ares/ares_fds.c', - 'third_party/c-ares/ares_free_hostent.c', - 'third_party/c-ares/ares_free_string.c', - 'third_party/c-ares/ares_getenv.c', - 'third_party/c-ares/ares_gethostbyaddr.c', - 'third_party/c-ares/ares_gethostbyname.c', - 'third_party/c-ares/ares_getnameinfo.c', - 'third_party/c-ares/ares_getopt.c', - 'third_party/c-ares/ares_getsock.c', - 'third_party/c-ares/ares_init.c', - 'third_party/c-ares/ares_library_init.c', - 'third_party/c-ares/ares_llist.c', - 'third_party/c-ares/ares_mkquery.c', - 'third_party/c-ares/ares_nowarn.c', - 'third_party/c-ares/ares_options.c', - 'third_party/c-ares/ares_parse_a_reply.c', - 'third_party/c-ares/ares_parse_aaaa_reply.c', - 'third_party/c-ares/ares_parse_mx_reply.c', - 'third_party/c-ares/ares_parse_naptr_reply.c', - 'third_party/c-ares/ares_parse_ns_reply.c', - 'third_party/c-ares/ares_parse_ptr_reply.c', - 'third_party/c-ares/ares_parse_soa_reply.c', - 'third_party/c-ares/ares_parse_srv_reply.c', - 'third_party/c-ares/ares_parse_txt_reply.c', - 'third_party/c-ares/ares_platform.c', - 'third_party/c-ares/ares_process.c', - 'third_party/c-ares/ares_query.c', - 'third_party/c-ares/ares_search.c', - 'third_party/c-ares/ares_send.c', - 'third_party/c-ares/ares_strcasecmp.c', - 'third_party/c-ares/ares_strdup.c', - 'third_party/c-ares/ares_strerror.c', - 'third_party/c-ares/ares_timeout.c', - 'third_party/c-ares/ares_version.c', - 'third_party/c-ares/ares_writev.c', - 'third_party/c-ares/bitncmp.c', - 'third_party/c-ares/inet_net_pton.c', - 'third_party/c-ares/inet_ntop.c', - 'third_party/c-ares/windows_port.c', + 'third_party/cares/cares/ares__close_sockets.c', + 'third_party/cares/cares/ares__get_hostent.c', + 'third_party/cares/cares/ares__read_line.c', + 'third_party/cares/cares/ares__timeval.c', + 'third_party/cares/cares/ares_cancel.c', + 'third_party/cares/cares/ares_create_query.c', + 'third_party/cares/cares/ares_data.c', + 'third_party/cares/cares/ares_destroy.c', + 'third_party/cares/cares/ares_expand_name.c', + 'third_party/cares/cares/ares_expand_string.c', + 'third_party/cares/cares/ares_fds.c', + 'third_party/cares/cares/ares_free_hostent.c', + 'third_party/cares/cares/ares_free_string.c', + 'third_party/cares/cares/ares_getenv.c', + 'third_party/cares/cares/ares_gethostbyaddr.c', + 'third_party/cares/cares/ares_gethostbyname.c', + 'third_party/cares/cares/ares_getnameinfo.c', + 'third_party/cares/cares/ares_getopt.c', + 'third_party/cares/cares/ares_getsock.c', + 'third_party/cares/cares/ares_init.c', + 'third_party/cares/cares/ares_library_init.c', + 'third_party/cares/cares/ares_llist.c', + 'third_party/cares/cares/ares_mkquery.c', + 'third_party/cares/cares/ares_nowarn.c', + 'third_party/cares/cares/ares_options.c', + 'third_party/cares/cares/ares_parse_a_reply.c', + 'third_party/cares/cares/ares_parse_aaaa_reply.c', + 'third_party/cares/cares/ares_parse_mx_reply.c', + 'third_party/cares/cares/ares_parse_naptr_reply.c', + 'third_party/cares/cares/ares_parse_ns_reply.c', + 'third_party/cares/cares/ares_parse_ptr_reply.c', + 'third_party/cares/cares/ares_parse_soa_reply.c', + 'third_party/cares/cares/ares_parse_srv_reply.c', + 'third_party/cares/cares/ares_parse_txt_reply.c', + 'third_party/cares/cares/ares_platform.c', + 'third_party/cares/cares/ares_process.c', + 'third_party/cares/cares/ares_query.c', + 'third_party/cares/cares/ares_search.c', + 'third_party/cares/cares/ares_send.c', + 'third_party/cares/cares/ares_strcasecmp.c', + 'third_party/cares/cares/ares_strdup.c', + 'third_party/cares/cares/ares_strerror.c', + 'third_party/cares/cares/ares_timeout.c', + 'third_party/cares/cares/ares_version.c', + 'third_party/cares/cares/ares_writev.c', + 'third_party/cares/cares/bitncmp.c', + 'third_party/cares/cares/inet_net_pton.c', + 'third_party/cares/cares/inet_ntop.c', + 'third_party/cares/cares/windows_port.c', ] diff --git a/templates/Makefile.template b/templates/Makefile.template index 917c69ab34..a3d6eeebb5 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -408,7 +408,7 @@ SHARED_VERSION_CPP = -${settings.cpp_version.major} SHARED_VERSION_CSHARP = -${settings.csharp_version.major} else ifeq ($(SYSTEM),Darwin) - EXECUTABLE_SUFFIX = + EXECUTABLE_SUFFIX = SHARED_EXT_CORE = dylib SHARED_EXT_CPP = dylib SHARED_EXT_CSHARP = dylib @@ -417,7 +417,7 @@ SHARED_VERSION_CPP = SHARED_VERSION_CSHARP = else - EXECUTABLE_SUFFIX = + EXECUTABLE_SUFFIX = SHARED_EXT_CORE = so.$(CORE_VERSION) SHARED_EXT_CPP = so.$(CPP_VERSION) SHARED_EXT_CSHARP = so.$(CSHARP_VERSION) @@ -561,7 +561,7 @@ HAS_EMBEDDED_PROTOBUF = true endif - ifeq ($(wildcard third_party/c-ares/ares.h),) + ifeq ($(wildcard third_party/cares/cares/ares.h),) HAS_EMBEDDED_CARES = false else HAS_EMBEDDED_CARES = true @@ -616,7 +616,7 @@ CARES_DEP = $(LIBDIR)/$(CONFIG)/libares.a CARES_MERGE_OBJS = $(LIBARES_OBJS) CARES_MERGE_LIBS = $(LIBDIR)/$(CONFIG)/libares.a - CPPFLAGS := -Ithird_party/c-ares -Isrc/c-ares $(CPPFLAGS) + CPPFLAGS := -Ithird_party/cares -Ithird_party/cares/cares $(CPPFLAGS) LDFLAGS := -L$(LIBDIR)/$(CONFIG)/c-ares $(LDFLAGS) else ifeq ($(HAS_PKG_CONFIG),true) diff --git a/templates/binding.gyp.template b/templates/binding.gyp.template index 79103f3303..5fd368336b 100644 --- a/templates/binding.gyp.template +++ b/templates/binding.gyp.template @@ -102,7 +102,7 @@ ['OS == "win"', { "include_dirs": [ "third_party/zlib", - "third_party/c-ares" + "third_party/cares/cares" ], "defines": [ '_WIN32_WINNT=0x0600', diff --git a/tools/run_tests/generated/sources_and_headers.json b/tools/run_tests/generated/sources_and_headers.json index 522fe87555..277c3b80bd 100644 --- a/tools/run_tests/generated/sources_and_headers.json +++ b/tools/run_tests/generated/sources_and_headers.json @@ -6355,39 +6355,35 @@ { "deps": [], "headers": [ - "src/c-ares/ares_build.h", - "src/c-ares/config_darwin/ares_config.h", - "src/c-ares/config_linux/ares_config.h", - "third_party/c-ares/ares.h", - "third_party/c-ares/ares_data.h", - "third_party/c-ares/ares_dns.h", - "third_party/c-ares/ares_getenv.h", - "third_party/c-ares/ares_getopt.h", - "third_party/c-ares/ares_inet_net_pton.h", - "third_party/c-ares/ares_iphlpapi.h", - "third_party/c-ares/ares_ipv6.h", - "third_party/c-ares/ares_library_init.h", - "third_party/c-ares/ares_llist.h", - "third_party/c-ares/ares_nowarn.h", - "third_party/c-ares/ares_platform.h", - "third_party/c-ares/ares_private.h", - "third_party/c-ares/ares_rules.h", - "third_party/c-ares/ares_setup.h", - "third_party/c-ares/ares_strcasecmp.h", - "third_party/c-ares/ares_strdup.h", - "third_party/c-ares/ares_version.h", - "third_party/c-ares/bitncmp.h", - "third_party/c-ares/config-win32.h", - "third_party/c-ares/setup_once.h" + "third_party/cares/ares_build.h", + "third_party/cares/cares/ares.h", + "third_party/cares/cares/ares_data.h", + "third_party/cares/cares/ares_dns.h", + "third_party/cares/cares/ares_getenv.h", + "third_party/cares/cares/ares_getopt.h", + "third_party/cares/cares/ares_inet_net_pton.h", + "third_party/cares/cares/ares_iphlpapi.h", + "third_party/cares/cares/ares_ipv6.h", + "third_party/cares/cares/ares_library_init.h", + "third_party/cares/cares/ares_llist.h", + "third_party/cares/cares/ares_nowarn.h", + "third_party/cares/cares/ares_platform.h", + "third_party/cares/cares/ares_private.h", + "third_party/cares/cares/ares_rules.h", + "third_party/cares/cares/ares_setup.h", + "third_party/cares/cares/ares_strcasecmp.h", + "third_party/cares/cares/ares_strdup.h", + "third_party/cares/cares/ares_version.h", + "third_party/cares/cares/bitncmp.h", + "third_party/cares/cares/config-win32.h", + "third_party/cares/cares/setup_once.h", + "third_party/cares/config_darwin/ares_config.h", + "third_party/cares/config_linux/ares_config.h" ], "is_filegroup": false, "language": "c", "name": "ares", - "src": [ - "src/c-ares/ares_build.h", - "src/c-ares/config_darwin/ares_config.h", - "src/c-ares/config_linux/ares_config.h" - ], + "src": [], "third_party": false, "type": "lib" }, diff --git a/vsprojects/vcxproj/ares/ares.vcxproj b/vsprojects/vcxproj/ares/ares.vcxproj index 3a0b179684..811f7c72c3 100644 --- a/vsprojects/vcxproj/ares/ares.vcxproj +++ b/vsprojects/vcxproj/ares/ares.vcxproj @@ -147,129 +147,129 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/vsprojects/vcxproj/ares/ares.vcxproj.filters b/vsprojects/vcxproj/ares/ares.vcxproj.filters index 47378f17ce..282a404868 100644 --- a/vsprojects/vcxproj/ares/ares.vcxproj.filters +++ b/vsprojects/vcxproj/ares/ares.vcxproj.filters @@ -1,247 +1,244 @@ - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - third_party\c-ares + + third_party\cares\cares - - src\c-ares + + third_party\cares - - src\c-ares\config_linux + + third_party\cares\config_linux - - src\c-ares\config_darwin + + third_party\cares\config_darwin - - {b3522833-8ba3-b61e-a36a-609bbb19731b} - - - {46de445f-46a7-7f1c-6a6d-4f68280a93f1} + + {6463a17d-379b-4a21-51a9-c729ed28c9c1} - - {caa901d6-d1f9-5553-801b-76a36285e66d} + + {f5276ab6-c78a-eea3-7ce9-54d2081b3d6a} - - {d1c196f6-508c-7a30-7be3-8f38670adbf9} + + {390f10a8-7730-6295-681d-6fbd990ad488} - - {6463a17d-379b-4a21-51a9-c729ed28c9c1} + + {02918eea-69d3-f65c-08aa-6c6c3dd50c7a} - - {ed241948-a4a1-89a0-0cc6-5a07e2c8ddec} + + {8b1c2965-c2f3-d13b-2c35-9e2c298acda5} -- cgit v1.2.3 From 48e544d64d5c0879fcb5d20837a509bcf56e8abb Mon Sep 17 00:00:00 2001 From: Yuchen Zeng Date: Mon, 23 Jan 2017 21:25:34 -0800 Subject: Fix python build --- setup.py | 73 ++++++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 43 insertions(+), 30 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index a505fefe51..ac503f6de0 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. """A setup module for the GRPC Python package.""" - +from distutils import cygwinccompiler from distutils import extension as _extension from distutils import util import os @@ -59,20 +59,19 @@ if 'linux' in sys.platform: CARES_INCLUDE += (os.path.join('third_party', 'cares', 'config_linux'),) if 'darwin' in sys.platform: CARES_INCLUDE += (os.path.join('third_party', 'cares', 'config_darwin'),) +README = os.path.join(PYTHON_STEM, 'README.rst') # Ensure we're in the proper directory whether or not we're being used by pip. os.chdir(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, os.path.abspath(PYTHON_STEM)) # Break import-style to ensure we can actually find our in-repo dependencies. -import _unixccompiler_patch +import _spawn_patch import commands import grpc_core_dependencies import grpc_version -if 'win32' in sys.platform: - _unixccompiler_patch.monkeypatch_unix_compiler() - +_spawn_patch.monkeypatch_spawn() LICENSE = '3-clause BSD' @@ -88,6 +87,11 @@ BUILD_WITH_CYTHON = os.environ.get('GRPC_PYTHON_BUILD_WITH_CYTHON', False) ENABLE_CYTHON_TRACING = os.environ.get( 'GRPC_PYTHON_ENABLE_CYTHON_TRACING', False) +# Environment variable specifying whether or not there's interest in setting up +# documentation building. +ENABLE_DOCUMENTATION_BUILD = os.environ.get( + 'GRPC_PYTHON_ENABLE_DOCUMENTATION_BUILD', False) + # There are some situations (like on Windows) where CC, CFLAGS, and LDFLAGS are # entirely ignored/dropped/forgotten by distutils and its Cygwin/MinGW support. # We use these environment variables to thus get around that without locking @@ -98,8 +102,8 @@ ENABLE_CYTHON_TRACING = os.environ.get( EXTRA_ENV_COMPILE_ARGS = os.environ.get('GRPC_PYTHON_CFLAGS', None) EXTRA_ENV_LINK_ARGS = os.environ.get('GRPC_PYTHON_LDFLAGS', None) if EXTRA_ENV_COMPILE_ARGS is None: - EXTRA_ENV_COMPILE_ARGS = '-fno-wrapv' - if 'win32' in sys.platform: + EXTRA_ENV_COMPILE_ARGS = '' + if 'win32' in sys.platform and sys.version_info < (3, 5): # We use define flags here and don't directly add to DEFINE_MACROS below to # ensure that the expert user/builder has a way of turning it off (via the # envvars) without adding yet more GRPC-specific envvars. @@ -109,21 +113,21 @@ if EXTRA_ENV_COMPILE_ARGS is None: else: EXTRA_ENV_COMPILE_ARGS += ' -D_ftime=_ftime64 -D_timeb=__timeb64' elif "linux" in sys.platform or "darwin" in sys.platform: - EXTRA_ENV_COMPILE_ARGS += ' -fvisibility=hidden' + EXTRA_ENV_COMPILE_ARGS += ' -fvisibility=hidden -fno-wrapv' if EXTRA_ENV_LINK_ARGS is None: - EXTRA_ENV_LINK_ARGS = '-lpthread' - if 'win32' in sys.platform: - # TODO(atash) check if this is actually safe to just import and call on - # non-Windows (to avoid breaking import style) - from distutils.cygwinccompiler import get_msvcr - msvcr = get_msvcr()[0] + EXTRA_ENV_LINK_ARGS = '' + if "linux" in sys.platform or "darwin" in sys.platform: + EXTRA_ENV_LINK_ARGS += ' -lpthread' + elif "win32" in sys.platform and sys.version_info < (3, 5): + msvcr = cygwinccompiler.get_msvcr()[0] # TODO(atash) sift through the GCC specs to see if libstdc++ can have any # influence on the linkage outcome on MinGW for non-C++ programs. EXTRA_ENV_LINK_ARGS += ( ' -static-libgcc -static-libstdc++ -mcrtdll={msvcr} ' '-static'.format(msvcr=msvcr)) - elif "linux" in sys.platform: + if "linux" in sys.platform: EXTRA_ENV_LINK_ARGS += ' -Wl,-wrap,memcpy' + EXTRA_COMPILE_ARGS = shlex.split(EXTRA_ENV_COMPILE_ARGS) EXTRA_LINK_ARGS = shlex.split(EXTRA_ENV_LINK_ARGS) @@ -145,16 +149,19 @@ if "linux" in sys.platform: if not "win32" in sys.platform: EXTENSION_LIBRARIES += ('m',) if "win32" in sys.platform: - EXTENSION_LIBRARIES += ('ws2_32',) + EXTENSION_LIBRARIES += ('advapi32', 'ws2_32',) DEFINE_MACROS = ( ('OPENSSL_NO_ASM', 1), ('_WIN32_WINNT', 0x600), ('GPR_BACKWARDS_COMPATIBILITY_MODE', 1),) if "win32" in sys.platform: - DEFINE_MACROS += (('OPENSSL_WINDOWS', 1), ('WIN32_LEAN_AND_MEAN', 1), - ('CARES_STATICLIB', 1),) + DEFINE_MACROS += (('WIN32_LEAN_AND_MEAN', 1), ('CARES_STATICLIB', 1),) if '64bit' in platform.architecture()[0]: DEFINE_MACROS += (('MS_WIN64', 1),) + elif sys.version_info >= (3, 5): + # For some reason, this is needed to get access to inet_pton/inet_ntop + # on msvc, but only for 32 bits + DEFINE_MACROS += (('NTDDI_VERSION', 0x06000000),) else: DEFINE_MACROS += (('HAVE_CONFIG_H', 1),) @@ -165,7 +172,6 @@ if "linux" in sys.platform or "darwin" in sys.platform: pymodinit = '__attribute__((visibility ("default"))) {}'.format(pymodinit_type) DEFINE_MACROS += (('PyMODINIT_FUNC', pymodinit),) - # By default, Python3 distutils enforces compatibility of # c plugins (.so files) with the OSX version Python3 was built with. # For Python3.4, this is OSX 10.6, but we need Thread Local Support (__thread) @@ -208,26 +214,32 @@ PACKAGE_DIRECTORIES = { INSTALL_REQUIRES = ( 'six>=1.5.2', 'enum34>=1.0.4', - 'futures>=2.2.0', # TODO(atash): eventually split the grpcio package into a metapackage # depending on protobuf and the runtime component (independent of protobuf) 'protobuf>=3.0.0', ) +if not PY3: + INSTALL_REQUIRES += ('futures>=2.2.0',) + SETUP_REQUIRES = INSTALL_REQUIRES + ( 'sphinx>=1.3', 'sphinx_rtd_theme>=0.1.8', 'six>=1.10', -) -if BUILD_WITH_CYTHON: - sys.stderr.write( - "You requested a Cython build via GRPC_PYTHON_BUILD_WITH_CYTHON, " - "but do not have Cython installed. We won't stop you from using " - "other commands, but the extension files will fail to build.\n") -elif need_cython: - sys.stderr.write( - 'We could not find Cython. Setup may take 10-20 minutes.\n') - SETUP_REQUIRES += ('cython>=0.23',) + ) if ENABLE_DOCUMENTATION_BUILD else () + +try: + import Cython +except ImportError: + if BUILD_WITH_CYTHON: + sys.stderr.write( + "You requested a Cython build via GRPC_PYTHON_BUILD_WITH_CYTHON, " + "but do not have Cython installed. We won't stop you from using " + "other commands, but the extension files will fail to build.\n") + elif need_cython: + sys.stderr.write( + 'We could not find Cython. Setup may take 10-20 minutes.\n') + SETUP_REQUIRES += ('cython>=0.23',) COMMAND_CLASS = { 'doc': commands.SphinxDocumentation, @@ -261,6 +273,7 @@ setuptools.setup( name='grpcio', version=grpc_version.VERSION, license=LICENSE, + long_description=open(README).read(), ext_modules=CYTHON_EXTENSION_MODULES, packages=list(PACKAGES), package_dir=PACKAGE_DIRECTORIES, -- cgit v1.2.3