aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Masood Malekghassemi <atash@google.com>2016-07-16 01:42:52 -0700
committerGravatar Masood Malekghassemi <atash@google.com>2016-07-16 01:45:18 -0700
commit58a0494cebb3d0d262557ec9ac25f60f2053fc86 (patch)
treeb24d467066b5234e9386d2e749d17570ccc38c5b
parenta39c2cb4f2881351fb8844d5e5a49e5bc80e2f8a (diff)
Use normalized path separators in `setup.py`s
-rw-r--r--setup.py17
-rw-r--r--tools/distrib/python/grpcio_tools/setup.py27
2 files changed, 28 insertions, 16 deletions
diff --git a/setup.py b/setup.py
index 28aa5a5c8e..5d33756c19 100644
--- a/setup.py
+++ b/setup.py
@@ -47,10 +47,10 @@ from setuptools.command import egg_info
egg_info.manifest_maker.template = 'PYTHON-MANIFEST.in'
PY3 = sys.version_info.major == 3
-PYTHON_STEM = './src/python/grpcio'
-CORE_INCLUDE = ('./include', '.',)
-BORINGSSL_INCLUDE = ('./third_party/boringssl/include',)
-ZLIB_INCLUDE = ('./third_party/zlib',)
+PYTHON_STEM = os.path.join('src', 'python', 'grpcio')
+CORE_INCLUDE = ('include', '.',)
+BORINGSSL_INCLUDE = (os.path.join('third_party', 'boringssl', 'include'),)
+ZLIB_INCLUDE = (os.path.join('third_party', 'zlib'),)
# Ensure we're in the proper directory whether or not we're being used by pip.
os.chdir(os.path.dirname(os.path.abspath(__file__)))
@@ -105,7 +105,9 @@ if not "win32" in sys.platform:
if "win32" in sys.platform:
EXTENSION_LIBRARIES += ('ws2_32',)
-DEFINE_MACROS = (('OPENSSL_NO_ASM', 1), ('_WIN32_WINNT', 0x600), ('GPR_BACKWARDS_COMPATIBILITY_MODE', 1),)
+DEFINE_MACROS = (
+ ('OPENSSL_NO_ASM', 1), ('_WIN32_WINNT', 0x600),
+ ('GPR_BACKWARDS_COMPATIBILITY_MODE', 1),)
if "win32" in sys.platform:
DEFINE_MACROS += (('OPENSSL_WINDOWS', 1), ('WIN32_LEAN_AND_MEAN', 1),)
if '64bit' in platform.architecture()[0]:
@@ -200,12 +202,13 @@ COMMAND_CLASS = {
}
# Ensure that package data is copied over before any commands have been run:
-credentials_dir = os.path.join(PYTHON_STEM, 'grpc/_cython/_credentials')
+credentials_dir = os.path.join(PYTHON_STEM, 'grpc', '_cython', '_credentials')
try:
os.mkdir(credentials_dir)
except OSError:
pass
-shutil.copyfile('etc/roots.pem', os.path.join(credentials_dir, 'roots.pem'))
+shutil.copyfile(os.path.join('etc', 'roots.pem'),
+ os.path.join(credentials_dir, 'roots.pem'))
PACKAGE_DATA = {
# Binaries that may or may not be present in the final installation, but are
diff --git a/tools/distrib/python/grpcio_tools/setup.py b/tools/distrib/python/grpcio_tools/setup.py
index d804f34fc6..a00ce01110 100644
--- a/tools/distrib/python/grpcio_tools/setup.py
+++ b/tools/distrib/python/grpcio_tools/setup.py
@@ -61,6 +61,13 @@ EXTRA_COMPILE_ARGS = shlex.split(os.environ.get('GRPC_PYTHON_CFLAGS',
EXTRA_LINK_ARGS = shlex.split(os.environ.get('GRPC_PYTHON_LDFLAGS',
'-lpthread'))
+CC_FILES = [
+ os.path.normpath(cc_file) for cc_file in protoc_lib_deps.CC_FILES]
+PROTO_FILES = [
+ os.path.normpath(proto_file) for proto_file in protoc_lib_deps.PROTO_FILES]
+CC_INCLUDE = os.path.normpath(protoc_lib_deps.CC_INCLUDE)
+PROTO_INCLUDE = os.path.normpath(protoc_lib_deps.PROTO_INCLUDE)
+
GRPC_PYTHON_TOOLS_PACKAGE = 'grpc.tools'
GRPC_PYTHON_PROTO_RESOURCES_NAME = '_proto'
@@ -82,8 +89,8 @@ def package_data():
proto_resources_path = os.path.join(tools_path,
GRPC_PYTHON_PROTO_RESOURCES_NAME)
proto_files = []
- for proto_file in protoc_lib_deps.PROTO_FILES:
- source = os.path.join(protoc_lib_deps.PROTO_INCLUDE, proto_file)
+ for proto_file in PROTO_FILES:
+ source = os.path.join(PROTO_INCLUDE, proto_file)
target = os.path.join(proto_resources_path, proto_file)
relative_target = os.path.join(GRPC_PYTHON_PROTO_RESOURCES_NAME, proto_file)
try:
@@ -99,18 +106,20 @@ def package_data():
def protoc_ext_module():
plugin_sources = [
- 'grpc/tools/main.cc',
- 'grpc_root/src/compiler/python_generator.cc'] + [
- os.path.join(protoc_lib_deps.CC_INCLUDE, cc_file)
- for cc_file in protoc_lib_deps.CC_FILES]
+ os.path.join('grpc', 'tools', 'main.cc'),
+ os.path.join('grpc_root', 'src', 'compiler', 'python_generator.cc')] + [
+ os.path.join(CC_INCLUDE, cc_file)
+ for cc_file in CC_FILES]
plugin_ext = extension.Extension(
name='grpc.tools._protoc_compiler',
- sources=['grpc/tools/_protoc_compiler.pyx'] + plugin_sources,
+ sources=(
+ [os.path.join('grpc', 'tools', '_protoc_compiler.pyx')] +
+ plugin_sources),
include_dirs=[
'.',
'grpc_root',
- 'grpc_root/include',
- protoc_lib_deps.CC_INCLUDE,
+ os.path.join('grpc_root', 'include'),
+ CC_INCLUDE,
],
language='c++',
define_macros=list(DEFINE_MACROS),