Add LICENSE to grpcio-* packages
* Using the proprocess command to copy the LICENSE
This commit is contained in:
parent
8d438057e4
commit
5584d58e6c
|
|
@ -1,3 +1,4 @@
|
|||
include grpc_version.py
|
||||
recursive-include grpc_channelz *.py
|
||||
global-exclude *.pyc
|
||||
include LICENSE
|
||||
|
|
|
|||
|
|
@ -21,10 +21,12 @@ import setuptools
|
|||
ROOT_DIR = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
|
||||
CHANNELZ_PROTO = os.path.join(ROOT_DIR,
|
||||
'../../proto/grpc/channelz/channelz.proto')
|
||||
LICENSE = os.path.join(ROOT_DIR, '../../../LICENSE')
|
||||
|
||||
|
||||
class CopyProtoModules(setuptools.Command):
|
||||
"""Command to copy proto modules from grpc/src/proto."""
|
||||
class Preprocess(setuptools.Command):
|
||||
"""Command to copy proto modules from grpc/src/proto and LICENSE from
|
||||
the root directory"""
|
||||
|
||||
description = ''
|
||||
user_options = []
|
||||
|
|
@ -40,6 +42,8 @@ class CopyProtoModules(setuptools.Command):
|
|||
shutil.copyfile(CHANNELZ_PROTO,
|
||||
os.path.join(ROOT_DIR,
|
||||
'grpc_channelz/v1/channelz.proto'))
|
||||
if os.path.isfile(LICENSE):
|
||||
shutil.copyfile(LICENSE, os.path.join(ROOT_DIR, 'LICENSE'))
|
||||
|
||||
|
||||
class BuildPackageProtos(setuptools.Command):
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ try:
|
|||
'grpcio-tools=={version}'.format(version=grpc_version.VERSION),)
|
||||
COMMAND_CLASS = {
|
||||
# Run preprocess from the repository *before* doing any packaging!
|
||||
'preprocess': _channelz_commands.CopyProtoModules,
|
||||
'preprocess': _channelz_commands.Preprocess,
|
||||
'build_package_protos': _channelz_commands.BuildPackageProtos,
|
||||
}
|
||||
except ImportError:
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
include grpc_version.py
|
||||
recursive-include grpc_health *.py
|
||||
global-exclude *.pyc
|
||||
include LICENSE
|
||||
|
|
|
|||
|
|
@ -20,10 +20,12 @@ import setuptools
|
|||
|
||||
ROOT_DIR = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
|
||||
HEALTH_PROTO = os.path.join(ROOT_DIR, '../../proto/grpc/health/v1/health.proto')
|
||||
LICENSE = os.path.join(ROOT_DIR, '../../../LICENSE')
|
||||
|
||||
|
||||
class CopyProtoModules(setuptools.Command):
|
||||
"""Command to copy proto modules from grpc/src/proto."""
|
||||
class Preprocess(setuptools.Command):
|
||||
"""Command to copy proto modules from grpc/src/proto and LICENSE from
|
||||
the root directory"""
|
||||
|
||||
description = ''
|
||||
user_options = []
|
||||
|
|
@ -39,6 +41,8 @@ class CopyProtoModules(setuptools.Command):
|
|||
shutil.copyfile(HEALTH_PROTO,
|
||||
os.path.join(ROOT_DIR,
|
||||
'grpc_health/v1/health.proto'))
|
||||
if os.path.isfile(LICENSE):
|
||||
shutil.copyfile(LICENSE, os.path.join(ROOT_DIR, 'LICENSE'))
|
||||
|
||||
|
||||
class BuildPackageProtos(setuptools.Command):
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ try:
|
|||
'grpcio-tools=={version}'.format(version=grpc_version.VERSION),)
|
||||
COMMAND_CLASS = {
|
||||
# Run preprocess from the repository *before* doing any packaging!
|
||||
'preprocess': _health_commands.CopyProtoModules,
|
||||
'preprocess': _health_commands.Preprocess,
|
||||
'build_package_protos': _health_commands.BuildPackageProtos,
|
||||
}
|
||||
except ImportError:
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
include grpc_version.py
|
||||
recursive-include grpc_reflection *.py
|
||||
global-exclude *.pyc
|
||||
include LICENSE
|
||||
|
|
|
|||
|
|
@ -21,10 +21,12 @@ import setuptools
|
|||
ROOT_DIR = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
|
||||
REFLECTION_PROTO = os.path.join(
|
||||
ROOT_DIR, '../../proto/grpc/reflection/v1alpha/reflection.proto')
|
||||
LICENSE = os.path.join(ROOT_DIR, '../../../LICENSE')
|
||||
|
||||
|
||||
class CopyProtoModules(setuptools.Command):
|
||||
"""Command to copy proto modules from grpc/src/proto."""
|
||||
class Preprocess(setuptools.Command):
|
||||
"""Command to copy proto modules from grpc/src/proto and LICENSE from
|
||||
the root directory"""
|
||||
|
||||
description = ''
|
||||
user_options = []
|
||||
|
|
@ -41,6 +43,8 @@ class CopyProtoModules(setuptools.Command):
|
|||
REFLECTION_PROTO,
|
||||
os.path.join(ROOT_DIR,
|
||||
'grpc_reflection/v1alpha/reflection.proto'))
|
||||
if os.path.isfile(LICENSE):
|
||||
shutil.copyfile(LICENSE, os.path.join(ROOT_DIR, 'LICENSE'))
|
||||
|
||||
|
||||
class BuildPackageProtos(setuptools.Command):
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ try:
|
|||
'grpcio-tools=={version}'.format(version=grpc_version.VERSION),)
|
||||
COMMAND_CLASS = {
|
||||
# Run preprocess from the repository *before* doing any packaging!
|
||||
'preprocess': _reflection_commands.CopyProtoModules,
|
||||
'preprocess': _reflection_commands.Preprocess,
|
||||
'build_package_protos': _reflection_commands.BuildPackageProtos,
|
||||
}
|
||||
except ImportError:
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
include grpc_version.py
|
||||
recursive-include grpc_testing *.py
|
||||
global-exclude *.pyc
|
||||
include LICENSE
|
||||
|
|
|
|||
|
|
@ -24,6 +24,23 @@ os.chdir(os.path.dirname(os.path.abspath(__file__)))
|
|||
# Break import style to ensure that we can find same-directory modules.
|
||||
import grpc_version
|
||||
|
||||
|
||||
class _NoOpCommand(setuptools.Command):
|
||||
"""No-op command."""
|
||||
|
||||
description = ''
|
||||
user_options = []
|
||||
|
||||
def initialize_options(self):
|
||||
pass
|
||||
|
||||
def finalize_options(self):
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
pass
|
||||
|
||||
|
||||
PACKAGE_DIRECTORIES = {
|
||||
'': '.',
|
||||
}
|
||||
|
|
@ -33,6 +50,19 @@ INSTALL_REQUIRES = (
|
|||
'grpcio>={version}'.format(version=grpc_version.VERSION),
|
||||
)
|
||||
|
||||
try:
|
||||
import testing_commands as _testing_commands
|
||||
# we are in the build environment, otherwise the above import fails
|
||||
COMMAND_CLASS = {
|
||||
# Run preprocess from the repository *before* doing any packaging!
|
||||
'preprocess': _testing_commands.Preprocess,
|
||||
}
|
||||
except ImportError:
|
||||
COMMAND_CLASS = {
|
||||
# wire up commands to no-op not to break the external dependencies
|
||||
'preprocess': _NoOpCommand,
|
||||
}
|
||||
|
||||
setuptools.setup(
|
||||
name='grpcio-testing',
|
||||
version=grpc_version.VERSION,
|
||||
|
|
@ -43,4 +73,5 @@ setuptools.setup(
|
|||
url='https://grpc.io',
|
||||
package_dir=PACKAGE_DIRECTORIES,
|
||||
packages=setuptools.find_packages('.'),
|
||||
install_requires=INSTALL_REQUIRES)
|
||||
install_requires=INSTALL_REQUIRES,
|
||||
cmdclass=COMMAND_CLASS)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
# Copyright 2018 gRPC Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
"""Provides distutils command classes for the GRPC Python setup process."""
|
||||
|
||||
import os
|
||||
import shutil
|
||||
|
||||
import setuptools
|
||||
|
||||
ROOT_DIR = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
|
||||
LICENSE = os.path.join(ROOT_DIR, '../../../LICENSE')
|
||||
|
||||
|
||||
class Preprocess(setuptools.Command):
|
||||
"""Command to copy LICENSE from root directory."""
|
||||
|
||||
description = ''
|
||||
user_options = []
|
||||
|
||||
def initialize_options(self):
|
||||
pass
|
||||
|
||||
def finalize_options(self):
|
||||
pass
|
||||
|
||||
def run(self):
|
||||
if os.path.isfile(LICENSE):
|
||||
shutil.copyfile(LICENSE, os.path.join(ROOT_DIR, 'LICENSE'))
|
||||
|
|
@ -105,7 +105,8 @@ then
|
|||
"${PIP}" install grpcio-tools --no-index --find-links "file://$ARTIFACT_DIR/"
|
||||
|
||||
# Build grpcio_testing source distribution
|
||||
${SETARCH_CMD} "${PYTHON}" src/python/grpcio_testing/setup.py sdist
|
||||
${SETARCH_CMD} "${PYTHON}" src/python/grpcio_testing/setup.py preprocess \
|
||||
sdist
|
||||
cp -r src/python/grpcio_testing/dist/* "$ARTIFACT_DIR"
|
||||
|
||||
# Build grpcio_channelz source distribution
|
||||
|
|
|
|||
Loading…
Reference in New Issue