Add (and use) the utility function `add_execution_right`.
This commit is contained in:
parent
a49fb15964
commit
56862b09d6
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import os, sys, stat
|
import os, sys
|
||||||
import argparse
|
import argparse
|
||||||
import ssl
|
import ssl
|
||||||
import urllib.request
|
import urllib.request
|
||||||
|
@ -13,6 +13,7 @@ from dependency_utils import ReleaseDownload, Builder
|
||||||
from utils import (
|
from utils import (
|
||||||
pj,
|
pj,
|
||||||
remove_duplicates,
|
remove_duplicates,
|
||||||
|
add_execution_right,
|
||||||
get_sha256,
|
get_sha256,
|
||||||
StopBuild,
|
StopBuild,
|
||||||
SkipCommand,
|
SkipCommand,
|
||||||
|
@ -667,8 +668,7 @@ class android_ndk(Toolchain):
|
||||||
def _build_platform(self, context):
|
def _build_platform(self, context):
|
||||||
context.try_skip(self.build_path)
|
context.try_skip(self.build_path)
|
||||||
script = pj(self.source_path, 'build/tools/make_standalone_toolchain.py')
|
script = pj(self.source_path, 'build/tools/make_standalone_toolchain.py')
|
||||||
current_permissions = stat.S_IMODE(os.lstat(script).st_mode)
|
add_execution_right(script)
|
||||||
os.chmod(script, current_permissions | stat.S_IXUSR)
|
|
||||||
command = '{script} --arch={arch} --api={api} --install-dir={install_dir} --force'
|
command = '{script} --arch={arch} --api={api} --install-dir={install_dir} --force'
|
||||||
command = command.format(
|
command = command.format(
|
||||||
script=script,
|
script=script,
|
||||||
|
@ -692,8 +692,7 @@ class android_ndk(Toolchain):
|
||||||
file_path = pj(root, file_)
|
file_path = pj(root, file_)
|
||||||
if os.path.islink(file_path):
|
if os.path.islink(file_path):
|
||||||
continue
|
continue
|
||||||
current_permissions = stat.S_IMODE(os.lstat(file_path).st_mode)
|
add_execution_right(file_path)
|
||||||
os.chmod(file_path, current_permissions | stat.S_IXUSR)
|
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
self.command('build_platform', self._build_platform)
|
self.command('build_platform', self._build_platform)
|
||||||
|
|
6
utils.py
6
utils.py
|
@ -2,7 +2,7 @@ import os.path
|
||||||
import hashlib
|
import hashlib
|
||||||
import tarfile, zipfile
|
import tarfile, zipfile
|
||||||
import tempfile
|
import tempfile
|
||||||
import os
|
import os, stat
|
||||||
from collections import namedtuple, defaultdict
|
from collections import namedtuple, defaultdict
|
||||||
|
|
||||||
pj = os.path.join
|
pj = os.path.join
|
||||||
|
@ -32,6 +32,10 @@ def get_sha256(path):
|
||||||
return sha256.hexdigest()
|
return sha256.hexdigest()
|
||||||
|
|
||||||
|
|
||||||
|
def add_execution_right(file_path):
|
||||||
|
current_permissions = stat.S_IMODE(os.lstat(file_path).st_mode)
|
||||||
|
os.chmod(file_path, current_permissions | stat.S_IXUSR)
|
||||||
|
|
||||||
class SkipCommand(Exception):
|
class SkipCommand(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue