Export provisioning sdk
Change-Id: I4d47d80444c9507f84896767dc676112ca11e901
This commit is contained in:
62
provisioning_sdk/public/python/setup.py
Normal file
62
provisioning_sdk/public/python/setup.py
Normal file
@@ -0,0 +1,62 @@
|
||||
################################################################################
|
||||
# Copyright 2016 Google Inc.
|
||||
#
|
||||
# This software is licensed under the terms defined in the Widevine Master
|
||||
# License Agreement. For a copy of this agreement, please contact
|
||||
# widevine-licensing@google.com.
|
||||
################################################################################
|
||||
|
||||
"""setup script to build Python wrappers using swig configurations."""
|
||||
|
||||
import os
|
||||
|
||||
from distutils import core
|
||||
|
||||
OUT_DIRNAME = 'test_genfiles'
|
||||
|
||||
|
||||
def GetSdkRootDir():
|
||||
"""Obtains folder containing |OUT_DIRNAME| that is considered as root dir."""
|
||||
current_dir = os.path.realpath(os.path.dirname(__file__))
|
||||
while not os.path.isdir(os.path.join(current_dir, OUT_DIRNAME)):
|
||||
current_dir = os.path.dirname(current_dir)
|
||||
return current_dir
|
||||
|
||||
|
||||
SDK_ROOT_DIR = GetSdkRootDir()
|
||||
|
||||
SWIG_CONFIG_FILE = os.path.join(SDK_ROOT_DIR, OUT_DIRNAME, '%s.i')
|
||||
SWIG_CONFIG_MODULE_PATH = OUT_DIRNAME + '.%s'
|
||||
|
||||
SDK_LIBRARY_DIR = os.path.join(SDK_ROOT_DIR, 'bazel-bin', 'provisioning_sdk',
|
||||
'public')
|
||||
|
||||
|
||||
def ProvisioningSwigExtension(extension_name):
|
||||
return core.Extension(
|
||||
name=SWIG_CONFIG_MODULE_PATH % ('_pywrap' + extension_name),
|
||||
sources=[SWIG_CONFIG_FILE % extension_name],
|
||||
include_dirs=[SDK_ROOT_DIR],
|
||||
swig_opts=['-c++'],
|
||||
library_dirs=[SDK_ROOT_DIR, SDK_LIBRARY_DIR],
|
||||
runtime_library_dirs=[SDK_ROOT_DIR, SDK_LIBRARY_DIR],
|
||||
libraries=['provisioning_sdk'],
|
||||
extra_compile_args=['-std=c++11'])
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
os.chdir(SDK_ROOT_DIR)
|
||||
core.setup(
|
||||
name='provisioning_sdk',
|
||||
ext_modules=[
|
||||
ProvisioningSwigExtension('certificate_type'),
|
||||
ProvisioningSwigExtension('provisioning_status'),
|
||||
ProvisioningSwigExtension('provisioning_session'),
|
||||
ProvisioningSwigExtension('provisioning_engine')
|
||||
],
|
||||
py_modules=[
|
||||
SWIG_CONFIG_MODULE_PATH % 'pywrapcertificate_type',
|
||||
SWIG_CONFIG_MODULE_PATH % 'pywarpprovisioning_status',
|
||||
SWIG_CONFIG_MODULE_PATH % 'pywrapprovisioning_session',
|
||||
SWIG_CONFIG_MODULE_PATH % 'pywrapprovisioning_engine'
|
||||
])
|
||||
Reference in New Issue
Block a user