Skip to content

Commit

Permalink
Remove Win32 / UWP / XB1 code from Starboard 17 (#4002)
Browse files Browse the repository at this point in the history
b/360158667
  • Loading branch information
kaidokert committed Aug 17, 2024
1 parent aa19f56 commit c2ae994
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 690 deletions.
2 changes: 0 additions & 2 deletions starboard/build/platforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
'evergreen-arm-hardfp': 'starboard/evergreen/arm/hardfp',
'evergreen-arm-softfp': 'starboard/evergreen/arm/softfp',
'evergreen-arm64': 'starboard/evergreen/arm64',
'win-win32': 'starboard/win/win32',
'xb1': 'starboard/xb1',
}
PLATFORMS.update(INTERNAL_PLATFORMS)

Expand Down
47 changes: 11 additions & 36 deletions starboard/tools/port_symlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,19 @@
import sys

from starboard.tools import util
from starboard.tools import win_symlink

# This file is still executed with Python2 in CI.
# pylint:disable=consider-using-f-string


def IsWindows():
return sys.platform in ['win32', 'cygwin']


def ToLongPath(path):
"""Converts to a path that supports long filenames."""
if IsWindows():
return win_symlink.ToDevicePath(path)
else:
return path
return path


def IsSymLink(path):
"""Platform neutral version os os.path.islink()."""
if IsWindows():
return win_symlink.IsReparsePoint(path)
else:
return os.path.islink(path)
return os.path.islink(path)


def MakeSymLink(target_path, link_path):
Expand All @@ -57,37 +46,26 @@ def MakeSymLink(target_path, link_path):
Returns:
None
"""
if IsWindows():
win_symlink.CreateReparsePoint(target_path, link_path)
else:
util.MakeDirs(os.path.dirname(link_path))
os.symlink(target_path, link_path)
util.MakeDirs(os.path.dirname(link_path))
os.symlink(target_path, link_path)


def ReadSymLink(link_path):
"""Returns the path (abs. or rel.) to the folder referred to by link_path."""
if IsWindows():
path = win_symlink.ReadReparsePoint(link_path)
else:
try:
path = os.readlink(link_path)
except OSError:
path = None
try:
path = os.readlink(link_path)
except OSError:
path = None
return path


def DelSymLink(link_path):
if IsWindows():
win_symlink.UnlinkReparsePoint(link_path)
else:
os.unlink(link_path)
os.unlink(link_path)


def Rmtree(path):
"""See Rmtree() for documentation of this function."""
if IsWindows():
func = win_symlink.RmtreeShallow
elif not os.path.islink(path):
if not os.path.islink(path):
func = shutil.rmtree
else:
os.unlink(path)
Expand All @@ -97,10 +75,7 @@ def Rmtree(path):


def OsWalk(root_dir, topdown=True, onerror=None, followlinks=False):
if IsWindows():
return win_symlink.OsWalk(root_dir, topdown, onerror, followlinks)
else:
return os.walk(root_dir, topdown, onerror, followlinks)
return os.walk(root_dir, topdown, onerror, followlinks)


def _CreateArgumentParser():
Expand Down
3 changes: 1 addition & 2 deletions starboard/tools/port_symlink_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ def testRmtreeRemovesBrokenLink(self):
# os.path.exists() will return false for broken links (not true for reparse
# points on Windows) since their target does not exist. Rmtree
# implementations should still be able to remove the link.
if not port_symlink.IsWindows():
self.assertFalse(os.path.exists(self.link_dir))
self.assertFalse(os.path.exists(self.link_dir))
self.assertTrue(IsSymLink(self.link_dir))
Rmtree(self.link_dir)
self.assertFalse(IsSymLink(self.link_dir))
Expand Down
288 changes: 0 additions & 288 deletions starboard/tools/win_symlink.py

This file was deleted.

Loading

0 comments on commit c2ae994

Please sign in to comment.