项目:MKFQ 作者:maojingios 文件:webbrowser.py |项目代码 |文档代码
def _isexecutable(cmd): if os.path.isfile(cmd): mode = os.stat(cmd)[stat.ST_MODE] if mode & stat.S_IXUSR or mode & stat.S_IXGRP or mode & stat.S_IXOTH: return True return False
项目:nitro 作者:KVM-VMI 文件:cdrom.py |项目代码 |文档代码
def __init__(self): # create cdrom dir self.cdrom_dir_tmp = TemporaryDirectory() self.tmp_dir = TemporaryDirectory() self.cdrom_iso_tmp = None # give qemu permission to execute and read in this directory os.chmod(self.tmp_dir.name, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_IROTH | stat.S_IWOTH | stat.S_IXOTH) self.cdrom_dir = self.cdrom_dir_tmp.name self.cdrom_iso_tmp = None
项目:argosd 作者:danielkoster 文件:commands.py |项目代码 |文档代码
def run(self): """Runs the default installer and sets rights on log directory.""" install.run(self) # Make argosd user owned of log directory uid = getpwnam('argosd').pw_uid gid = getpwnam('argosd').pw_gid os.chown(settings.LOG_PATH, uid, gid) # User has full access, others can read mode = stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | \ stat.S_IRGRP | stat.S_IROTH os.chmod(settings.LOG_PATH, mode)
项目:BotBot 作者:jackstanek 文件:schecks.py |项目代码 |文档代码
def file_group_executable(path): """Check if a file should be group executable""" mode = path.stat().mode if stat.S_ISDIR(mode): return if bool(stat.S_IXUSR & mode) and not bool(stat.S_IXGRP & mode): return 'PROB_FILE_NOT_GRPEXEC'
项目:exec-wrappers 作者:gqmelo 文件:create_wrappers.py |项目代码 |文档代码
def _create_wrappers(files_to_wrap, destination_dir, run_in_template_filename, template_func, inline=False, command=''): os.path.exists(destination_dir) or os.makedirs(destination_dir) with open(run_in_template_filename, 'r') as f: run_in_template = template_func(f.read()) if not inline: run_in_filename = os.path.join(destination_dir, 'run-in' + get_wrapper_extension()) with open(run_in_filename, 'w') as f: f.write(run_in_template.replace('__COMMAND__', command)) os.chmod(run_in_filename, os.stat(run_in_filename).st_mode | stat.S_IXUSR) for filename in files_to_wrap: basename = os.path.basename(filename) if basename == 'run-in' + get_wrapper_extension(): continue destination_filename = get_wrapper_full_path(destination_dir, basename) if inline: content = run_in_template.replace('__COMMAND__', command + filename + ' ') else: content = get_wrapper_template().format( command=command, run_in_file=run_in_filename, wrapped_file=filename) with open(destination_filename, 'w') as f: f.write(content) os.chmod(destination_filename, os.stat(destination_filename).st_mode | stat.S_IXUSR)
项目:exec-wrappers 作者:gqmelo 文件:test_integration.py |项目代码 |文档代码
def _environ_from_activate(activate_script, tmpdir): activate_file = tmpdir.join('environ-from-activate') + \ get_wrapper_extension() activate_file.write('''%s python -c "from os import environ; print(dict(environ))" ''' % activate_script) activate_file.chmod(activate_file.stat().mode | stat.S_IXUSR) output = subprocess.check_output(str(activate_file)) environ_from_activate = eval(output) return environ_from_activate
项目:exec-wrappers 作者:gqmelo 文件:test_create_wrappers.py |项目代码 |文档代码
def _create_executable_file(filepath): if sys.platform == 'win32': filepath = filepath.new(ext='bat') filepath.write('') if sys.platform != 'win32': filepath.chmod(filepath.stat().mode | stat.S_IXUSR) return filepath
项目:DevOps 作者:YoLoveLife 文件:find.py |项目代码 |文档代码
def statinfo(st): return { 'mode' : "o" % stat.S_IMODE(st.st_mode), 'isdir' : stat.S_ISDIR(st.st_mode), 'ischr' : stat.S_ISCHR(st.st_mode), 'isblk' : stat.S_ISBLK(st.st_mode), 'isreg' : stat.S_ISREG(st.st_mode), 'isfifo' : stat.S_ISFIFO(st.st_mode), 'islnk' : stat.S_ISLNK(st.st_mode), 'issock' : stat.S_ISSOCK(st.st_mode), 'uid' : st.st_uid, 'gid' : st.st_gid, 'size' : st.st_size, 'inode' : st.st_ino, 'dev' : st.st_dev, 'nlink' : st.st_nlink, 'atime' : st.st_atime, 'mtime' : st.st_mtime, 'ctime' : st.st_ctime, 'wusr' : bool(st.st_mode & stat.S_IWUSR), 'rusr' : bool(st.st_mode & stat.S_IRUSR), 'xusr' : bool(st.st_mode & stat.S_IXUSR), 'wgrp' : bool(st.st_mode & stat.S_IWGRP), 'rgrp' : bool(st.st_mode & stat.S_IRGRP), 'xgrp' : bool(st.st_mode & stat.S_IXGRP), 'woth' : bool(st.st_mode & stat.S_IWOTH), 'roth' : bool(st.st_mode & stat.S_IROTH), 'xoth' : bool(st.st_mode & stat.S_IXOTH), 'isuid' : bool(st.st_mode & stat.S_ISUID), 'isgid' : bool(st.st_mode & stat.S_ISGID), }
项目:DevOps 作者:YoLoveLife 文件:basic.py |项目代码 |文档代码
本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/shumachanpin/article-119245-7.html
我比您稍微保守一点
具体情况不清楚可以警告一下不走开必要击沉
奶茶