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
1d177817
Commit
1d177817
authored
9 years ago
by
Masood Malekghassemi
Browse files
Options
Downloads
Patches
Plain Diff
Check compiler versions at Python setup time
parent
59994bcc
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
setup.py
+3
-8
3 additions, 8 deletions
setup.py
src/python/grpcio/commands.py
+31
-0
31 additions, 0 deletions
src/python/grpcio/commands.py
with
34 additions
and
8 deletions
setup.py
+
3
−
8
View file @
1d177817
...
...
@@ -81,15 +81,10 @@ EXTENSION_LIBRARIES = ()
if
not
"
darwin
"
in
sys
.
platform
:
EXTENSION_LIBRARIES
+=
(
'
rt
'
,)
EXTRA_COMPILE_ARGS
=
()
if
not
"
win
"
in
sys
.
platform
:
EXTRA_COMPILE_ARGS
=
(
'
-pthread
'
,)
DEFINE_MACROS
=
((
'
OPENSSL_NO_ASM
'
,
1
),)
def
cython_extensions
(
package_names
,
module_names
,
include_dirs
,
libraries
,
define_macros
,
extra_compile_args
,
build_with_cython
=
False
):
define_macros
,
build_with_cython
=
False
):
if
ENABLE_CYTHON_TRACING
:
define_macros
=
define_macros
+
[(
'
CYTHON_TRACE_NOGIL
'
,
1
)]
file_extension
=
'
pyx
'
if
build_with_cython
else
'
c
'
...
...
@@ -101,7 +96,6 @@ def cython_extensions(package_names, module_names, include_dirs, libraries,
name
=
module_name
,
sources
=
[
module_file
]
+
grpc_core_dependencies
.
CORE_SOURCE_FILES
,
include_dirs
=
include_dirs
,
libraries
=
libraries
,
extra_compile_args
=
extra_compile_args
,
define_macros
=
define_macros
,
)
for
(
module_name
,
module_file
)
in
zip
(
module_names
,
module_files
)
]
...
...
@@ -117,7 +111,7 @@ def cython_extensions(package_names, module_names, include_dirs, libraries,
CYTHON_EXTENSION_MODULES
=
cython_extensions
(
list
(
CYTHON_EXTENSION_PACKAGE_NAMES
),
list
(
CYTHON_EXTENSION_MODULE_NAMES
),
list
(
EXTENSION_INCLUDE_DIRECTORIES
),
list
(
EXTENSION_LIBRARIES
),
list
(
DEFINE_MACROS
),
list
(
EXTRA_COMPILE_ARGS
),
bool
(
BUILD_WITH_CYTHON
))
list
(
DEFINE_MACROS
),
bool
(
BUILD_WITH_CYTHON
))
PACKAGE_DIRECTORIES
=
{
''
:
PYTHON_STEM
,
...
...
@@ -137,6 +131,7 @@ COMMAND_CLASS = {
'
build_proto_modules
'
:
commands
.
BuildProtoModules
,
'
build_project_metadata
'
:
commands
.
BuildProjectMetadata
,
'
build_py
'
:
commands
.
BuildPy
,
'
build_ext
'
:
commands
.
BuildExt
,
'
gather
'
:
commands
.
Gather
,
'
run_interop
'
:
commands
.
RunInterop
,
}
...
...
This diff is collapsed.
Click to expand it.
src/python/grpcio/commands.py
+
31
−
0
View file @
1d177817
...
...
@@ -40,6 +40,17 @@ import setuptools
from
setuptools.command
import
build_py
from
setuptools.command
import
test
# Because we need to support building without Cython but simultaneously need to
# subclass its command class when we need to and because distutils requires a
# special hook to acquire a command class, we attempt to import Cython's
# build_ext, and if that fails we import setuptools'.
try
:
# Due to the strange way Cython's Distutils module re-imports build_ext, we
# import the build_ext class directly.
from
Cython.Distutils.build_ext
import
build_ext
except
ImportError
:
from
setuptools.command.build_ext
import
build_ext
PYTHON_STEM
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
CONF_PY_ADDENDUM
=
"""
...
...
@@ -168,6 +179,26 @@ class BuildPy(build_py.build_py):
build_py
.
build_py
.
run
(
self
)
class
BuildExt
(
build_ext
):
"""
Custom build_ext command to enable compiler-specific flags.
"""
C_OPTIONS
=
{
'
unix
'
:
(
'
-pthread
'
,
'
-std=gnu99
'
),
'
msvc
'
:
(),
}
LINK_OPTIONS
=
{}
def
build_extensions
(
self
):
compiler
=
self
.
compiler
.
compiler_type
if
compiler
in
BuildExt
.
C_OPTIONS
:
for
extension
in
self
.
extensions
:
extension
.
extra_compile_args
+=
list
(
BuildExt
.
C_OPTIONS
[
compiler
])
if
compiler
in
BuildExt
.
LINK_OPTIONS
:
for
extension
in
self
.
extensions
:
extension
.
extra_link_args
+=
list
(
BuildExt
.
LINK_OPTIONS
[
compiler
])
build_ext
.
build_extensions
(
self
)
class
Gather
(
setuptools
.
Command
):
"""
Command to gather project dependencies.
"""
...
...
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