pycargoebuild 0.16.0__tar.gz → 0.17.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/PKG-INFO +1 -1
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/data/share/bash-completion/completions/pycargoebuild +2 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/integration_test/test_integration.py +1 -1
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/pycargoebuild/__init__.py +1 -1
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/pycargoebuild/__main__.py +113 -58
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/COPYING +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/README.rst +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/integration_test/__init__.py +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/integration_test/alass-2.0.0.ebuild +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/integration_test/attest-0.1.0.ebuild +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/integration_test/bindgen-0.63.0.ebuild +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/integration_test/blake3-0.3.3.ebuild +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/integration_test/cryptography-38.0.3.ebuild +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/integration_test/fish-shell-4.8.0.ebuild +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/integration_test/fractal-5.0.0.ebuild +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/integration_test/lemmy_server-0.18.0.ebuild +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/integration_test/license-mapping.conf +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/integration_test/mdbook-linkcheck-0.7.7.ebuild +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/integration_test/milkshake-terminal-0.0.0.ebuild +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/integration_test/news_flash_gtk-0.0.0.ebuild +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/integration_test/qiskit-terra-0.22.3.ebuild +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/integration_test/ruffle_core-0.1.0.ebuild +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/integration_test/rustic-rs-0.5.0.ebuild +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/integration_test/rustls-0.20.7.ebuild +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/integration_test/rustworkx-0.12.1.ebuild +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/integration_test/setuptools-rust-1.5.2.ebuild +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/integration_test/synapse-0.1.0.ebuild +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/integration_test/watchfiles-0.18.1.ebuild +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/pycargoebuild/cargo.py +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/pycargoebuild/ebuild.py +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/pycargoebuild/fetch.py +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/pycargoebuild/format.py +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/pycargoebuild/license.py +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/pyproject.toml +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/test/__init__.py +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/test/conftest.py +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/test/test_cargo.py +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/test/test_ebuild.py +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/test/test_fetch.py +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/test/test_format.py +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/test/test_license.py +0 -0
- {pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/tox.ini +0 -0
{pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/data/share/bash-completion/completions/pycargoebuild
RENAMED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# pycargoebuild
|
|
2
2
|
# (c) 2024 Arthur Zamarin <arthurzam@gentoo.org>
|
|
3
|
+
# (c) 2026 Michał Górny <mgorny@gentoo.org>
|
|
3
4
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
4
5
|
|
|
5
6
|
_pycargoebuild() {
|
|
@@ -11,6 +12,7 @@ _pycargoebuild() {
|
|
|
11
12
|
--crate-tarball-prefix --no-write-crate-tarball -d --distdir
|
|
12
13
|
-f --force -F --fetcher -i --input --inplace --no-config
|
|
13
14
|
-l --license-mapping -L --no-license -M --no-manifest -o --output
|
|
15
|
+
-w --write-crate-tarball -u --use-crate-tarball -C --fill-crates
|
|
14
16
|
)
|
|
15
17
|
|
|
16
18
|
case ${prev} in
|
|
@@ -225,7 +225,7 @@ def test_integration(tmp_path, capfd, caplog, ebuild):
|
|
|
225
225
|
args = ["-d", str(dist_dir),
|
|
226
226
|
"-l", str(test_dir / "license-mapping.conf"),
|
|
227
227
|
"-o", str(tmp_path / "{name}-{version}.ebuild"),
|
|
228
|
-
"--no-config"]
|
|
228
|
+
"--no-config", "--fill-crates"]
|
|
229
229
|
if not pkg_info.crate_license:
|
|
230
230
|
args.append("-L")
|
|
231
231
|
if pkg_info.use_features:
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# pycargoebuild
|
|
2
|
-
# (c) 2022-
|
|
2
|
+
# (c) 2022-2026 Michał Górny <mgorny@gentoo.org>
|
|
3
3
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
4
4
|
|
|
5
5
|
import argparse
|
|
6
6
|
import datetime
|
|
7
|
+
import enum
|
|
7
8
|
import io
|
|
8
9
|
import json
|
|
9
10
|
import logging
|
|
@@ -50,63 +51,99 @@ class WorkspaceData(typing.NamedTuple):
|
|
|
50
51
|
workspace_metadata: dict
|
|
51
52
|
|
|
52
53
|
|
|
54
|
+
class Mode(enum.Enum):
|
|
55
|
+
WRITE_CRATE_TARBALL = enum.auto()
|
|
56
|
+
USE_CRATE_TARBALL = enum.auto()
|
|
57
|
+
FILL_CRATES = enum.auto()
|
|
58
|
+
|
|
59
|
+
|
|
53
60
|
def main(prog_name: str, *argv: str) -> int:
|
|
54
61
|
argp = argparse.ArgumentParser(prog=os.path.basename(prog_name))
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
argp.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
62
|
+
|
|
63
|
+
# mode
|
|
64
|
+
mode_g_outer = argp.add_argument_group("mode")
|
|
65
|
+
mode_g = mode_g_outer.add_mutually_exclusive_group()
|
|
66
|
+
mode_g.add_argument("-w", "--write-crate-tarball",
|
|
67
|
+
dest="mode",
|
|
68
|
+
action="store_const",
|
|
69
|
+
const=Mode.WRITE_CRATE_TARBALL,
|
|
70
|
+
help="Pack fetched crates into a tarball and do not "
|
|
71
|
+
"fill CRATES variable")
|
|
72
|
+
mode_g.add_argument("-u", "--use-crate-tarball",
|
|
73
|
+
dest="mode",
|
|
74
|
+
action="store_const",
|
|
75
|
+
const=Mode.USE_CRATE_TARBALL,
|
|
76
|
+
help="Assume crate tarball exists and do not fill "
|
|
77
|
+
"CRATES variable")
|
|
78
|
+
mode_g.add_argument("-C", "--fill-crates",
|
|
79
|
+
dest="mode",
|
|
80
|
+
action="store_const",
|
|
81
|
+
const=Mode.FILL_CRATES,
|
|
82
|
+
help="Fill the CRATES variable directly")
|
|
83
|
+
|
|
84
|
+
# option flags
|
|
85
|
+
opt_g = argp.add_argument_group("common flags")
|
|
86
|
+
opt_g.add_argument("-e", "--features",
|
|
87
|
+
action="store_true",
|
|
88
|
+
help="Add USE flags for Cargo features")
|
|
89
|
+
opt_g.add_argument("-f", "--force",
|
|
90
|
+
action="store_true",
|
|
91
|
+
help="Force overwriting the output file")
|
|
92
|
+
opt_g.add_argument("-i", "--input", "--inplace",
|
|
93
|
+
type=argparse.FileType("r", encoding="utf-8"),
|
|
94
|
+
metavar="INPUT",
|
|
95
|
+
help="Update the CRATES and LICENSE variables "
|
|
96
|
+
"in the specified ebuild instead of creating "
|
|
97
|
+
"one from scratch")
|
|
98
|
+
opt_g.add_argument("-L", "--no-license",
|
|
99
|
+
action="store_true",
|
|
100
|
+
help="Do not include LICENSEs (e.g. when crates are "
|
|
101
|
+
"only used at build time)")
|
|
102
|
+
opt_g.add_argument("-M", "--no-manifest",
|
|
103
|
+
action="store_true",
|
|
104
|
+
help="Do not call `pkgdev manifest` (called only if "
|
|
105
|
+
"Manifest exists)")
|
|
106
|
+
opt_g.add_argument("-o", "--output",
|
|
107
|
+
help="Ebuild file to write (default: INPUT if --input "
|
|
108
|
+
"is specified, {name}-{version}.ebuild otherwise)")
|
|
109
|
+
|
|
110
|
+
cfg_g = argp.add_argument_group("configuration flags")
|
|
111
|
+
cfg_g.add_argument("-d", "--distdir",
|
|
112
|
+
type=Path,
|
|
113
|
+
help="Directory to store downloaded crates in "
|
|
114
|
+
"(default: get from Portage)")
|
|
115
|
+
cfg_g.add_argument("-F", "--fetcher",
|
|
116
|
+
choices=("auto",) + FETCHERS,
|
|
117
|
+
default="auto",
|
|
118
|
+
help="Fetcher to use")
|
|
119
|
+
cfg_g.add_argument("-l", "--license-mapping",
|
|
120
|
+
type=argparse.FileType("r", encoding="utf-8"),
|
|
121
|
+
help="Path to license-mapping.conf file (default: "
|
|
122
|
+
"get from Portage)")
|
|
123
|
+
cfg_g.add_argument("--no-config",
|
|
108
124
|
action="store_true",
|
|
109
125
|
help="Inhibit loading configuration files")
|
|
126
|
+
|
|
127
|
+
ct_opt_g = argp.add_argument_group("crate tarball options")
|
|
128
|
+
ct_opt_g.add_argument("-c", "--crate-tarball",
|
|
129
|
+
action="store_true",
|
|
130
|
+
help="Pack fetched crates into a tarball rather "
|
|
131
|
+
"than adding them to the CRATES variable "
|
|
132
|
+
"(deprecated, use --write-crate-tarball or "
|
|
133
|
+
"--use-crate-tarball)")
|
|
134
|
+
ct_opt_g.add_argument("--crate-tarball-path",
|
|
135
|
+
default="{distdir}/{name}-{version}-crates.tar.xz",
|
|
136
|
+
help="Path to write crate tarball to (default: "
|
|
137
|
+
"{distdir}/{name}-{version}-crates.tar.xz)")
|
|
138
|
+
ct_opt_g.add_argument("--crate-tarball-prefix",
|
|
139
|
+
default="cargo_home/gentoo",
|
|
140
|
+
help="Prefix prepended for all paths in the crate "
|
|
141
|
+
"tarball (default: cargo_home/gentoo)")
|
|
142
|
+
ct_opt_g.add_argument("--no-write-crate-tarball",
|
|
143
|
+
action="store_true",
|
|
144
|
+
help="Do not create the crate tarball, just write "
|
|
145
|
+
"the ebuild assuming it exists (deprecated, "
|
|
146
|
+
"use --use-crate-tarball instead)")
|
|
110
147
|
argp.add_argument("directory",
|
|
111
148
|
type=Path,
|
|
112
149
|
default=[Path(".")],
|
|
@@ -114,6 +151,21 @@ def main(prog_name: str, *argv: str) -> int:
|
|
|
114
151
|
help="Directory containing Cargo.* files (default: .)")
|
|
115
152
|
args = argp.parse_args(argv)
|
|
116
153
|
|
|
154
|
+
if args.mode is None:
|
|
155
|
+
if not args.crate_tarball:
|
|
156
|
+
args.mode = Mode.FILL_CRATES
|
|
157
|
+
repl = "-C or --fill-crates"
|
|
158
|
+
elif args.no_write_crate_tarball:
|
|
159
|
+
args.mode = Mode.USE_CRATE_TARBALL
|
|
160
|
+
repl = "-u or --use-crate-tarball"
|
|
161
|
+
else:
|
|
162
|
+
args.mode = Mode.WRITE_CRATE_TARBALL
|
|
163
|
+
repl = "-w or --write-crate-tarball"
|
|
164
|
+
logging.warning(
|
|
165
|
+
"The mode argument will be required in the future. Please pass "
|
|
166
|
+
f"{repl} for the mode implied by current flags."
|
|
167
|
+
)
|
|
168
|
+
|
|
117
169
|
config_toml = {}
|
|
118
170
|
if not args.no_config:
|
|
119
171
|
config_dirs = os.environ.get("XDG_CONFIG_DIRS", "/etc/xdg").split(":")
|
|
@@ -325,14 +377,15 @@ def main(prog_name: str, *argv: str) -> int:
|
|
|
325
377
|
umask = os.umask(0)
|
|
326
378
|
os.umask(umask)
|
|
327
379
|
|
|
328
|
-
if args.
|
|
380
|
+
if args.mode != Mode.FILL_CRATES:
|
|
329
381
|
crate_tarball = Path(
|
|
330
382
|
args.crate_tarball_path.format(name=pkg_meta.name,
|
|
331
383
|
version=pkg_meta.version,
|
|
332
384
|
distdir=args.distdir))
|
|
333
|
-
if args.
|
|
385
|
+
if args.mode == Mode.USE_CRATE_TARBALL:
|
|
334
386
|
logging.info("Skipping creating crate tarball")
|
|
335
387
|
else:
|
|
388
|
+
assert args.mode == Mode.WRITE_CRATE_TARBALL
|
|
336
389
|
if not args.force and crate_tarball.exists():
|
|
337
390
|
logging.error(f"{crate_tarball} exists already, pass -f to "
|
|
338
391
|
"overwrite it")
|
|
@@ -370,7 +423,8 @@ def main(prog_name: str, *argv: str) -> int:
|
|
|
370
423
|
crates,
|
|
371
424
|
distdir=args.distdir,
|
|
372
425
|
crate_license=not args.no_license,
|
|
373
|
-
crate_tarball=crate_tarball if args.
|
|
426
|
+
crate_tarball=(crate_tarball if args.mode != Mode.FILL_CRATES
|
|
427
|
+
else None),
|
|
374
428
|
license_overrides=config_toml.get("license-overrides", {}),
|
|
375
429
|
)
|
|
376
430
|
logging.warning(
|
|
@@ -382,7 +436,8 @@ def main(prog_name: str, *argv: str) -> int:
|
|
|
382
436
|
crates,
|
|
383
437
|
distdir=args.distdir,
|
|
384
438
|
crate_license=not args.no_license,
|
|
385
|
-
crate_tarball=crate_tarball if args.
|
|
439
|
+
crate_tarball=(crate_tarball if args.mode != Mode.FILL_CRATES
|
|
440
|
+
else None),
|
|
386
441
|
license_overrides=config_toml.get("license-overrides", {}),
|
|
387
442
|
use_features=args.features,
|
|
388
443
|
)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/integration_test/mdbook-linkcheck-0.7.7.ebuild
RENAMED
|
File without changes
|
{pycargoebuild-0.16.0 → pycargoebuild-0.17.0}/integration_test/milkshake-terminal-0.0.0.ebuild
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|