fix SConstruct so that it can build from a git checkout rather than an svn checkout
git-svn-id: svn://localhost/ardour2/branches/3.0@3888 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
e330fed57e
commit
1d210a54f9
31
SConstruct
31
SConstruct
@ -257,9 +257,36 @@ def fetch_svn_revision (path):
|
|||||||
cmd += " | awk '/^Revision:/ { print $2}'"
|
cmd += " | awk '/^Revision:/ { print $2}'"
|
||||||
return commands.getoutput (cmd)
|
return commands.getoutput (cmd)
|
||||||
|
|
||||||
|
def fetch_git_revision (path):
|
||||||
|
cmd = "LANG= "
|
||||||
|
cmd += "git log --abbrev HEAD^..HEAD "
|
||||||
|
cmd += path
|
||||||
|
output = commands.getoutput (cmd)
|
||||||
|
output = output.splitlines()
|
||||||
|
|
||||||
|
rev = output[0].replace( "commit", "git")[0:7]
|
||||||
|
for line in output:
|
||||||
|
try:
|
||||||
|
if "git-svn-id" in line:
|
||||||
|
line = line.split('@')
|
||||||
|
line = line[1].split(' ')
|
||||||
|
rev = line[0]
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return rev
|
||||||
|
|
||||||
def create_stored_revision (target = None, source = None, env = None):
|
def create_stored_revision (target = None, source = None, env = None):
|
||||||
|
rev = ""
|
||||||
if os.path.exists('.svn'):
|
if os.path.exists('.svn'):
|
||||||
rev = fetch_svn_revision ('.');
|
rev = fetch_svn_revision ('.');
|
||||||
|
elif os.path.exists('.git'):
|
||||||
|
rev = fetch_git_revision ('.');
|
||||||
|
else:
|
||||||
|
print "You cannot use \"scons revision\" on without using a checked out"
|
||||||
|
print "copy of the Ardour source code repository"
|
||||||
|
sys.exit (-1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
text = "#include <ardour/svn_revision.h>\n"
|
text = "#include <ardour/svn_revision.h>\n"
|
||||||
text += "namespace ARDOUR {\n";
|
text += "namespace ARDOUR {\n";
|
||||||
@ -272,10 +299,6 @@ def create_stored_revision (target = None, source = None, env = None):
|
|||||||
except IOError:
|
except IOError:
|
||||||
print "Could not open libs/ardour/svn_revision.cc for writing\n"
|
print "Could not open libs/ardour/svn_revision.cc for writing\n"
|
||||||
sys.exit (-1)
|
sys.exit (-1)
|
||||||
else:
|
|
||||||
print "You cannot use \"scons revision\" on without using a checked out"
|
|
||||||
print "copy of the Ardour source code repository"
|
|
||||||
sys.exit (-1)
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# A generic builder for version.cc files
|
# A generic builder for version.cc files
|
||||||
|
Loading…
Reference in New Issue
Block a user