File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
node/flatpak_node_generator Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,14 @@ async def _async_main() -> None:
9595 action = 'store_true' ,
9696 help = 'Split the sources file to fit onto GitHub.' ,
9797 )
98+ parser .add_argument (
99+ '-S' ,
100+ '--split-size' ,
101+ type = int ,
102+ default = 0 ,
103+ dest = 'split_size' ,
104+ help = 'If splitting the sources file, split at this size in KB. Default is 49000KB.' ,
105+ )
98106 parser .add_argument (
99107 '--node-chromedriver-from-electron' ,
100108 help = 'Use the ChromeDriver version associated with the given '
@@ -245,6 +253,8 @@ async def _async_main() -> None:
245253 )
246254 gen .add_command (f'bash { gen .data_root / script_name } ' )
247255
256+ if args .split_size > 0 :
257+ gen .split_size = args .split_size * 1000
248258 if args .split :
249259 sources = list (gen .ordered_sources ())
250260 await Requests .instance .upgrade_to_sha256 (sources )
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ def __init__(self) -> None:
2727 # That way, we ensure uniqueness.
2828 self ._sources : Set [Tuple [Tuple [str , Any ], ...]] = set ()
2929 self ._commands : List [str ] = []
30+ self ._split_size = - 1
3031
3132 def __exit__ (
3233 self ,
@@ -36,6 +37,16 @@ def __exit__(
3637 ) -> None :
3738 self ._finalize ()
3839
40+ @property
41+ def split_size (self ) -> int :
42+ if self ._split_size == - 1 :
43+ return ManifestGenerator .MAX_GITHUB_SIZE
44+ else :
45+ return self ._split_size
46+ @split_size .setter
47+ def split_size (self , val ):
48+ self ._split_size = val
49+
3950 @property
4051 def data_root (self ) -> Path :
4152 return Path ('flatpak-node' )
@@ -66,7 +77,7 @@ def split_sources(self) -> Iterator[List[Dict[Any, Any]]]:
6677 # opening brackets.
6778 source_json = json .dumps ([source ], indent = ManifestGenerator .JSON_INDENT )
6879 source_json_len = len ('\n ' .join (source_json .splitlines ()[1 :- 1 ]))
69- if current_size + source_json_len >= ManifestGenerator . MAX_GITHUB_SIZE :
80+ if current_size + source_json_len >= self . split_size :
7081 yield current
7182 current = []
7283 current_size = BASE_CURRENT_SIZE
You can’t perform that action at this time.
0 commit comments