def commandline(self): self._params = ['src', 'dst'] src = Path.normalized(getattr(self, 'src', None)) dst = Path.normalized(getattr(self, 'dst', None)) is_directory = getattr(self, 'is_directory', False) return HostPlatform.instance.copy_command(src, dst, is_directory=is_directory)
def commandline(self): self._params = ['path'] path = Path.normalized( getattr(self, "path", None)) cwd = get_working_directory() newpath = Path.absolute(os.path.join(cwd, path)) push_working_directory(newpath) #logging.info("current directory: \"%s\"" % cwd) #logging.info("push_directory: %s" % newpath) return None
def startup(): # setup the environment Core.set_install_path() # initialize logging Core.init_logging(None) # load the config file Core.load_config("config.json") Path.set_hostplatform(HostPlatform) Attributes.load_attributes(Core.config)
def run(self): path = Path.normalized(getattr(self, 'path', None)) is_directory = getattr(self, 'is_directory', False) # don't execute anything if the path doesn't exist on the local filesystem. if (is_directory and os.path.isdir(path)) or os.path.exists(path): return super(Delete, self).run() else: return ""
def run(self): src = Path.normalized(getattr(self, 'src', None)) dst = Path.normalized(getattr(self, 'dst', None)) md = Makedirs( path=dst ) md.run() try: for path in glob.iglob( src ): if os.path.isdir( path ): #logging.info("Need to handle directory copy: %s -> %s" % (path, dst)) shutil.copytree( path, os.path.join(dst, os.path.basename(path)), symlinks=True ) else: #logging.info("Copying file: %s" % path) shutil.copy( path, dst ) except OSError as e: import errno if e.errno == errno.EEXIST: pass except: raise return True
def run(self): path = Path.normalized( getattr(self, 'path', None)) if path: try: path = Path.absolute(os.path.join(get_working_directory(), path)) # if this path already exists; return False as it wasn't # created by this method. if os.path.isdir(path): return False #logging.info( "MAKEDIRS: %s" % path ) os.makedirs(path) except OSError as exc: if exc.errno == 20: logging.error("Attempted to make a path: \"%s\", but ran into a file with the name of an expected directory." % path) logging.error("Check for files that have the same name of the directory you may want to create.") raise # OSError: [Errno 17] File exists: pass except: raise return True
def commandline(self): self._params = ['path'] path = Path.normalized(getattr(self, 'path', None)) is_directory = getattr(self, 'is_directory', False) return HostPlatform.instance.delete_command(path, is_directory=is_directory)