我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用setuptools.command.easy_install.current_umask()。
def symlink_script(self, scriptname, ep): """Symlink script from scripts directory to entry point module""" from setuptools.command.easy_install import chmod, current_umask # build dest module path dest = os.path.join(self.dest_dir, *ep.module_name.split('.')) + '.py' if not os.path.exists(dest): raise ValueError("Module %s not found (entry_point: %s)" % (dest, ep)) # ep.attrs ignored! target = os.path.join(self.install_dir, scriptname) dest = os.path.relpath(dest, os.path.dirname(target)) log.info('symlink_script: %s -> %s', target, dest) self.outfiles.append(target) mask = current_umask() if not self.dry_run: ensure_directory(target) if os.path.exists(target): log.info('symlink_script: target exists: %s: replace', target) os.unlink(target) os.symlink(dest, target) # make dest module executable through target chmod(target, 0o777 - mask)
def write_script(self, script_name, contents, mode="t", *ignored): """Write an executable file to the scripts directory""" from setuptools.command.easy_install import chmod, current_umask log.info("Installing %s script to %s", script_name, self.install_dir) target = os.path.join(self.install_dir, script_name) self.outfiles.append(target) mask = current_umask() if not self.dry_run: ensure_directory(target) f = open(target, "w" + mode) f.write(contents) f.close() chmod(target, 0o777 - mask)
def write_script(self, script_name, contents, mode="t", *ignored): """Write an executable file to the scripts directory""" from setuptools.command.easy_install import chmod, current_umask log.info("Installing %s script to %s", script_name, self.install_dir) target = os.path.join(self.install_dir, script_name) self.outfiles.append(target) mask = current_umask() if not self.dry_run: ensure_directory(target) f = open(target,"w"+mode) f.write(contents) f.close() chmod(target, 0x1FF-mask) # 0777