-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathget_dist_info.py
executable file
·63 lines (51 loc) · 1.93 KB
/
get_dist_info.py
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
60
61
62
63
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
from dist_config import (
WHEEL_LINUX_CONFIGS,
WHEEL_WINDOWS_CONFIGS,
WHEEL_PYTHON_VERSIONS,
) # NOQA
from dist_utils import (
wheel_linux_platform_tag,
sdist_name,
wheel_name,
get_version_from_source_tree,
) # NOQA
class DistInfoPrinter(object):
def parse_args(self):
parser = argparse.ArgumentParser()
parser.add_argument(
'--target', required=True,
choices=['sdist', 'wheel-linux', 'wheel-win'],
help='build target')
parser.add_argument(
'--source', type=str, required=True,
help='path to the CuPy source tree; must be a clean checkout')
# Options specific for wheels:
parser.add_argument(
'--cuda', type=str,
help='CUDA version for the wheel distribution')
parser.add_argument(
'--python', type=str, choices=WHEEL_PYTHON_VERSIONS.keys(),
help='python version to build wheel with')
return parser.parse_args()
def main(self):
args = self.parse_args()
version = get_version_from_source_tree(args.source)
if args.target == 'wheel-linux':
pkg_name = WHEEL_LINUX_CONFIGS[args.cuda]['name']
arch = WHEEL_LINUX_CONFIGS[args.cuda].get('arch', 'x86_64')
filename = wheel_name(
pkg_name, version, args.python,
wheel_linux_platform_tag(arch, True))
elif args.target == 'wheel-win':
pkg_name = WHEEL_WINDOWS_CONFIGS[args.cuda]['name']
filename = wheel_name(pkg_name, version, args.python, 'win_amd64')
elif args.target == 'sdist':
pkg_name = 'cupy'
filename = sdist_name(pkg_name, version)
print('DIST_FILE_NAME="{}"'.format(filename))
print('DIST_PACKAGE_NAME="{}"'.format(pkg_name))
if __name__ == '__main__':
DistInfoPrinter().main()