1# Copyright (c) 2013 The Chromium Authors. All rights reserved. 2# Use of this source code is governed by a BSD-style license that can be 3# found in the LICENSE file. 4 5import os 6import os.path 7import sys 8 9output = sys.argv[1] 10parentdir = os.path.abspath(os.path.join(output, os.pardir)) 11 12#The original body of this file is generated by this bash script: 13# 14#touch "${DIR}/git_sha1.h.tmp" 15#if test -d .git; then \ 16# if which git > /dev/null; then \ 17# git log -n 1 --oneline | \ 18# sed 's/^\([^ ]*\) .*/#define MESA_GIT_SHA1 "git-\1"/' \ 19# > "${DIR}/git_sha1.h.tmp" ; \ 20# fi \ 21# fi 22#if ! cmp -s "${DIR}/git_sha1.h.tmp" "${DIR}/git_sha1.h"; then \ 23# mv "${DIR}/git_sha1.h.tmp" "${DIR}/git_sha1.h" ;\ 24# else \ 25# rm "${DIR}/git_sha1.h.tmp" ;\ 26# fi 27# 28#However, Chromium shouldn't depend on Bash, and this preprocessor macro isn't 29#neccessary in the first place 30 31if not os.path.isdir(parentdir): 32 os.makedirs(parentdir) 33 34with open(output, "w") as f: 35 pass 36