(self, package_info: Dict, name: str)
return True
Take the JSON metadata we just fetched and save to disk
Take the JSON metadata we just fetched and save to disk
Take the JSON metadata we just fetched and save to disk
def save_json_metadata(self, package_info: Dict, name: str) -> bool:
        """
        Take the JSON metadata we just fetched and save to disk
        """
        try:
            # TODO: Fix this so it works with swift
            with self.storage_backend.rewrite(self.json_file(name)) as jf:
                dump(package_info, jf, indent=4, sort_keys=True)
            self.diff_file_list.append(self.json_file(name))
        except Exception as e:
            logger.error(
                f"Unable to write json to {self.json_file(name)}: {str(e)} ({type(e)})"
            )
            return False

        symlink_dir = self.json_pypi_symlink(name).parent
        symlink_dir.mkdir(exist_ok=True)
        # Lets always ensure symlink is pointing to correct self.json_file
        # In 4.0 we move to normalized name only so want to overwrite older symlinks
        if self.json_pypi_symlink(name).exists():
            self.json_pypi_symlink(name).unlink()
        self.json_pypi_symlink(name).symlink_to(
            os.path.relpath(self.json_file(name), self.json_pypi_symlink(name).parent)
        )

        return True
def save_json_metadata ( self , package_info : Dict , name : str ) -> bool : try : # TODO: Fix this so it works with swift with self . storage_backend . rewrite ( self . json_file ( name ) ) as jf : dump ( package_info , jf , indent = 4 , sort_keys = True ) self . diff_file_list . append ( self . json_file ( name ) ) except Exception as e : logger . error ( f"Unable to write json to {self.json_file(name)}: {str(e)} ({type(e)})" ) return False symlink_dir = self . json_pypi_symlink ( name ) . parent symlink_dir . mkdir ( exist_ok = True ) # Lets always ensure symlink is pointing to correct self.json_file # In 4.0 we move to normalized name only so want to overwrite older symlinks if self . json_pypi_symlink ( name ) . exists ( ) : self . json_pypi_symlink ( name ) . unlink ( ) self . json_pypi_symlink ( name ) . symlink_to ( os . path . relpath ( self . json_file ( name ) , self . json_pypi_symlink ( name ) . parent ) ) return True