Skip to content

Commit

Permalink
Fix abs path problem
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Oct 31, 2018
1 parent 0bcebcb commit 2ce5113
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
17 changes: 5 additions & 12 deletions build_extra/rust/run.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
#!/usr/bin/env python
# This file just executes its arguments, except that it extracts a special
# argument --env-out-dir so as to pass it to the given command via environmental
# variable. This backflip is to have compatibility with cargo.
# This file just executes its arguments, except that also adds OUT_DIR to the
# environ. This is for compatibility with cargo.
import subprocess
import argparse
import sys
import os

parser = argparse.ArgumentParser()
parser.add_argument("--env-out-dir", dest="env_out_dir")
flags, args_rest = parser.parse_known_args()

assert os.path.isdir(flags.env_out_dir)
os.environ["OUT_DIR"] = flags.env_out_dir

sys.exit(subprocess.call(args_rest, env=os.environ))
os.environ["OUT_DIR"] = os.path.abspath(".")
assert os.path.isdir(os.environ["OUT_DIR"])
sys.exit(subprocess.call(sys.argv[1:], env=os.environ))
2 changes: 0 additions & 2 deletions build_extra/rust/rust.gni
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,6 @@ template("rust_crate") {
args += [
"rustc",
rebase_path(source_root, root_build_dir),
"--env-out-dir",
rebase_path(root_out_dir),
"--crate-name=$crate_name",
"--crate-type=$crate_type",
"--emit=$emit_type,dep-info",
Expand Down

0 comments on commit 2ce5113

Please sign in to comment.