Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3a276557 authored by Jack He's avatar Jack He
Browse files

Cert: chmod +x on host executables after install

Bug: 151989046
Test: gd/cert/run --host
Change-Id: I3e47afb5818ba3702535c78f1ba726b5f2448194
parent af49ba68
Loading
Loading
Loading
Loading
+22 −7
Original line number Diff line number Diff line
@@ -15,11 +15,11 @@
#   limitations under the License.

from distutils import log
import logging
import os
from setuptools import setup, find_packages
from setuptools.command.install import install
from setuptools.command.develop import develop
import stat
import subprocess
import sys

@@ -27,6 +27,11 @@ install_requires = [
    'grpcio',
]

host_executables = [
    'root-canal',
    'bluetooth_stack_with_facade',
]


def setup_acts_for_cmd_or_die(cmd_str):
    acts_framework_dir = os.path.abspath('acts_framework')
@@ -35,6 +40,17 @@ def setup_acts_for_cmd_or_die(cmd_str):
    subprocess.check_call(cmd, cwd=acts_framework_dir)


def set_permssions_for_host_executables(outputs):
    for file in outputs:
        if os.path.basename(file) in host_executables:
            current_mode = os.stat(file).st_mode
            new_mode = current_mode | stat.S_IEXEC
            os.chmod(file, new_mode)
            log.log(
                log.INFO, "Changed file mode of %s from %s to %s" %
                (file, oct(current_mode), oct(new_mode)))


class InstallLocalPackagesForInstallation(install):

    def run(self):
@@ -42,15 +58,17 @@ class InstallLocalPackagesForInstallation(install):
        setup_acts_for_cmd_or_die("install")
        self.announce('ACTS installed for installation.', log.INFO)
        install.run(self)
        set_permssions_for_host_executables(self.get_outputs())


class InstallLocalPackagesForDevelopment(develop):

    def run(self):
        logging.info('Installing ACTS for development')
        log.log(log.INFO, 'Installing ACTS for development')
        setup_acts_for_cmd_or_die("develop")
        logging.info('ACTS installed for development')
        log.log(log.INFO, 'ACTS installed for development')
        develop.run(self)
        set_permssions_for_host_executables(self.get_outputs())


def main():
@@ -70,10 +88,7 @@ def main():
        packages=[''] + find_packages(exclude='acts_framework'),
        install_requires=install_requires,
        package_data={
            '': [
                'root-canal', 'bluetooth_stack_with_facade', '*.so',
                'lib64/*.so', 'target/*'
            ],
            '': host_executables + ['*.so', 'lib64/*.so', 'target/*'],
            'cert': ['all_test_cases'],
        },
        cmdclass={