import shutil
import subprocess
import sys
+import stat
from lib.config import LIBCHROMIUMCONTENT_COMMIT, BASE_URL, TARGET_PLATFORM, \
DIST_ARCH
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
DIST_DIR = os.path.join(SOURCE_ROOT, 'dist')
OUT_DIR = os.path.join(SOURCE_ROOT, 'out', 'R')
+CHROMIUM_DIR = os.path.join(SOURCE_ROOT, 'vendor', 'brightray', 'vendor',
+ 'download', 'libchromiumcontent', 'static_library')
SYMBOL_NAME = {
'darwin': 'libchromiumcontent.dylib.dSYM',
def copy_chromedriver():
- build = os.path.join(SOURCE_ROOT, 'script', 'build.py')
- execute([sys.executable, build, '-c', 'Release', '-t', 'copy_chromedriver'])
- binary = 'chromedriver'
if TARGET_PLATFORM == 'win32':
- binary += '.exe'
- shutil.copy2(os.path.join(OUT_DIR, binary), DIST_DIR)
+ chromedriver = 'chromedriver.exe'
+ else:
+ chromedriver = 'chromedriver'
+ src = os.path.join(CHROMIUM_DIR, chromedriver)
+ dest = os.path.join(DIST_DIR, chromedriver)
+
+ # Copy file and keep the executable bit.
+ shutil.copyfile(src, dest)
+ os.chmod(dest, os.stat(dest).st_mode | stat.S_IEXEC)
+
+ # Fix the linking with boringssl.
+ if TARGET_PLATFORM == 'linux':
+ execute(['chrpath', '-r', '$ORIGIN', dest])
def copy_license():
with scoped_cwd(DIST_DIR):
files = ['LICENSE']
if TARGET_PLATFORM == 'win32':
- files += ['chromedriver.exe']
- else:
- files += ['chromedriver']
+ files += ['chromedriver.exe', 'boringssl.dll']
+ elif TARGET_PLATFORM == 'darwin':
+ files += ['chromedriver', 'libboringssl.dylib']
+ elif TARGET_PLATFORM == 'linux':
+ files += ['chromedriver', 'libboringssl.so']
make_zip(zip_file, files, [])
SOURCE_ROOT = os.path.abspath(os.path.join(__file__, '..', '..', '..'))
chromedriver = os.path.join(SOURCE_ROOT, 'out', 'R', 'chromedriver')
output = subprocess.check_output([chromedriver, '-v']).strip()
- return 'v' + output[13:]
+ return 'v' + output[13:output.rfind(' ')]
def parse_version(version):