def process_move(self, data_table_name, column_name, source_base_path, relative_symlinks=False, **kwd): if data_table_name in self.move_by_data_table_column and column_name in self.move_by_data_table_column[ data_table_name]: move_dict = self.move_by_data_table_column[data_table_name][ column_name] source = move_dict['source_base'] if source is None: source = source_base_path else: source = fill_template( source, GALAXY_DATA_MANAGER_DATA_PATH=self.data_managers.app. config.galaxy_data_manager_data_path, **kwd) if move_dict['source_value']: source = os.path.join( source, fill_template( move_dict['source_value'], GALAXY_DATA_MANAGER_DATA_PATH=self.data_managers.app. config.galaxy_data_manager_data_path, **kwd)) target = move_dict['target_base'] if target is None: target = self.data_managers.app.config.galaxy_data_manager_data_path else: target = fill_template( target, GALAXY_DATA_MANAGER_DATA_PATH=self.data_managers.app. config.galaxy_data_manager_data_path, **kwd) if move_dict['target_value']: target = os.path.join( target, fill_template( move_dict['target_value'], GALAXY_DATA_MANAGER_DATA_PATH=self.data_managers.app. config.galaxy_data_manager_data_path, **kwd)) if move_dict['type'] == 'file': dirs = os.path.split(target)[0] try: os.makedirs(dirs) except OSError as e: if e.errno != errno.EEXIST: raise e # moving a directory and the target already exists, we move the contents instead util.move_merge(source, target) if move_dict.get('relativize_symlinks', False): util.relativize_symlinks(target) return True return False
def process_move(self, data_table_name, column_name, source_base_path, relative_symlinks=False, **kwd): if data_table_name in self.move_by_data_table_column and column_name in self.move_by_data_table_column[data_table_name]: move_dict = self.move_by_data_table_column[data_table_name][column_name] source = move_dict['source_base'] if source is None: source = source_base_path else: source = fill_template(source, GALAXY_DATA_MANAGER_DATA_PATH=self.data_managers.app.config.galaxy_data_manager_data_path, **kwd).strip() if move_dict['source_value']: source = os.path.join(source, fill_template(move_dict['source_value'], GALAXY_DATA_MANAGER_DATA_PATH=self.data_managers.app.config.galaxy_data_manager_data_path, **kwd).strip()) target = move_dict['target_base'] if target is None: target = self.data_managers.app.config.galaxy_data_manager_data_path else: target = fill_template(target, GALAXY_DATA_MANAGER_DATA_PATH=self.data_managers.app.config.galaxy_data_manager_data_path, **kwd).strip() if move_dict['target_value']: target = os.path.join(target, fill_template(move_dict['target_value'], GALAXY_DATA_MANAGER_DATA_PATH=self.data_managers.app.config.galaxy_data_manager_data_path, **kwd).strip()) if move_dict['type'] == 'file': dirs = os.path.split(target)[0] try: os.makedirs(dirs) except OSError as e: if e.errno != errno.EEXIST: raise e # moving a directory and the target already exists, we move the contents instead if os.path.exists(source): util.move_merge(source, target) if move_dict.get('relativize_symlinks', False): util.relativize_symlinks(target) return True return False
def process_move(self, data_table_name, column_name, source_base_path, relative_symlinks=False, **kwd): if ( data_table_name in self.move_by_data_table_column and column_name in self.move_by_data_table_column[data_table_name] ): move_dict = self.move_by_data_table_column[data_table_name][column_name] source = move_dict["source_base"] if source is None: source = source_base_path else: source = fill_template( source, GALAXY_DATA_MANAGER_DATA_PATH=self.data_managers.app.config.galaxy_data_manager_data_path, **kwd ) if move_dict["source_value"]: source = os.path.join( source, fill_template( move_dict["source_value"], GALAXY_DATA_MANAGER_DATA_PATH=self.data_managers.app.config.galaxy_data_manager_data_path, **kwd ), ) target = move_dict["target_base"] if target is None: target = self.data_managers.app.config.galaxy_data_manager_data_path else: target = fill_template( target, GALAXY_DATA_MANAGER_DATA_PATH=self.data_managers.app.config.galaxy_data_manager_data_path, **kwd ) if move_dict["target_value"]: target = os.path.join( target, fill_template( move_dict["target_value"], GALAXY_DATA_MANAGER_DATA_PATH=self.data_managers.app.config.galaxy_data_manager_data_path, **kwd ), ) if move_dict["type"] == "file": dirs, filename = os.path.split(target) try: os.makedirs(dirs) except OSError, e: if e.errno != errno.EEXIST: raise e # log.debug( 'Error creating directory "%s": %s' % ( dirs, e ) ) # moving a directory and the target already exists, we move the contents instead util.move_merge(source, target) if move_dict.get("relativize_symlinks", False): util.relativize_symlinks(target) return True