Skip to content

Commit c7ed289

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 f216821 commit c7ed289

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

test/test_other.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15088,7 +15088,7 @@ def test_parsetools_make_removed_fs_assert(self):
1508815088
@requires_git_checkout
1508915089
def test_install(self):
1509015090
self.run_process([PYTHON, path_from_root('tools/install.py'), 'newdir'], env=shared.env_with_node_in_path())
15091-
self.assertExists('newdir/emcc')
15091+
self.assertExists(utils.bat_suffix('newdir/emcc'))
1509215092
# Some files, such as as maintenance tools should not be part of the
1509315093
# install.
1509415094
self.assertNotExists('newdir/tools/maint/')

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)