Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revision script fixes #453

Merged
merged 1 commit into from
Oct 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this result in dead code that should be removed from the script?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you might be better in advising on this question as the author of this script. The script seems to be written for generating an hxx and a cxx file, but it only generates one with the concatenation of the code for both. Why is this the case? The comments in the code did not give a hint. So this can be cleaned up in two ways and I would hope you can decide which way to go:

  1. Make it actually generate a cxx file.
  2. Clean up the code to that was there to generate the cxx file.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll merge this now as is and we can discuss which way to move forward.


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