Skip to content

Commit f5ef9d3

Browse files
committed
format code
1 parent 23c4d87 commit f5ef9d3

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

tests/tools/zipapp/zipper_test.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88

99
from tools.private.zipapp import zipper
1010

11+
1112
def symlink_target_path(p):
1213
return p.replace("/", os.sep)
1314

15+
1416
class ZipperTest(unittest.TestCase):
1517
def setUp(self):
1618
self.test_dir = pathlib.Path(tempfile.mkdtemp())
@@ -321,7 +323,9 @@ def test_symlink_extraction(self):
321323

322324
link_path = extract_dir / "runfiles/my_ws/path/to/link"
323325
self.assertTrue(link_path.is_symlink(), f"{link_path} should be a symlink")
324-
self.assertEqual(os.readlink(link_path), "../../target/path".replace("/", os.path.sep))
326+
self.assertEqual(
327+
os.readlink(link_path), "../../target/path".replace("/", os.path.sep)
328+
)
325329
self.assertEqual(link_path.read_text(), "target content")
326330

327331
link2_path = extract_dir / "runfiles/my_ws/same_dir_link"

tools/private/zipapp/zipper.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import argparse
22
import os
3-
from os.path import dirname
43
import shutil
54
import stat
65
import sys
76
import zipfile
7+
from os.path import dirname
88

99
# Unix permission bit for symlink (S_IFLNK)
1010
# S_IFLNK is usually 0o120000
@@ -113,10 +113,12 @@ def convert_symlink_target(path, platform_pathsep):
113113
# Convert Unix to Windows
114114
return path.replace("/", "\\")
115115

116+
116117
# Zip files use forward slash for the entries, even on Windows
117118
def normalize_zip_path(path):
118119
return path.replace("\\", "/")
119120

121+
120122
def _write_entry(zf, entry, compress_type, seen, platform_pathsep):
121123
type_, is_symlink_str, zip_path, content_path = entry
122124
# Normalize slashes, otherwise the `seen` logic doesn't
@@ -262,8 +264,7 @@ def main():
262264
"--runfiles-dir", default="runfiles", help="Name of the runfiles directory"
263265
)
264266
parser.add_argument(
265-
"--target-platform-pathsep",
266-
help = "The path separator for the target platform"
267+
"--target-platform-pathsep", help="The path separator for the target platform"
267268
)
268269
args = parser.parse_args()
269270

0 commit comments

Comments
 (0)