-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New version of prebuild script, to work with imageproc-settings migra…
…tion. Update for cleaner extraction of ident str
- Loading branch information
Showing
3 changed files
with
42 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env python | ||
|
||
""" | ||
Write version and date information to a .c file, so compiles can be updated | ||
authors: ronf, fgb, apullin | ||
""" | ||
|
||
import time, os, sys, re | ||
|
||
VER_STR_LENGTH_MAX = 80 | ||
|
||
if len(sys.argv) < 2: | ||
print("Not enough arguments given. Need path to settings.h file.") | ||
sys.exit() | ||
|
||
settingsFile = sys.argv[1] # path to settings.h | ||
|
||
infile = open(settingsFile, 'r') #read only | ||
#infile = open('settings.h') | ||
|
||
for line in infile: | ||
if '#define IDENT_STR' in line: | ||
identStrLine = line | ||
infile.close() | ||
break | ||
|
||
identStr = re.findall(r'"(.*?)"', line)[0] | ||
timestamp = time.strftime("%a %b %d %H:%M:%S %Y") | ||
verStr = identStr + " " + timestamp | ||
verStrClip = verStr[0:VER_STR_LENGTH_MAX] | ||
|
||
# Write string to header file | ||
filename = 'source/version-string.h' | ||
fileout = open(filename,'w') | ||
fileout.write( | ||
'/* automatically generated by version.py - do not edit! Do not enter into SCM! */\n\n' + \ | ||
'#define VERSION_STRING "'+ verStrClip + '"\n\n' ) | ||
fileout.close() | ||
|
||
print('updated ' + os.getcwd() + os.sep + filename) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.