Skip to content

Commit

Permalink
Exclude cygrpc.so from the Python package
Browse files Browse the repository at this point in the history
  • Loading branch information
soltanmm-google committed Feb 18, 2016
1 parent a5fc981 commit 7361734
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
3 changes: 2 additions & 1 deletion PYTHON-MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
graft src/python/grpcio/grpc
recursive-include src/python/grpcio/grpc *.c *.h *.py *.pyx *.pxd *.pxi *.python *.pem
recursive-exclude src/python/grpcio/grpc/_cython *.so *.pyd
graft src/python/grpcio/tests
graft src/core
graft include/grpc
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ def cython_extensions(package_names, module_names, extra_sources, include_dirs,
'grpc._cython': [
'_windows/grpc_c.32.python',
'_windows/grpc_c.64.python',
'cygrpc.so',
],
}
if INSTALL_TESTS:
Expand Down
2 changes: 2 additions & 0 deletions src/python/grpcio/precompiled.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,5 @@ def update_setup_arguments(setup_arguments):
sys.stderr.write(
'could not write precompiled extension to directory: {} -> {}\n'
.format(url, target_path))
return
setup_arguments['package_data']['grpc._cython'].append('cygrpc.so')
13 changes: 11 additions & 2 deletions tools/run_tests/build_artifact_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ then
pip install -rrequirements.txt
fi

# Build the source distribution first because MANIFEST.in cannot override
# exclusion of built shared objects among package resources (for some
# inexplicable reason).
GRPC_PYTHON_USE_CUSTOM_BDIST=0 \
GRPC_PYTHON_BUILD_WITH_CYTHON=1 \
${SETARCH_CMD} python setup.py \
sdist

# The bdist_wheel_grpc_custom command is finicky about command output ordering
# and thus ought to be run in a shell command separate of others. Further, it
# trashes the actual bdist_wheel output, so it should be run first so that
Expand All @@ -48,11 +56,12 @@ GRPC_PYTHON_BUILD_WITH_CYTHON=1 \
${SETARCH_CMD} python setup.py \
build_tagged_ext

# Wheel has a bug where directories don't get excluded.
# https://bitbucket.org/pypa/wheel/issues/99/cannot-exclude-directory
GRPC_PYTHON_USE_CUSTOM_BDIST=0 \
GRPC_PYTHON_BUILD_WITH_CYTHON=1 \
${SETARCH_CMD} python setup.py \
bdist_wheel \
sdist
bdist_wheel

mkdir -p artifacts

Expand Down

0 comments on commit 7361734

Please sign in to comment.