forked from RedBeardLab/rediSQL
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.py
More file actions
41 lines (35 loc) · 1.1 KB
/
Copy pathrelease.py
File metadata and controls
41 lines (35 loc) · 1.1 KB
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
import toml
import os
import shutil
# we start by getting the version we are releaseing
cargo = toml.load("Cargo.toml")
version = cargo['package']['version']
scratch_space = "build_scratch/"
target_dir = "releases/{}".format(version)
# we create the necessary directory releases/$vresion/
try:
os.makedirs(target_dir)
except:
pass
try:
os.makedirs(scratch_space)
except:
pass
arm = "armv7-unknown-linux-gnueabihf"
intel = "x86_64-unknown-linux-gnu"
pro = "--features=pro"
for target in [arm, intel]:
for feature in ["", pro]:
cmd = "CARGO_TARGET_DIR={} cargo build --release --target {} {}".format(scratch_space, target, feature)
print("Executing:", cmd)
os.system(cmd)
result_file = "{}/{}/release/libredis_sql.so".format(scratch_space, target)
suffix = "_v{}".format(version)
if feature == pro:
suffix += "_PRO"
if target == arm:
suffix += "_ARMv7"
if target == intel:
suffix += "_x86_64"
shutil.copyfile(result_file, "{}/redisql{}.so".format(target_dir, suffix))
shutil.rmtree(scratch_space)