Skip to content

Commit

Permalink
Revision script fixes (#453)
Browse files Browse the repository at this point in the history
- suppresses the error messages that are currently printed on the output at every run.
- adds a command to the hxx output that looks like this:
  #define REVISION_GIT_HASH "b60e1f7:-d-u"
  This is suitable for being included into the SNIP version string.
  • Loading branch information
balazsracz authored Oct 23, 2020
1 parent 9e47246 commit 5e8df0c
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions bin/revision.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@
outputcxx += ' "' + gcc + '",\n'
outputhxx += '"' + gcc + '\\n"\n'

main_git_hash = None

for x in inputs :
print x
# go into the root of the repo
Expand Down Expand Up @@ -121,17 +123,19 @@
outputcxx += ':' + os.path.split(os.path.abspath(x))[1]
outputhxx += '"' + git_hash + ':' + os.path.split(os.path.abspath(x))[1]

hashopts = ""

if dirty or untracked :
outputcxx += ':'
outputhxx += ':'
hashopts += ':'
if dirty :
outputcxx += '-d'
outputhxx += '-d'
hashopts += '-d'
if untracked :
outputcxx += '-u'
outputhxx += '-u'
outputcxx += '",\n'
outputhxx += '\\n"\n'
hashopts += '-u'
outputcxx += hashopts + '",\n'
outputhxx += hashopts + '\\n"\n'

if main_git_hash is None:
main_git_hash = git_hash + hashopts

outputcxx += ' nullptr\n'
outputcxx += '};\n'
Expand All @@ -142,6 +146,9 @@
outputhxx += '));\n'
outputhxx += 'CDI_GROUP_END();\n'

if main_git_hash is not None:
outputhxx += '\n#define REVISION_GIT_HASH "' + main_git_hash + '"\n'

os.chdir(orig_dir)

# generate the *.cxxout style content
Expand All @@ -165,14 +172,18 @@
"-I", """Thu, """, "-I", """Fri, """,
"-I", """Sat, """,
options.output + 'Try.hxxout',
options.output + '.hxxout'], stdout=f_null)
options.output + '.hxxout'],
stdout=f_null, stderr=f_null)
diffcxx = subprocess.call(['diff',
"-I", """Sun, """, "-I", """Mon, """,
"-I", """Tue, """, "-I", """Wed, """,
"-I", """Thu, """, "-I", """Fri, """,
"-I", """Sat, """,
options.output + 'Try.cxxout',
options.output + '.cxxout'], stdout=f_null)
options.output + '.cxxout'],
stdout=f_null, stderr=f_null)
# disable this because we are not actually writing a cxx file above.
diffcxx = 0

if diffhxx != 0 :
os.system('rm -f ' + options.output + '.hxxout')
Expand Down

0 comments on commit 5e8df0c

Please sign in to comment.