-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathupdate_python.mjs
More file actions
59 lines (52 loc) · 3.01 KB
/
update_python.mjs
File metadata and controls
59 lines (52 loc) · 3.01 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
// ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃
// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃
// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃
// ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃
// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
// ┃ Copyright (c) 2017, the Perspective Authors. ┃
// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃
// ┃ This file is part of the Perspective library, distributed under the terms ┃
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
/// Use this script to update the `requirements-*.txt` files in the
/// `python/perspective` directory. This only needs to be done when the actual
/// dependencies _or_ supported Python versions change - to update these deps
/// otherwise is to invite the wrath of the CI gods.
import sh from "./sh.mjs";
import * as fs from "fs";
const VERSIONS = [
// "3.7",
"3.8",
"3.9",
"3.10",
"3.11",
];
for (const version of VERSIONS) {
sh`
pip3 install "python/perspective[dev]"
--dry-run
--report=report.json
--python-version=${version}
--only-binary=:all:
--platform=manylinux_2_12_x86_64
--platform=manylinux_2_17_x86_64
--ignore-installed
--target=.
`.runSync();
const data = JSON.parse(fs.readFileSync("report.json"));
let output = "";
for (const {
metadata: { version, name },
} of data.install) {
output += `${name}==${version}\n`;
}
fs.writeFileSync(
`python/perspective/requirements/requirements-${version.replace(
".",
""
)}.txt`,
output
);
}
fs.rmSync("report.json");