Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
59994bcc
Commit
59994bcc
authored
9 years ago
by
Masood Malekghassemi
Browse files
Options
Downloads
Patches
Plain Diff
Warn on Python proto module build failure
parent
df97aecb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/python/grpcio/commands.py
+12
-7
12 additions, 7 deletions
src/python/grpcio/commands.py
with
12 additions
and
7 deletions
src/python/grpcio/commands.py
+
12
−
7
View file @
59994bcc
...
@@ -51,6 +51,10 @@ html_theme = 'sphinx_rtd_theme'
...
@@ -51,6 +51,10 @@ html_theme = 'sphinx_rtd_theme'
"""
"""
class
CommandError
(
Exception
):
"""
Simple exception class for GRPC custom commands.
"""
class
SphinxDocumentation
(
setuptools
.
Command
):
class
SphinxDocumentation
(
setuptools
.
Command
):
"""
Command to generate documentation via sphinx.
"""
"""
Command to generate documentation via sphinx.
"""
...
@@ -104,10 +108,10 @@ class BuildProtoModules(setuptools.Command):
...
@@ -104,10 +108,10 @@ class BuildProtoModules(setuptools.Command):
def
run
(
self
):
def
run
(
self
):
if
not
self
.
protoc_command
:
if
not
self
.
protoc_command
:
raise
Exception
(
'
could not find protoc
'
)
raise
CommandError
(
'
could not find protoc
'
)
if
not
self
.
grpc_python_plugin_command
:
if
not
self
.
grpc_python_plugin_command
:
raise
Exception
(
'
could not find grpc_python_plugin
'
raise
CommandError
(
'
could not find grpc_python_plugin
'
'
(protoc plugin for GRPC Python)
'
)
'
(protoc plugin for GRPC Python)
'
)
include_regex
=
re
.
compile
(
self
.
include
)
include_regex
=
re
.
compile
(
self
.
include
)
exclude_regex
=
re
.
compile
(
self
.
exclude
)
if
self
.
exclude
else
None
exclude_regex
=
re
.
compile
(
self
.
exclude
)
if
self
.
exclude
else
None
paths
=
[]
paths
=
[]
...
@@ -130,7 +134,7 @@ class BuildProtoModules(setuptools.Command):
...
@@ -130,7 +134,7 @@ class BuildProtoModules(setuptools.Command):
subprocess
.
check_output
(
'
'
.
join
(
command
),
cwd
=
root_directory
,
shell
=
True
,
subprocess
.
check_output
(
'
'
.
join
(
command
),
cwd
=
root_directory
,
shell
=
True
,
stderr
=
subprocess
.
STDOUT
)
stderr
=
subprocess
.
STDOUT
)
except
subprocess
.
CalledProcessError
as
e
:
except
subprocess
.
CalledProcessError
as
e
:
raise
Exception
(
'
Command:
\n
{}
\n
Message:
\n
{}
\n
Output:
\n
{}
'
.
format
(
raise
CommandError
(
'
Command:
\n
{}
\n
Message:
\n
{}
\n
Output:
\n
{}
'
.
format
(
command
,
e
.
message
,
e
.
output
))
command
,
e
.
message
,
e
.
output
))
...
@@ -156,9 +160,10 @@ class BuildPy(build_py.build_py):
...
@@ -156,9 +160,10 @@ class BuildPy(build_py.build_py):
"""
Custom project build command.
"""
"""
Custom project build command.
"""
def
run
(
self
):
def
run
(
self
):
# TODO(atash): make this warn if the proto modules couldn't be built rather
try
:
# than cause build failure
self
.
run_command
(
'
build_proto_modules
'
)
self
.
run_command
(
'
build_proto_modules
'
)
except
CommandError
as
error
:
sys
.
stderr
.
write
(
'
warning: %s
\n
'
%
error
.
message
)
self
.
run_command
(
'
build_project_metadata
'
)
self
.
run_command
(
'
build_project_metadata
'
)
build_py
.
build_py
.
run
(
self
)
build_py
.
build_py
.
run
(
self
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment