Skip to content

Commit 13a12de

Browse files
committed
Avoid install launcher scripts for foreign platform
i.e. don't install .bat files unless we are running on windows. See #25953 (comment)
1 parent 20da9c6 commit 13a12de

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

tools/install.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
import subprocess
1818
import sys
1919

20+
WINDOWS = sys.platform.startswith('win')
21+
2022
EXCLUDES = [os.path.normpath(x) for x in '''
2123
test/third_party
2224
tools/maint
@@ -25,12 +27,22 @@
2527
node_modules
2628
Makefile
2729
.git
30+
.circleci
31+
.github
32+
.mypy_cache
33+
.ruff_cache
2834
cache
2935
cache.lock
3036
out
3137
bootstrap.py
3238
'''.split()]
3339

40+
LAUNCHER_BAT_SCRIPTS = '''
41+
emcc.bat
42+
em++.bat
43+
bootstrap.bat
44+
'''.split()
45+
3446
EXCLUDE_PATTERNS = '''
3547
*.pyc
3648
.*
@@ -50,6 +62,15 @@ def add_revision_file(target):
5062
def copy_emscripten(target):
5163
script_dir = os.path.dirname(os.path.abspath(__file__))
5264
emscripten_root = os.path.dirname(script_dir)
65+
66+
excludes = EXCLUDES
67+
# We have a few launcher scripts that are checked into git still.
68+
# Exclude the ones not designed for the current platforms.
69+
if WINDOWS:
70+
excludes += [os.path.splitext(l)[0] for l in LAUNCHER_BAT_SCRIPTS]
71+
else:
72+
excludes += LAUNCHER_BAT_SCRIPTS
73+
5374
os.chdir(emscripten_root)
5475
for root, dirs, files in os.walk('.'):
5576
# Handle the case where the target directory is underneath emscripten_root
@@ -78,7 +99,7 @@ def copy_emscripten(target):
7899
logger.debug('skipping file: ' + os.path.join(root, f))
79100
continue
80101
full = os.path.normpath(os.path.join(root, f))
81-
if full in EXCLUDES:
102+
if full in excludes:
82103
logger.debug('skipping file: ' + os.path.join(root, f))
83104
continue
84105
logger.debug('installing file: ' + os.path.join(root, f))

0 commit comments

Comments
 (0)