當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。