2020-10-08 22:32:49 +01:00
|
|
|
import os
|
|
|
|
import toml
|
|
|
|
|
|
|
|
rust_src = os.environ['RUSTC_SRC']
|
2020-10-17 09:34:51 +01:00
|
|
|
orig_cargo = os.environ['ORIG_CARGO'] if 'ORIG_CARGO' in os.environ else None
|
2020-10-08 22:32:49 +01:00
|
|
|
|
|
|
|
base = {
|
|
|
|
'package': {
|
2021-11-08 02:05:25 +00:00
|
|
|
'name': 'nixpkgs-sysroot-stub-crate',
|
2020-10-08 22:32:49 +01:00
|
|
|
'version': '0.0.0',
|
|
|
|
'authors': ['The Rust Project Developers'],
|
|
|
|
'edition': '2018',
|
|
|
|
},
|
|
|
|
'dependencies': {
|
|
|
|
'compiler_builtins': {
|
|
|
|
'version': '0.1.0',
|
|
|
|
'features': ['rustc-dep-of-std', 'mem'],
|
|
|
|
},
|
|
|
|
'core': {
|
2021-11-08 02:05:25 +00:00
|
|
|
'path': os.path.join(rust_src, 'core'),
|
|
|
|
},
|
|
|
|
'alloc': {
|
|
|
|
'path': os.path.join(rust_src, 'alloc'),
|
2020-10-08 22:32:49 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
'patch': {
|
|
|
|
'crates-io': {
|
|
|
|
'rustc-std-workspace-core': {
|
2021-11-08 02:05:25 +00:00
|
|
|
'path': os.path.join(rust_src, 'rustc-std-workspace-core'),
|
|
|
|
},
|
|
|
|
'rustc-std-workspace-alloc': {
|
|
|
|
'path': os.path.join(rust_src, 'rustc-std-workspace-alloc'),
|
2020-10-08 22:32:49 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2020-10-17 09:34:51 +01:00
|
|
|
if orig_cargo is not None:
|
|
|
|
with open(orig_cargo, 'r') as f:
|
|
|
|
src = toml.loads(f.read())
|
|
|
|
if 'profile' in src:
|
|
|
|
base['profile'] = src['profile']
|
2020-10-08 22:32:49 +01:00
|
|
|
|
|
|
|
out = toml.dumps(base)
|
|
|
|
|
|
|
|
with open('Cargo.toml', 'x') as f:
|
|
|
|
f.write(out)
|