@@ -891,7 +891,7 @@ def create_html_manifest(
891
891
manifest = Manifest (app_mode = AppModes .STATIC , entrypoint = entrypoint , primary_html = entrypoint , image = image )
892
892
manifest .deploy_dir = deploy_dir
893
893
894
- file_list = create_abspath_list (path , extra_files , excludes )
894
+ file_list = create_file_list (path , extra_files , excludes , use_abspath = True )
895
895
for abs_path in file_list :
896
896
manifest .add_file (abs_path )
897
897
@@ -944,6 +944,7 @@ def create_file_list(
944
944
path : str ,
945
945
extra_files : typing .List [str ] = None ,
946
946
excludes : typing .List [str ] = None ,
947
+ use_abspath : bool = False ,
947
948
) -> typing .List [str ]:
948
949
"""
949
950
Builds a full list of files under the given path that should be included
@@ -962,7 +963,8 @@ def create_file_list(
962
963
file_set = set (extra_files ) # type: typing.Set[str]
963
964
964
965
if isfile (path ):
965
- file_set .add (path )
966
+ path_to_add = abspath (path ) if use_abspath else path
967
+ file_set .add (path_to_add )
966
968
return sorted (file_set )
967
969
968
970
for cur_dir , sub_dirs , files in os .walk (path ):
@@ -971,57 +973,16 @@ def create_file_list(
971
973
if any (parent in exclude_paths for parent in Path (cur_dir ).parents ):
972
974
continue
973
975
for file in files :
974
- abs_path = os .path .join (cur_dir , file )
975
- rel_path = relpath (abs_path , path )
976
+ cur_path = os .path .join (cur_dir , file )
977
+ rel_path = relpath (cur_path , path )
976
978
977
- if Path (abs_path ) in exclude_paths :
979
+ if Path (cur_path ) in exclude_paths :
978
980
continue
979
981
if keep_manifest_specified_file (rel_path , exclude_paths | directories_to_ignore ) and (
980
- rel_path in extra_files or not glob_set .matches (abs_path )
982
+ rel_path in extra_files or not glob_set .matches (cur_path )
981
983
):
982
- file_set .add (rel_path )
983
- return sorted (file_set )
984
-
985
-
986
- def create_abspath_list (
987
- path : str ,
988
- extra_files : typing .List [str ] = None ,
989
- excludes : typing .List [str ] = None ,
990
- ) -> typing .List [str ]:
991
- """
992
- Builds a absolute path list of files under the given path that should be included
993
- in a manifest or bundle.
994
-
995
- :param path: a file, or a directory to walk for files.
996
- :param extra_files: a sequence of any extra files to include in the bundle.
997
- :param excludes: a sequence of glob patterns that will exclude matched files.
998
- :return: the list of relevant files, relative to the given directory.
999
- """
1000
- extra_files = extra_files or []
1001
- excludes = excludes if excludes else []
1002
- glob_set = create_glob_set (path , excludes )
1003
- exclude_paths = {Path (p ) for p in excludes }
1004
- file_set = set (extra_files ) # type: typing.Set[str]
1005
-
1006
- if isfile (path ):
1007
- file_set .add (abspath (path ))
1008
- return sorted (file_set )
1009
-
1010
- for cur_dir , sub_dirs , files in os .walk (path ):
1011
- if Path (cur_dir ) in exclude_paths :
1012
- continue
1013
- if any (parent in exclude_paths for parent in Path (cur_dir ).parents ):
1014
- continue
1015
- for file in files :
1016
- abs_path = os .path .join (cur_dir , file )
1017
- rel_path = relpath (abs_path , path )
1018
-
1019
- if Path (abs_path ) in exclude_paths :
1020
- continue
1021
- if keep_manifest_specified_file (rel_path , exclude_paths | directories_to_ignore ) and (
1022
- rel_path in extra_files or not glob_set .matches (abs_path )
1023
- ):
1024
- file_set .add (abspath (abs_path ))
984
+ path_to_add = abspath (cur_path ) if use_abspath else rel_path
985
+ file_set .add (path_to_add )
1025
986
return sorted (file_set )
1026
987
1027
988
@@ -1733,7 +1694,7 @@ def create_voila_manifest(
1733
1694
1734
1695
manifest .add_to_buffer (join (deploy_dir , environment .filename ), environment .contents )
1735
1696
1736
- file_list = create_abspath_list (path , extra_files , excludes )
1697
+ file_list = create_file_list (path , extra_files , excludes , use_abspath = True )
1737
1698
for abs_path in file_list :
1738
1699
manifest .add_file (abs_path )
1739
1700
return manifest
0 commit comments