Skip to content

Commit

Permalink
build: read version from Cargo.toml in wheel-rpc-server.py
Browse files Browse the repository at this point in the history
  • Loading branch information
link2xt committed Mar 19, 2024
1 parent 0bd137b commit 311f703
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
8 changes: 4 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@
buildPhase = ''
mkdir tmp
cp ${rpc-server}/bin/deltachat-rpc-server tmp/deltachat-rpc-server
python3 scripts/wheel-rpc-server.py ${manifest.version} ${arch} tmp/deltachat-rpc-server
python3 scripts/wheel-rpc-server.py tmp/deltachat-rpc-server
'';
installPhase = ''mkdir -p $out; cp -av deltachat_rpc_server-*.whl $out'';
};
Expand Down Expand Up @@ -323,7 +323,7 @@
buildPhase = ''
mkdir tmp
cp ${deltachat-rpc-server-win64}/bin/deltachat-rpc-server.exe tmp/deltachat-rpc-server.exe
python3 scripts/wheel-rpc-server.py ${manifest.version} win64 tmp/deltachat-rpc-server.exe
python3 scripts/wheel-rpc-server.py win64 tmp/deltachat-rpc-server.exe
'';
installPhase = ''mkdir -p $out; cp -av deltachat_rpc_server-*.whl $out'';
};
Expand Down Expand Up @@ -352,7 +352,7 @@
buildPhase = ''
mkdir tmp
cp ${deltachat-rpc-server-win32}/bin/deltachat-rpc-server.exe tmp/deltachat-rpc-server.exe
python3 scripts/wheel-rpc-server.py ${manifest.version} win32 tmp/deltachat-rpc-server.exe
python3 scripts/wheel-rpc-server.py win32 tmp/deltachat-rpc-server.exe
'';
installPhase = ''mkdir -p $out; cp -av deltachat_rpc_server-*.whl $out'';
};
Expand Down Expand Up @@ -405,7 +405,7 @@
pkgs.python3
pkgs.python3Packages.wheel
];
buildPhase = ''python3 scripts/wheel-rpc-server.py ${manifest.version} source deltachat-rpc-server-${manifest.version}.tar.gz'';
buildPhase = ''python3 scripts/wheel-rpc-server.py source deltachat-rpc-server-${manifest.version}.tar.gz'';
installPhase = ''mkdir -p $out; cp -av deltachat-rpc-server-${manifest.version}.tar.gz $out'';
};

Expand Down
10 changes: 6 additions & 4 deletions scripts/wheel-rpc-server.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,15 @@ def main():


def main():
version = sys.argv[1]
if sys.argv[2] == "source":
with Path("Cargo.toml").open("rb") as fp:
cargo_manifest = tomllib.load(fp)
version = cargo_manifest["package"]["version"]
if sys.argv[1] == "source":
filename = f"deltachat-rpc-server-{version}.tar.gz"
build_source_package(version, filename)
else:
arch = sys.argv[2]
executable = sys.argv[3]
arch = sys.argv[1]
executable = sys.argv[2]
tags = arch2tags[arch]

if arch in ["win32", "win64"]:
Expand Down

0 comments on commit 311f703

Please sign in to comment.