File: push_llvm_changes.py

package info (click to toggle)
emscripten 3.1.69%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 121,860 kB
  • sloc: ansic: 636,110; cpp: 425,974; javascript: 78,401; python: 58,404; sh: 49,154; pascal: 5,237; makefile: 3,366; asm: 2,415; lisp: 1,869
file content (48 lines) | stat: -rwxr-xr-x 1,436 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
# Copyright 2021 The Emscripten Authors.  All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License.  Both these licenses can be
# found in the LICENSE file.

# Copy local llvm library changes into the upstream llvm tree.
# This is the logical inverse of update_compiler_rt.py, update_libcxx.py
# and update_libcxxabi.py which copy changes form the upstream llvm 
# into emscripten.

import glob
import os
import sys
import shutil

script_dir = os.path.abspath(os.path.dirname(__file__))
emscripten_root = os.path.dirname(os.path.dirname(script_dir))
default_llvm_dir = os.path.join(os.path.dirname(emscripten_root), 'llvm-project')
copy_dirs = [
  'compiler-rt',
  'libcxx',
  'libcxxabi',
  'libunwind',
]


def main():
  if len(sys.argv) > 1:
    upstream_root = os.path.join(os.path.abspath(sys.argv[1]))
  else:
    upstream_root = default_llvm_dir
  if not os.path.exists(upstream_root):
    print(f'llvm tree not found: {upstream_root}')
    return 1

  for dir in copy_dirs:
    assert os.path.exists(os.path.join(upstream_root, dir))

  for dir in copy_dirs:
    local_dir = os.path.join(script_dir, dir)
    upstream_dir = os.path.join(upstream_root, dir)
    print(f'copying {local_dir} -> {upstream_dir}')
    shutil.copytree(local_dir, upstream_dir, dirs_exist_ok=True)


if __name__ == '__main__':
  main()