|
11 | 11 |
|
12 | 12 | def parse_args(args): |
13 | 13 | parser = argparse.ArgumentParser(description="Build buck's choco package") |
| 14 | + parser.add_argument( |
| 15 | + "--license-file", |
| 16 | + required=True, |
| 17 | + help="The original license file that needs a prefix added", |
| 18 | + ) |
| 19 | + parser.add_argument( |
| 20 | + "--verification-txt", |
| 21 | + required=True, |
| 22 | + help="The verification.txt template used when creating the nupkg", |
| 23 | + ) |
14 | 24 | parser.add_argument( |
15 | 25 | "--version", required=True, help="The version that is being built" |
16 | 26 | ) |
| 27 | + parser.add_argument( |
| 28 | + "--timestamp", required=True, help="The timestamp when the release was made" |
| 29 | + ) |
17 | 30 | parser.add_argument( |
18 | 31 | "--src-dir", |
19 | 32 | required=True, |
@@ -51,9 +64,29 @@ def build(nuspec, output): |
51 | 64 | os.rename(glob.glob("buck.*.nupkg")[0], output) |
52 | 65 |
|
53 | 66 |
|
| 67 | +def write_license_file(original_license): |
| 68 | + dest = "LICENSE.txt" |
| 69 | + with open(original_license, "r") as fin, open(dest, "w") as fout: |
| 70 | + fout.write("From: https://github.com/facebook/buck/blob/master/LICENSE\n") |
| 71 | + fout.write("\n") |
| 72 | + fout.write(fin.read()) |
| 73 | + |
| 74 | + |
| 75 | +def write_verification_txt(original_verification_txt, version, timestamp): |
| 76 | + dest = "VERIFICATION.txt" |
| 77 | + with open(original_verification_txt, "r") as fin, open(dest, "w") as fout: |
| 78 | + verification_text = fin.read().decode("utf-8") |
| 79 | + verification_text = verification_text.format( |
| 80 | + release_version=version, release_timestamp=timestamp |
| 81 | + ) |
| 82 | + fout.write(verification_text) |
| 83 | + |
| 84 | + |
54 | 85 | if __name__ == "__main__": |
55 | 86 | args = parse_args(sys.argv[1:]) |
56 | 87 | tmp_dir = copy_files(args.src_dir) |
57 | 88 | os.chdir(tmp_dir) |
58 | 89 | update_nuspec("buck.nuspec", "CHANGELOG.md", args.version) |
| 90 | + write_license_file(args.license_file) |
| 91 | + write_verification_txt(args.verification_txt, args.version, args.timestamp) |
59 | 92 | build("buck.nuspec", args.output) |
0 commit comments