refactor: move node ofs script to electron (#44425)
* refactor: move node ofs script to electron * chore: remove empty file
This commit is contained in:
parent
f7ead785cd
commit
39b24aed92
5 changed files with 56 additions and 54 deletions
25
script/node/generate_node_version_header.py
Executable file
25
script/node/generate_node_version_header.py
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import re
|
||||
import sys
|
||||
|
||||
node_version_file = sys.argv[1]
|
||||
out_file = sys.argv[2]
|
||||
NMV = None
|
||||
if len(sys.argv) > 3:
|
||||
NMV = sys.argv[3]
|
||||
|
||||
with open(node_version_file, 'r', encoding='utf-8') as in_file:
|
||||
with open(out_file, 'w', encoding='utf-8') as out_file:
|
||||
changed = False
|
||||
contents = in_file.read()
|
||||
new_contents = re.sub(r'^#define NODE_MODULE_VERSION [0-9]+$',
|
||||
'#define NODE_MODULE_VERSION ' + NMV,
|
||||
contents, flags=re.MULTILINE)
|
||||
|
||||
changed = contents != new_contents
|
||||
|
||||
if not changed and NMV is not None:
|
||||
raise Exception('NMV must differ from current value in Node.js')
|
||||
|
||||
out_file.writelines(new_contents)
|
Loading…
Add table
Add a link
Reference in a new issue