-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.py
executable file
·85 lines (66 loc) · 2.8 KB
/
build.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env python -E
import os
import subprocess
import argparse
import platform
parser = argparse.ArgumentParser(description="Build skare3 Perl packages.")
parser.add_argument("package", type=str, nargs="?",
help="Package to build. With no argument, only required packages "
"are built. With 'all' argument, required and bonus packages build "
"on linux.")
parser.add_argument("--build-root", default=".", type=str,
help="Path to root directory for output conda build packages."
"Default: '.' (makes 'builds' dir)")
args = parser.parse_args()
req_pkgs = []
system_name = platform.uname().system
machine = platform.uname().machine
# Linux seems to need a built cpanminus for perl-extended-deps to work
if system_name == 'Linux':
req_pkgs.append('perl-app-cpanminus')
# perl-io-tty won't build on mac x86_64 but we want to build it on the other two
# platforms
if (system_name == 'Linux') or ((system_name == 'Darwin') and (machine == 'arm64')):
req_pkgs.append('perl-io-tty')
# For all platforms, these two are needed
req_pkgs += ['perl-core-deps',
'perl-ska-classic']
bonus_pkgs = [
'xtime',
'perl-extended-deps',
'perl-pdl',
'perl-astro-fits-cfitsio',
'perl-astro-fits-cfitsio-simple',
'perl-chandra-time',
'perl-cxc-sysarch',
'perl-app-env-ascds',
'perl-ska-convert',
'perl-ska-agasc',
'perl-ska-web',
'perl-dbd-sybase',
'perl-tk']
build_dir = os.path.join(args.build_root, "builds")
# If a package is requested, do that, else everything.
if args.package is None:
pkgs = req_pkgs
elif args.package == 'all':
if system_name == 'Darwin':
print("Building all packages only supported on Linux")
exit(1)
pkgs = req_pkgs + bonus_pkgs
else:
pkgs = [args.package]
for pkg in pkgs:
cmd = ["conda", "build", "--override-channels", "-c", "https://icxc.cfa.harvard.edu/aspect/ska3-conda/twelve", "-c", "conda-forge"]
# The standard prefix length is 255. It looks like at least a few of the perl packages fail to build
# (astro::fits::header, astro::fits::cfitsio::simple) at that length but are OK at 240 - so this
# just builds all the linux versions at 240. If that is a problem we can rethink.
if (system_name == 'Linux'):
cmd.extend(["--prefix-length", "240"])
cmd.extend(["--use-local",
"--perl", "5.32.1", "--python", "3.12", "--numpy", "1.26.4", "--croot", build_dir, pkg])
# Need conda-forge perl on Linux. Would need to set up a local repo
# to enforce just that package. Adding conda-forge after defaults seems
# to be working on Linux without taking that step (strict-channel-priority
# does not seem to be an option in conda-build).
subprocess.check_call(cmd)