Skip to content

Commit

Permalink
Run git command only with mach build commands
Browse files Browse the repository at this point in the history
  • Loading branch information
UK992 committed Aug 5, 2016
1 parent fc4fc77 commit 6548325
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions python/servo/build_commands.py
Expand Up @@ -209,7 +209,7 @@ def build(self, target=None, release=False, dev=False, jobs=None,
opts += ["--features", "%s" % ' '.join(features)]

build_start = time()
env = self.build_env(target=target)
env = self.build_env(target=target, is_build=True)

if android:
# Build OpenSSL for android
Expand Down Expand Up @@ -299,7 +299,7 @@ def build_cef(self, jobs=None, verbose=False, release=False):
build_start = time()
with cd(path.join("ports", "cef")):
ret = call(["cargo", "build"] + opts,
env=self.build_env(), verbose=verbose)
env=self.build_env(is_build=True), verbose=verbose)
elapsed = time() - build_start

# Generate Desktop Notification if elapsed-time > some threshold value
Expand Down Expand Up @@ -334,7 +334,7 @@ def build_geckolib(self, jobs=None, verbose=False, release=False):
if release:
opts += ["--release"]

env = self.build_env()
env = self.build_env(is_build=True)
env["CARGO_TARGET_DIR"] = path.join(self.context.topdir, "target", "geckolib").encode("UTF-8")

build_start = time()
Expand Down
4 changes: 2 additions & 2 deletions python/servo/command_base.py
Expand Up @@ -348,7 +348,7 @@ def get_binary_path(self, release, dev, android=False):
" --release" if release else ""))
sys.exit()

def build_env(self, hosts_file_path=None, target=None):
def build_env(self, hosts_file_path=None, target=None, is_build=False):
"""Return an extended environment dictionary."""
env = os.environ.copy()
if sys.platform == "win32" and type(env['PATH']) == unicode:
Expand Down Expand Up @@ -445,7 +445,7 @@ def build_env(self, hosts_file_path=None, target=None):
env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -W unused-extern-crates"

git_info = []
if os.path.isdir('.git'):
if os.path.isdir('.git') and is_build:
git_sha = subprocess.check_output([
'git', 'rev-parse', '--short', 'HEAD'
]).strip()
Expand Down

0 comments on commit 6548325

Please sign in to comment.