当前位置: 首页>>代码示例>>Python>>正文


Python stat.S_IEXEC属性代码示例

本文整理汇总了Python中stat.S_IEXEC属性的典型用法代码示例。如果您正苦于以下问题:Python stat.S_IEXEC属性的具体用法?Python stat.S_IEXEC怎么用?Python stat.S_IEXEC使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在stat的用法示例。


在下文中一共展示了stat.S_IEXEC属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _configure_autotools

# 需要导入模块: import stat [as 别名]
# 或者: from stat import S_IEXEC [as 别名]
def _configure_autotools(self):
        if not self._autotools:
            self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)
            if self.settings.os == "Macos":
                configure_file = "configure"
                tools.replace_in_file(configure_file, r"-install_name \$rpath/", "-install_name ")
                configure_stats = os.stat(configure_file)
                os.chmod(configure_file, configure_stats.st_mode | stat.S_IEXEC)
            configure_args = []
            if self.options.disable_assembly:
                configure_args.append('--disable-assembly')
            if self.options.shared:
                configure_args.extend(["--enable-shared", "--disable-static"])
            else:
                configure_args.extend(["--disable-shared", "--enable-static"])
            if self.options.enable_cxx:
                configure_args.append('--enable-cxx')
            self._autotools.configure(args=configure_args)
        return self._autotools 
开发者ID:conan-io,项目名称:conan-center-index,代码行数:21,代码来源:conanfile.py

示例2: download

# 需要导入模块: import stat [as 别名]
# 或者: from stat import S_IEXEC [as 别名]
def download(version='LATEST'):
    destination_file_path = os.path.join(DESTINATION_DIR, MAC_DRIVER_NAME)
    destination_unzip_path = os.path.join(DESTINATION_DIR, 'chromedriver')
    if os.path.exists(destination_unzip_path):
        return "{} driver exists".format(destination_unzip_path)
    if version == 'LATEST':
        download_version = get_chromedriver_latest_version()
    else:
        download_version = version
    latest_path = "%s/%s/%s" % (DOWNLOAD_URL,
                                download_version, MAC_DRIVER_NAME)
    with open(destination_file_path, 'wb') as f:
        for chunk in requests.get(latest_path, stream=True).iter_content(chunk_size=1024):
            if chunk:
                f.write(chunk)
    with zipfile.ZipFile(destination_file_path, 'r') as f:
        with open(destination_unzip_path, 'wb') as d:
            d.write(f.read('chromedriver'))
    st = os.stat(destination_unzip_path)
    os.chmod(destination_unzip_path, (st.st_mode | stat.S_IEXEC))
    return destination_unzip_path 
开发者ID:kboard,项目名称:kboard,代码行数:23,代码来源:download_chromedriver.py

示例3: collect_linux_binaries

# 需要导入模块: import stat [as 别名]
# 或者: from stat import S_IEXEC [as 别名]
def collect_linux_binaries(directory):
    lib_dir = os.path.join(directory,'install', 'lib')
    bin_dir = os.path.join(directory,'install', 'bin')
    for name in os.listdir(bin_dir):
        ext = os.path.splitext(name)
        (key, value) = ext
        if value == exe_ext and key in included_filenames:
            out_path = os.path.join(bin_out, name)
            in_path = os.path.join(bin_dir, name)
            shutil.copyfile(in_path, out_path)
            st = os.stat(out_path)
            os.chmod(out_path, st.st_mode | stat.S_IEXEC)
    for name in os.listdir(lib_dir):
        if name in libraries:
            actual_lib = os.path.join(lib_dir, name)
            while os.path.islink(actual_lib):
                linkto = os.readlink(actual_lib)
                actual_lib = os.path.join(lib_dir, linkto)
            bin_name = os.path.join(bin_out, name)
            shutil.copyfile(actual_lib, bin_name) 
开发者ID:MontrealCorpusTools,项目名称:Montreal-Forced-Aligner,代码行数:22,代码来源:opengrm_ngram_binaries.py

示例4: download_bazel_binary_at_commit

# 需要导入模块: import stat [as 别名]
# 或者: from stat import S_IEXEC [as 别名]
def download_bazel_binary_at_commit(dest_dir, platform, bazel_git_commit):
    bazel_binary_path = os.path.join(dest_dir, "bazel.exe" if platform == "windows" else "bazel")
    try:
        execute_command(
            [
                gsutil_command(),
                "cp",
                bazelci_builds_gs_url(platform, bazel_git_commit),
                bazel_binary_path,
            ]
        )
    except subprocess.CalledProcessError as e:
        raise BuildkiteException(
            "Failed to download Bazel binary at %s, error message:\n%s" % (bazel_git_commit, str(e))
        )
    st = os.stat(bazel_binary_path)
    os.chmod(bazel_binary_path, st.st_mode | stat.S_IEXEC)
    return bazel_binary_path 
开发者ID:bazelbuild,项目名称:continuous-integration,代码行数:20,代码来源:bazelci.py

示例5: install

# 需要导入模块: import stat [as 别名]
# 或者: from stat import S_IEXEC [as 别名]
def install(client, force):
    """Install Git hooks."""
    warning_messages = []
    for hook in HOOKS:
        hook_path = Path(get_hook_path(hook, client.repo.git_dir))
        if hook_path.exists():
            if not force:
                warning_messages.append(
                    'Hook already exists. Skipping {0}'.format(str(hook_path))
                )
                continue
            else:
                hook_path.unlink()

        # Make sure the hooks directory exists.
        hook_path.parent.mkdir(parents=True, exist_ok=True)

        Path(hook_path).write_bytes(
            pkg_resources.resource_string(
                'renku.data', '{hook}.sh'.format(hook=hook)
            )
        )
        hook_path.chmod(hook_path.stat().st_mode | stat.S_IEXEC)

    return warning_messages 
开发者ID:SwissDataScienceCenter,项目名称:renku-python,代码行数:27,代码来源:githooks.py

示例6: _copy_archive

# 需要导入模块: import stat [as 别名]
# 或者: from stat import S_IEXEC [as 别名]
def _copy_archive(archive, new_archive, interpreter=None):
    """Copy an application archive, modifying the shebang line."""
    with _maybe_open(archive, 'rb') as src:
        # Skip the shebang line from the source.
        # Read 2 bytes of the source and check if they are #!.
        first_2 = src.read(2)
        if first_2 == b'#!':
            # Discard the initial 2 bytes and the rest of the shebang line.
            first_2 = b''
            src.readline()

        with _maybe_open(new_archive, 'wb') as dst:
            _write_file_prefix(dst, interpreter)
            # If there was no shebang, "first_2" contains the first 2 bytes
            # of the source file, so write them before copying the rest
            # of the file.
            dst.write(first_2)
            shutil.copyfileobj(src, dst)

    if interpreter and isinstance(new_archive, str):
        os.chmod(new_archive, os.stat(new_archive).st_mode | stat.S_IEXEC) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:23,代码来源:zipapp.py

示例7: make_linux

# 需要导入模块: import stat [as 别名]
# 或者: from stat import S_IEXEC [as 别名]
def make_linux(self):
        """
        Properly create a Linux executable.
        """
        if LINUX:
             path = os.path.join(self.build_exe, 'run.sh')
             with open(path, mode='w') as f:
                f.write(textwrap.dedent("""#!/bin/sh
                APP="{0}"
                EXEC="{1}"
                VERSION="{2}"
                DIRNAME=`dirname $0`
                LD_LIBRARY_PATH=$DIRNAME
                export LD_LIBRARY_PATH
                echo "Starting $APP $VERSION ..."
                chmod +x $DIRNAME/$EXEC
                $DIRNAME/$EXEC "$@"
                echo "... bye!"
                """.format(APPNAME, EXEC_NAME, VERSION)))

             for filename in [EXEC_NAME, 'run.sh']:
                 filepath = os.path.join(self.build_exe, filename)
                 st = os.stat(filepath)
                 os.chmod(filepath, st.st_mode | stat.S_IEXEC) 
开发者ID:danielepantaleone,项目名称:eddy,代码行数:26,代码来源:setup.py

示例8: classdump_mac

# 需要导入模块: import stat [as 别名]
# 或者: from stat import S_IEXEC [as 别名]
def classdump_mac(clsdmp_bin, tools_dir, ipa_bin):
    """Run Classdump for Objective-C/Swift."""
    if clsdmp_bin == 'class-dump-swift':
        logger.info('Running class-dump-swift against binary')
        external = settings.CLASSDUMP_SWIFT_BINARY
    else:
        logger.info('Running class-dump against binary')
        external = settings.CLASSDUMP_BINARY
    if (len(external) > 0
            and is_file_exists(external)):
        class_dump_bin = external
    else:
        class_dump_bin = os.path.join(
            tools_dir, clsdmp_bin)
    # Execute permission check
    if not os.access(class_dump_bin, os.X_OK):
        os.chmod(class_dump_bin, stat.S_IEXEC)
    return subprocess.check_output([class_dump_bin, ipa_bin]) 
开发者ID:MobSF,项目名称:Mobile-Security-Framework-MobSF,代码行数:20,代码来源:classdump.py

示例9: save

# 需要导入模块: import stat [as 别名]
# 或者: from stat import S_IEXEC [as 别名]
def save(filename):
    try:
        os.mkdir('saves/')
    except OSError:
        pass
    try:
        data = unicornhathd.get_pixels()
        data = repr(data)
        data = data.replace('array', 'list')
        print(filename, data)
        file = open('saves/' + filename + '.py', 'w')
        file.write("""#!/usr/bin/env python
import unicornhathd
import signal

unicornhathd.rotation(0)

pixels = {}

for x in range(unicornhathd.WIDTH):
    for y in range(unicornhathd.HEIGHT):
        r, g, b = pixels[x][y]
        unicornhathd.set_pixel(x, y, r, g, b)

unicornhathd.show()

print("\\nShowing: {}\\nPress Ctrl+C to exit!")

signal.pause()
""".format(data, filename))
        file.close()
        os.chmod('saves/' + filename + '.py', 0o777 | stat.S_IEXEC)

        return("ok" + str(unicornhathd.get_pixels()))
    except AttributeError:
        print("Unable to save, please update")
        print("unicornhathdhathd library!")
        return("fail") 
开发者ID:pimoroni,项目名称:unicorn-hat-hd,代码行数:40,代码来源:paint.py

示例10: chmod_plus_x

# 需要导入模块: import stat [as 别名]
# 或者: from stat import S_IEXEC [as 别名]
def chmod_plus_x(executable_path):
    current_st = os.stat(executable_path)
    os.chmod(executable_path, current_st.st_mode | stat.S_IEXEC) 
开发者ID:ethereum,项目名称:py-solc,代码行数:5,代码来源:install_solc.py

示例11: ensure_exec_perms

# 需要导入模块: import stat [as 别名]
# 或者: from stat import S_IEXEC [as 别名]
def ensure_exec_perms(file_):
    st = os.stat(file_)
    os.chmod(file_, st.st_mode | stat.S_IEXEC)
    return file_ 
开发者ID:jmarth,项目名称:plugin.video.kmediatorrent,代码行数:6,代码来源:torrent2http.py

示例12: source

# 需要导入模块: import stat [as 别名]
# 或者: from stat import S_IEXEC [as 别名]
def source(self):
        tools.get(**self.conan_data["sources"][self.version])
        os.rename("{}-{}".format(self.name, self.version), self._source_subfolder)
        tools.rmdir(os.path.join(self._source_subfolder, "contrib"))
        if not tools.os_info.is_windows:
            configure_file = os.path.join(self._source_subfolder, "configure")
            st = os.stat(configure_file)
            os.chmod(configure_file, st.st_mode | stat.S_IEXEC) 
开发者ID:conan-io,项目名称:conan-center-index,代码行数:10,代码来源:conanfile.py

示例13: source

# 需要导入模块: import stat [as 别名]
# 或者: from stat import S_IEXEC [as 别名]
def source(self):
        tools.get(**self.conan_data["sources"][self.version])

        os.rename("{}-{}".format(self.name, self.version), self._source_subfolder)
        if not tools.os_info.is_windows:
            configure_file = os.path.join(self._source_subfolder, "configure")
            st = os.stat(configure_file)
            os.chmod(configure_file, st.st_mode | stat.S_IEXEC) 
开发者ID:conan-io,项目名称:conan-center-index,代码行数:10,代码来源:conanfile.py

示例14: test_get_info_uses_hook_path

# 需要导入模块: import stat [as 别名]
# 或者: from stat import S_IEXEC [as 别名]
def test_get_info_uses_hook_path(self, tmp_path):
        magic = tmp_path / "magic{}".format(os.path.splitext(sys.executable)[1])
        wrapper = (
            "#!{executable}\n"
            "import subprocess\n"
            "import sys\n"
            'sys.exit(subprocess.call(["{executable}"] + sys.argv[1:]))\n'
        ).format(executable=sys.executable)
        magic.write_text(wrapper)
        magic.chmod(magic.stat().st_mode | stat.S_IEXEC)

        class MockHook:
            def tox_get_python_executable(self, envconfig):
                return str(magic)

        class envconfig:
            basepython = sys.executable
            envname = "magicpy"

        # Check that the wrapper is working first.
        # If it isn't, the default is to return the passed path anyway.
        subprocess.check_call([str(magic), "--help"])

        interpreters = Interpreters(hook=MockHook())
        info = interpreters.get_info(envconfig)
        assert info.executable == str(magic) 
开发者ID:tox-dev,项目名称:tox,代码行数:28,代码来源:test_interpreters.py

示例15: _create_script

# 需要导入模块: import stat [as 别名]
# 或者: from stat import S_IEXEC [as 别名]
def _create_script(self):
        moved_log_dir = tempfile.mkdtemp('movedlogs')
        with tempfile.NamedTemporaryFile(delete=False, mode='w') as f:
            f.write("""
#!/bin/sh
mv $1 %s
                """%moved_log_dir)
            move_script = f.name
        st = os.stat(move_script)
        os.chmod(move_script, st.st_mode | stat.S_IEXEC)
        return (moved_log_dir, move_script) 
开发者ID:apache,项目名称:cassandra-dtest,代码行数:13,代码来源:auditlog_test.py


注:本文中的stat.S_IEXEC属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。