File tree Expand file tree Collapse file tree 3 files changed +25
-3
lines changed
flet-runtime/src/flet_runtime Expand file tree Collapse file tree 3 files changed +25
-3
lines changed Original file line number Diff line number Diff line change 11import json
22import os
33import re
4+ import shutil
45import socket
56import sys
67from pathlib import Path
@@ -258,3 +259,25 @@ def patch_manifest_json(
258259
259260 with open (manifest_path , "w" ) as f :
260261 f .write (json .dumps (manifest , indent = 2 ))
262+
263+
264+ def copy_tree (src , dst ):
265+ """Recursively copy a directory tree using shutil.copy2().
266+
267+ Arguments:
268+ src -- source directory path
269+ dst -- destination directory path
270+
271+ Return a list of files that were copied or might have been copied.
272+ """
273+ if not os .path .isdir (src ):
274+ raise OSError ("Source is not a directory" )
275+
276+ os .makedirs (dst , exist_ok = True )
277+ for item in os .listdir (src ):
278+ s = os .path .join (src , item )
279+ d = os .path .join (dst , item )
280+ if os .path .isdir (s ):
281+ copy_tree (s , d )
282+ else :
283+ shutil .copy2 (s , d )
Original file line number Diff line number Diff line change 11import os
22import tempfile
33import uuid
4- from distutils .dir_util import copy_tree
54from pathlib import Path
65
7- from flet_runtime .utils import get_package_bin_dir
6+ from flet_runtime .utils import copy_tree , get_package_bin_dir
87
98
109def get_flet_bin_path ():
Original file line number Diff line number Diff line change 66import sys
77import tarfile
88import tempfile
9- from distutils .dir_util import copy_tree
109from pathlib import Path
1110
1211from flet .cli .commands .base import BaseCommand
1312from flet_core .types import WebRenderer
1413from flet_core .utils import random_string
1514from flet_runtime .utils import (
15+ copy_tree ,
1616 get_package_web_dir ,
1717 is_within_directory ,
1818 patch_index_html ,
You can’t perform that action at this time.
0 commit comments