Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.
Python adbadblockandroid-tvandroid-tv-launcherapple-tvbloatware-removalclaude-codedebloatfire-tvgoogle-tvlauncherprivacysmart-tvsony-braviatclvibe-codingxiaomi
tools: wallpaper_prep.py refuses a target that is, or sits inside, the source folder once symlinks are resolved (#1485)
anurag2701fa592a9cfda7
diff --git a/tests/test_wallpaper_prep.py b/tests/test_wallpaper_prep.pyindex d48bf42b3..37bfd7558 100644--- a/tests/test_wallpaper_prep.py+++ b/tests/test_wallpaper_prep.py@@ -83,6 +83,29 @@ class PrepareTest(unittest.TestCase):with self.assertRaises(SystemExit):prep.main([d, d])+ def test_target_reached_through_a_symlink_is_refused(self):+ with tempfile.TemporaryDirectory() as d:+ src = Path(d, "photos")+ src.mkdir()+ make_photo(src / "01.jpg", size=(320, 240))+ before = (src / "01.jpg").read_bytes()+ link = Path(d, "output-link")+ try:+ os.symlink(src, link, target_is_directory=True)+ except (OSError, NotImplementedError):+ self.skipTest("symlinks are not available here")+ with self.assertRaises(SystemExit):+ prep.main([str(src), str(link)])+ with self.assertRaises(SystemExit):+ prep.main([str(link), str(src)])+ self.assertEqual((src / "01.jpg").read_bytes(), before)++ def test_target_inside_the_source_is_refused(self):+ with tempfile.TemporaryDirectory() as d:+ make_photo(Path(d, "a.png"))+ with self.assertRaises(SystemExit):+ prep.main([d, str(Path(d, "out"))])+def test_main_numbers_the_outputs_and_skips_a_corrupt_file(self):with tempfile.TemporaryDirectory() as d:src, out = Path(d, "src"), Path(d, "out")diff --git a/tools/wallpaper_prep.py b/tools/wallpaper_prep.pyindex aa6453149..efd4512d9 100644--- a/tools/wallpaper_prep.py+++ b/tools/wallpaper_prep.py@@ -86,8 +86,10 @@ def main(argv=None):parser.error("--quality must be between 30 and 95")if not os.path.isdir(args.source):parser.error(f"{args.source} is not a folder")- if os.path.abspath(args.source) == os.path.abspath(args.target):- parser.error("the target must be a different folder: the originals are never overwritten")+ source_real = os.path.realpath(args.source)+ target_real = os.path.realpath(args.target)+ if target_real == source_real or target_real.startswith(source_real.rstrip(os.sep) + os.sep):+ parser.error("the target must be a different folder, and not inside the source: the originals are never overwritten")try:import PIL # noqa: F401