forked from electron/electron
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: move node headers generation to electron (electron#39589)
- Loading branch information
Showing
9 changed files
with
123 additions
and
146 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
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 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 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 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 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 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 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,26 @@ | ||
#!/usr/bin/env 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') as in_file, open(out_file, 'w') 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("Did not modify the NMV from nodes value, this value MUST " | ||
"differ from node") | ||
|
||
out_file.writelines(new_contents) |
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,12 @@ | ||
import os | ||
import sys | ||
import tarfile | ||
|
||
source = sys.argv[1] | ||
target = sys.argv[2] | ||
|
||
os.chdir(os.path.dirname(source)) | ||
|
||
tarball = tarfile.open(name=os.path.basename(target), mode='w:gz') | ||
tarball.add(os.path.relpath(source)) | ||
tarball.close() |