Ejemplo n.º 1
0
def persist_package_cache() -> None:
    """Write the contents of the package cache for this GOROOT into the disk
    """

    cachefile = os.path.join(cache_directory, project_name(), 'packages.cache')
    if not os.path.exists(os.path.dirname(cachefile)):
        os.makedirs(os.path.dirname(cachefile))

    with open(cachefile, 'w') as fd:
        json.dump(PACKAGES_CACHE[go.GOROOT], fd)
Ejemplo n.º 2
0
def load_package_cache() -> typing.List:
    """Load a previously stores package cache file
    """

    global PACKAGES_CACHE
    cachefile = os.path.join(cache_directory, project_name(), 'packages.cache')
    try:
        with open(cachefile, 'r') as fd:
            PACKAGES_CACHE[go.GOROOT] = json.load(fd)
    except FileNotFoundError:
        pass
Ejemplo n.º 3
0
    def _project_name(self) -> str:
        """Return the current project name
        """

        return project_name()
Ejemplo n.º 4
0
    def _project_name(self) -> str:
        """Return the current project name
        """

        return project_name()