forked from hubutui/pkgbuild-generator-for-r
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_pkgbuild_for_r.py
executable file
·59 lines (53 loc) · 2.54 KB
/
generate_pkgbuild_for_r.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
#!/usr/bin/env python3
import argparse
from PKGBUILDGenerator.PKGBUILDGenerator import PKGBUILDGenerator
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument("--rpkgnames", type=str, nargs='+',
help="r pkgnames in CRAN or Bioconductor")
parser.add_argument("--repo", type=str, choices=["cran", "bioconductor", "github"], default="cran",
help="repo to use, default: cran")
parser.add_argument("--destdir", default='.',
help="destdir, default: .")
parser.add_argument("--maintainer", type=str,
help="maintainer in PKGBUILD")
parser.add_argument("--email", type=str,
help="email of maintainer in PKGBUILD")
parser.add_argument("--clean", action="store_true",
help="clean temporaly files")
parser.add_argument("--recursive", action="store_true",
help="create also the PKGBUILD for deps")
parser.add_argument("--verbose", action="store_true",
help="be verbose")
parser.add_argument("--skip", action="store_true",
help="skip PKGBUILD generator if the PKGBUILD exists")
parser.add_argument("--updpkgsums", action="store_true",
help="run updatepkgsums to update source checksums")
parser.add_argument("--cran-mirror", type=str, default="https://mirrors.ustc.edu.cn/CRAN",
help="CRAN mirror, default: https://mirrors.ustc.edu.cn/CRAN")
parser.add_argument("--bioconductor-mirror", type=str, default="https://mirrors.ustc.edu.cn/bioc/",
help="Bioconductor mirror, default: https://mirrors.ustc.edu.cn/bioc/")
parser.add_argument("--maintainer-github", type=str,
help="github username of PKGBUILD maintainer, only used in `lilac.yaml`")
return parser.parse_args()
if __name__ == '__main__':
args = get_args()
gen = PKGBUILDGenerator(
cran_mirror=args.cran_mirror,
bioconductor_mirror=args.bioconductor_mirror
)
for rpkgname in args.rpkgnames:
gen.generate_pkgbuild(
rpkgname=rpkgname,
maintainer_github=args.maintainer_github,
maintainer=args.maintainer,
email=args.email,
recursive=args.recursive,
verbose=args.verbose,
updpkgsums=args.updpkgsums,
repo=args.repo,
skip=args.skip,
destdir=args.destdir,
clean=args.clean
)
print("Done")