Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/system/lib/push_musl_changes.py
4150 views
1
#!/usr/bin/env python3
2
# Copyright 2021 The Emscripten Authors. All rights reserved.
3
# Emscripten is available under two separate licenses, the MIT license and the
4
# University of Illinois/NCSA Open Source License. Both these licenses can be
5
# found in the LICENSE file.
6
7
# Copy local emscripten changes into the upstream musl tree.
8
# This is the logical inverse of update_musl.py which copies changes
9
# form the upstream musl tree into emscripten.
10
11
import glob
12
import os
13
import sys
14
import shutil
15
16
script_dir = os.path.abspath(os.path.dirname(__file__))
17
local_dir = os.path.join(script_dir, 'libc', 'musl')
18
emscripten_root = os.path.dirname(os.path.dirname(script_dir))
19
default_musl_dir = os.path.join(os.path.dirname(emscripten_root), 'musl')
20
21
22
def main():
23
if len(sys.argv) > 1:
24
upstream_root = os.path.join(os.path.abspath(sys.argv[1]))
25
else:
26
upstream_root = default_musl_dir
27
if not os.path.exists(upstream_root):
28
print(f'musl tree not found: {upstream_root}')
29
return 1
30
31
print(f'copying {local_dir} -> {upstream_root}')
32
shutil.copytree(local_dir, upstream_root, dirs_exist_ok=True)
33
34
35
if __name__ == '__main__':
36
main()
37
38