File: manifest-version.py

package info (click to toggle)
alire 1.2.1-2.1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 13,124 kB
  • sloc: ada: 77,497; python: 6,605; sh: 477; ansic: 347; makefile: 258; javascript: 87; xml: 40
file content (27 lines) | stat: -rwxr-xr-x 728 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python3
# Find all crates in new index format and move origin-related fields to their own table
#
# The update is done in place and for all indexes found under the current directory.

import alire.index
import os
import rtoml

from alire import index, utils
from pathlib import Path

FROM_VERSION = "0.2"
INTO_VERSION = "0.3"


def fix_manifest(file):
    # file is the absolute path to a manifest
    print(f"   Patching {file}...")
    with open(file, "r") as orig:
        data = orig.read()
    with open(file, "w") as updated:
        updated.write(f'metadata-version = "{INTO_VERSION}"\n')
        updated.write(data)
    

alire.index.migrate_indexes(os.getcwd(), FROM_VERSION, INTO_VERSION, fix_manifest)