INNER CODE UNIT · Python

append

alper-han/CrossMacro · scripts/ci/nuget-cache.py:68

def append(path, values):
    with open(path, 'a', encoding='utf-8') as stream:
        for key, value in values.items():
            stream.write(f'{key}={value}\n')


def main():
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument('command', choices=['prepare', 'collect', 'restored', 'summary'])
    args = parser.parse_args()
    feed = Path(os.environ['RUNNER_TEMP']) / 'crossmacro-nuget-feed'
    state = Path(os.environ['RUNNER_TEMP']) / 'crossmacro-nuget-cache.json'
    if args.command == 'prepare':
        profile = os.environ['CACHE_PROFILE']
        if profile not in {'source', 'publish'}:
            raise ValueError('Unknown NuGet cache profile')
        feed.mkdir(parents=True, exist_ok=True)
        prefix = f"nuget-archives-v1-{os.environ['RUNNER_OS']}-{os.environ['RUNNER_ARCH']}-{profile}-{os.environ['CACHE_SDK']}-"

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…