Skip to content

Commit

Permalink
Reorganize Python packages
Browse files Browse the repository at this point in the history
This is in preparation of moving all tests into a separate package to
enable ease of coverage checking and testing.
  • Loading branch information
soltanmm committed Jul 30, 2015
1 parent 772fb1e commit fe8dc88
Show file tree
Hide file tree
Showing 170 changed files with 29 additions and 48 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
html_theme = 'sphinx_rtd_theme'
"""


class SphinxDocumentation(setuptools.Command):
"""Command to generate documentation via sphinx."""

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 2 additions & 20 deletions src/python/src/setup.py → src/python/grpcio/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,29 +79,11 @@
_EXTENSION_MODULES = [_C_EXTENSION_MODULE]

_PACKAGES = (
'grpc',
'grpc._adapter',
'grpc._junkdrawer',
'grpc._links',
'grpc.early_adopter',
'grpc.framework',
'grpc.framework.alpha',
'grpc.framework.base',
'grpc.framework.common',
'grpc.framework.face',
'grpc.framework.face.testing',
'grpc.framework.foundation',
'grpc.framework.interfaces',
'grpc.framework.interfaces.links',
setuptools.find_packages('.', exclude=['*._cython', '*._cython.*'])
)

_PACKAGE_DIRECTORIES = {
'grpc': 'grpc',
'grpc._adapter': 'grpc/_adapter',
'grpc._junkdrawer': 'grpc/_junkdrawer',
'grpc._links': 'grpc/_links',
'grpc.early_adopter': 'grpc/early_adopter',
'grpc.framework': 'grpc/framework',
'': '.',
}

_INSTALL_REQUIRES = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@

from grpc.early_adopter import implementations

from interop import _interop_test_case
from interop import methods
from grpc_interop import _interop_test_case
from grpc_interop import methods


class InsecureInteropTest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

"""Common code for unit tests of the interoperability test code."""

from interop import methods
from grpc_interop import methods


class InteropTestCase(object):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@

from grpc.early_adopter import implementations

from interop import _interop_test_case
from interop import methods
from interop import resources
from grpc_interop import _interop_test_case
from grpc_interop import methods
from grpc_interop import resources

_SERVER_HOST_OVERRIDE = 'foo.test.google.fr'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@

from grpc.early_adopter import implementations

from interop import methods
from interop import resources
from grpc_interop import methods
from grpc_interop import resources

_ONE_DAY_IN_SECONDS = 60 * 60 * 24

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@

from grpc.framework.alpha import utilities

from interop import empty_pb2
from interop import messages_pb2
from grpc_interop import empty_pb2
from grpc_interop import messages_pb2

_TIMEOUT = 7

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@

from grpc.early_adopter import implementations

from interop import methods
from interop import resources
from grpc_interop import methods
from grpc_interop import resources

_ONE_DAY_IN_SECONDS = 60 * 60 * 24

Expand Down
File renamed without changes.
10 changes: 4 additions & 6 deletions src/python/interop/setup.py → src/python/grpcio_test/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,22 @@

import setuptools

_PACKAGES = (
'interop',
)
_PACKAGES = setuptools.find_packages('.')

_PACKAGE_DIRECTORIES = {
'interop': 'interop',
'': '.',
}

_PACKAGE_DATA = {
'interop': [
'grpc_interop': [
'credentials/ca.pem', 'credentials/server1.key',
'credentials/server1.pem',]
}

_INSTALL_REQUIRES = ['oauth2client>=1.4.7', 'grpcio>=0.10.0a0']

setuptools.setup(
name='interop',
name='grpcio_test',
version='0.0.1',
packages=_PACKAGES,
package_dir=_PACKAGE_DIRECTORIES,
Expand Down
4 changes: 2 additions & 2 deletions tools/distrib/python/docgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
PROJECT_ROOT = os.path.abspath(os.path.join(SCRIPT_DIR, '..', '..', '..'))

CONFIG = args.config
SETUP_PATH = os.path.join(PROJECT_ROOT, 'src/python/src/setup.py')
DOC_PATH = os.path.join(PROJECT_ROOT, 'src/python/src/doc/build')
SETUP_PATH = os.path.join(PROJECT_ROOT, 'src/python/grpcio/setup.py')
DOC_PATH = os.path.join(PROJECT_ROOT, 'src/python/grpcio/doc/build')
INCLUDE_PATH = os.path.join(PROJECT_ROOT, 'include')
LIBRARY_PATH = os.path.join(PROJECT_ROOT, 'libs/{}'.format(CONFIG))
VIRTUALENV_DIR = os.path.join(SCRIPT_DIR, 'distrib_virtualenv')
Expand Down
2 changes: 1 addition & 1 deletion tools/distrib/python/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

# Move to the root directory of Python GRPC.
pkgdir = os.path.join(os.path.dirname(os.path.abspath(__file__)),
'../../../src/python/src')
'../../../src/python/grpcio')
# Remove previous distributions; they somehow confuse twine.
try:
shutil.rmtree(os.path.join(pkgdir, 'dist/'))
Expand Down
10 changes: 5 additions & 5 deletions tools/run_tests/build_python.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,22 @@ make_virtualenv() {
virtualenv -p `which "python"$1` $virtualenv_name
source $virtualenv_name/bin/activate
pip install -r src/python/requirements.txt
CFLAGS="-I$root/include -std=c89" LDFLAGS=-L$root/libs/$CONFIG GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install src/python/src
pip install src/python/interop
CFLAGS="-I$root/include -std=c89" LDFLAGS=-L$root/libs/$CONFIG GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install src/python/grpcio
pip install src/python/grpcio_test
else
source $virtualenv_name/bin/activate
# Uninstall and re-install the packages we care about. Don't use
# --force-reinstall or --ignore-installed to avoid propagating this
# unnecessarily to dependencies. Don't use --no-deps to avoid missing
# dependency upgrades.
(yes | pip uninstall grpcio) || true
(yes | pip uninstall interop) || true
(CFLAGS="-I$root/include -std=c89" LDFLAGS=-L$root/libs/$CONFIG GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install src/python/src) || (
(yes | pip uninstall grpcio_test) || true
(CFLAGS="-I$root/include -std=c89" LDFLAGS=-L$root/libs/$CONFIG GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install src/python/grpcio) || (
# Fall back to rebuilding the entire environment
rm -rf $virtualenv_name
make_virtualenv $1
)
pip install src/python/interop
pip install src/python/grpcio_test
fi
}

Expand Down
4 changes: 2 additions & 2 deletions tools/run_tests/python_tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@
]
},
{
"module": "interop._insecure_interop_test",
"module": "grpc_interop._insecure_interop_test",
"pythonVersions": [
"2.7"
]
},
{
"module": "interop._secure_interop_test",
"module": "grpc_interop._secure_interop_test",
"pythonVersions": [
"2.7"
]
Expand Down

0 comments on commit fe8dc88

Please sign in to comment.