diff options
-rw-r--r-- | src/node/ext/call_credentials.cc | 12 | ||||
-rw-r--r-- | src/node/ext/call_credentials.h | 4 | ||||
-rw-r--r-- | src/node/ext/node_grpc.cc | 14 | ||||
-rwxr-xr-x | src/ruby/tools/bin/grpc_tools_ruby_protoc | 4 | ||||
-rwxr-xr-x | src/ruby/tools/bin/grpc_tools_ruby_protoc_plugin | 4 | ||||
-rw-r--r-- | src/ruby/tools/grpc-tools.gemspec | 2 | ||||
-rw-r--r-- | src/ruby/tools/platform_check.rb (renamed from src/ruby/tools/os_check.rb) | 29 | ||||
-rwxr-xr-x | tools/run_tests/helper_scripts/build_python.sh | 11 |
8 files changed, 43 insertions, 37 deletions
diff --git a/src/node/ext/call_credentials.cc b/src/node/ext/call_credentials.cc index 4d172d4ddf..afcc363131 100644 --- a/src/node/ext/call_credentials.cc +++ b/src/node/ext/call_credentials.cc @@ -35,7 +35,7 @@ #include <nan.h> #include <uv.h> -#include <list> +#include <queue> #include "grpc/grpc.h" #include "grpc/grpc_security.h" @@ -170,7 +170,7 @@ NAN_METHOD(CallCredentials::CreateFromPlugin) { grpc_metadata_credentials_plugin plugin; plugin_state *state = new plugin_state; state->callback = new Nan::Callback(info[0].As<Function>()); - state->pending_callbacks = new std::list<plugin_callback_data*>(); + state->pending_callbacks = new std::queue<plugin_callback_data*>(); uv_mutex_init(&state->plugin_mutex); uv_async_init(uv_default_loop(), &state->plugin_async, @@ -231,13 +231,13 @@ NAN_METHOD(PluginCallback) { NAUV_WORK_CB(SendPluginCallback) { Nan::HandleScope scope; plugin_state *state = reinterpret_cast<plugin_state*>(async->data); - std::list<plugin_callback_data*> callbacks; + std::queue<plugin_callback_data*> callbacks; uv_mutex_lock(&state->plugin_mutex); - callbacks.splice(callbacks.begin(), *state->pending_callbacks); + state->pending_callbacks->swap(callbacks); uv_mutex_unlock(&state->plugin_mutex); while (!callbacks.empty()) { plugin_callback_data *data = callbacks.front(); - callbacks.pop_front(); + callbacks.pop(); Local<Object> callback_data = Nan::New<Object>(); Nan::Set(callback_data, Nan::New("cb").ToLocalChecked(), Nan::New<v8::External>(reinterpret_cast<void*>(data->cb))); @@ -266,7 +266,7 @@ void plugin_get_metadata(void *state, grpc_auth_metadata_context context, data->user_data = user_data; uv_mutex_lock(&p_state->plugin_mutex); - p_state->pending_callbacks->push_back(data); + p_state->pending_callbacks->push(data); uv_mutex_unlock(&p_state->plugin_mutex); uv_async_send(&p_state->plugin_async); diff --git a/src/node/ext/call_credentials.h b/src/node/ext/call_credentials.h index 04c852bea1..21a4b8923e 100644 --- a/src/node/ext/call_credentials.h +++ b/src/node/ext/call_credentials.h @@ -34,7 +34,7 @@ #ifndef GRPC_NODE_CALL_CREDENTIALS_H_ #define GRPC_NODE_CALL_CREDENTIALS_H_ -#include <list> +#include <queue> #include <node.h> #include <nan.h> @@ -84,7 +84,7 @@ typedef struct plugin_callback_data { typedef struct plugin_state { Nan::Callback *callback; - std::list<plugin_callback_data*> *pending_callbacks; + std::queue<plugin_callback_data*> *pending_callbacks; uv_mutex_t plugin_mutex; // async.data == this uv_async_t plugin_async; diff --git a/src/node/ext/node_grpc.cc b/src/node/ext/node_grpc.cc index 682af0e5ad..95e273f8ac 100644 --- a/src/node/ext/node_grpc.cc +++ b/src/node/ext/node_grpc.cc @@ -31,7 +31,7 @@ * */ -#include <list> +#include <queue> #include <node.h> #include <nan.h> @@ -77,7 +77,7 @@ typedef struct log_args { typedef struct logger_state { Nan::Callback *callback; - std::list<log_args *> *pending_args; + std::queue<log_args *> *pending_args; uv_mutex_t mutex; uv_async_t async; // Indicates that a logger has been set @@ -338,14 +338,14 @@ NAN_METHOD(SetDefaultRootsPem) { NAUV_WORK_CB(LogMessagesCallback) { Nan::HandleScope scope; - std::list<log_args *> args; + std::queue<log_args *> args; uv_mutex_lock(&grpc_logger_state.mutex); - args.splice(args.begin(), *grpc_logger_state.pending_args); + grpc_logger_state.pending_args->swap(args); uv_mutex_unlock(&grpc_logger_state.mutex); /* Call the callback with each log message */ while (!args.empty()) { log_args *arg = args.front(); - args.pop_front(); + args.pop(); Local<Value> file = Nan::New(arg->core_args.file).ToLocalChecked(); Local<Value> line = Nan::New<Uint32, uint32_t>(arg->core_args.line); Local<Value> severity = Nan::New( @@ -372,7 +372,7 @@ void node_log_func(gpr_log_func_args *args) { args_copy->timestamp = gpr_now(GPR_CLOCK_REALTIME); uv_mutex_lock(&grpc_logger_state.mutex); - grpc_logger_state.pending_args->push_back(args_copy); + grpc_logger_state.pending_args->push(args_copy); uv_mutex_unlock(&grpc_logger_state.mutex); uv_async_send(&grpc_logger_state.async); @@ -380,7 +380,7 @@ void node_log_func(gpr_log_func_args *args) { void init_logger() { memset(&grpc_logger_state, 0, sizeof(logger_state)); - grpc_logger_state.pending_args = new std::list<log_args *>(); + grpc_logger_state.pending_args = new std::queue<log_args *>(); uv_mutex_init(&grpc_logger_state.mutex); uv_async_init(uv_default_loop(), &grpc_logger_state.async, diff --git a/src/ruby/tools/bin/grpc_tools_ruby_protoc b/src/ruby/tools/bin/grpc_tools_ruby_protoc index dab06e7958..7e619e74a9 100755 --- a/src/ruby/tools/bin/grpc_tools_ruby_protoc +++ b/src/ruby/tools/bin/grpc_tools_ruby_protoc @@ -30,7 +30,7 @@ require 'rbconfig' -require_relative '../os_check' +require_relative '../platform_check' ext = RbConfig::CONFIG['EXEEXT'] @@ -39,7 +39,7 @@ protoc_name = 'protoc' + ext plugin_name = 'grpc_ruby_plugin' + ext protoc_dir = File.join(File.dirname(__FILE__), - RbConfig::CONFIG['host_cpu'] + '-' + OS.os_name) + PLATFORM.architecture + '-' + PLATFORM.os_name) protoc_path = File.join(protoc_dir, protoc_name) diff --git a/src/ruby/tools/bin/grpc_tools_ruby_protoc_plugin b/src/ruby/tools/bin/grpc_tools_ruby_protoc_plugin index 4b296dedc7..e6af2fe365 100755 --- a/src/ruby/tools/bin/grpc_tools_ruby_protoc_plugin +++ b/src/ruby/tools/bin/grpc_tools_ruby_protoc_plugin @@ -30,12 +30,12 @@ require 'rbconfig' -require_relative '../os_check' +require_relative '../platform_check' plugin_name = 'grpc_ruby_plugin' + RbConfig::CONFIG['EXEEXT'] plugin_path = File.join(File.dirname(__FILE__), - RbConfig::CONFIG['host_cpu'] + '-' + OS.os_name, + PLATFORM.architecture + '-' + PLATFORM.os_name, plugin_name) exec([ plugin_path, plugin_path ], *ARGV) diff --git a/src/ruby/tools/grpc-tools.gemspec b/src/ruby/tools/grpc-tools.gemspec index 68e2a7a113..bc142ae3cb 100644 --- a/src/ruby/tools/grpc-tools.gemspec +++ b/src/ruby/tools/grpc-tools.gemspec @@ -11,7 +11,7 @@ Gem::Specification.new do |s| s.description = 'protoc and the Ruby gRPC protoc plugin' s.license = 'BSD-3-Clause' - s.files = %w( version.rb os_check.rb README.md ) + s.files = %w( version.rb platform_check.rb README.md ) s.files += Dir.glob('bin/**/*') s.bindir = 'bin' diff --git a/src/ruby/tools/os_check.rb b/src/ruby/tools/platform_check.rb index 2677306457..1f4d5a68b7 100644 --- a/src/ruby/tools/os_check.rb +++ b/src/ruby/tools/platform_check.rb @@ -27,19 +27,28 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# This is based on http://stackoverflow.com/a/171011/159388 by Aaron Hinni - require 'rbconfig' -module OS - def OS.os_name +# This is based on http://stackoverflow.com/a/171011/159388 by Aaron Hinni + +module PLATFORM + def PLATFORM.os_name case RbConfig::CONFIG['host_os'] - when /cygwin|mswin|mingw|bccwin|wince|emx/ - 'windows' - when /darwin/ - 'macos' - else - 'linux' + when /cygwin|mswin|mingw|bccwin|wince|emx/ + 'windows' + when /darwin/ + 'macos' + else + 'linux' + end + end + + def PLATFORM.architecture + case RbConfig::CONFIG['host_cpu'] + when /x86_64/ + 'x86_64' + else + 'x86' end end end diff --git a/tools/run_tests/helper_scripts/build_python.sh b/tools/run_tests/helper_scripts/build_python.sh index 0e88e96765..5647d9c2fc 100755 --- a/tools/run_tests/helper_scripts/build_python.sh +++ b/tools/run_tests/helper_scripts/build_python.sh @@ -163,22 +163,18 @@ pip_install_dir() { PWD=`pwd` cd $1 ($VENV_PYTHON setup.py build_ext -c $TOOLCHAIN || true) - # install the dependencies - $VENV_PYTHON -m pip install --upgrade . - # ensure that we've reinstalled the test packages - $VENV_PYTHON -m pip install --upgrade --force-reinstall --no-deps . + $VENV_PYTHON -m pip install --no-deps . cd $PWD } $VENV_PYTHON -m pip install --upgrade pip $VENV_PYTHON -m pip install setuptools $VENV_PYTHON -m pip install cython +$VENV_PYTHON -m pip install six enum34 protobuf futures pip_install_dir $ROOT + $VENV_PYTHON $ROOT/tools/distrib/python/make_grpcio_tools.py pip_install_dir $ROOT/tools/distrib/python/grpcio_tools -# TODO(atash) figure out namespace packages and grpcio-tools and auditwheel -# etc... -pip_install_dir $ROOT # Build/install health checking $VENV_PYTHON $ROOT/src/python/grpcio_health_checking/setup.py preprocess @@ -191,6 +187,7 @@ $VENV_PYTHON $ROOT/src/python/grpcio_reflection/setup.py build_package_protos pip_install_dir $ROOT/src/python/grpcio_reflection # Build/install tests +$VENV_PYTHON -m pip install coverage oauth2client $VENV_PYTHON $ROOT/src/python/grpcio_tests/setup.py preprocess $VENV_PYTHON $ROOT/src/python/grpcio_tests/setup.py build_package_protos pip_install_dir $ROOT/src/python/grpcio_tests |