File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed
node/flatpak_node_generator Expand file tree Collapse file tree 2 files changed +12
-3
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 = 49 * 1000 , # GITHUB has 49MB limit.
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 '
@@ -206,6 +214,7 @@ async def _async_main() -> None:
206214 print (f'{ len (packages )} packages read.' )
207215
208216 gen = ManifestGenerator ()
217+ gen .split_size = args .split_size * 1000
209218 with gen :
210219 options = SpecialSourceProvider .Options (
211220 node_chromedriver_from_electron = args .node_chromedriver_from_electron
@@ -267,7 +276,7 @@ async def _async_main() -> None:
267276 indent = ManifestGenerator .JSON_INDENT ,
268277 )
269278
270- if fp .tell () >= ManifestGenerator . MAX_GITHUB_SIZE :
279+ if fp .tell () >= gen . split_size :
271280 print (
272281 'WARNING: generated-sources.json is too large for GitHub.' ,
273282 file = sys .stderr ,
Original file line number Diff line number Diff line change 1919
2020
2121class ManifestGenerator (ContextManager ['ManifestGenerator' ]):
22- MAX_GITHUB_SIZE = 49 * 1000 * 1000
2322 JSON_INDENT = 4
2423
2524 def __init__ (self ) -> None :
2625 # Store the dicts as a set of tuples, then rebuild the dict when returning it.
2726 # That way, we ensure uniqueness.
2827 self ._sources : Set [Tuple [Tuple [str , Any ], ...]] = set ()
2928 self ._commands : List [str ] = []
29+ self .split_size = 49 * 1000 * 1000
3030
3131 def __exit__ (
3232 self ,
@@ -66,7 +66,7 @@ def split_sources(self) -> Iterator[List[Dict[Any, Any]]]:
6666 # opening brackets.
6767 source_json = json .dumps ([source ], indent = ManifestGenerator .JSON_INDENT )
6868 source_json_len = len ('\n ' .join (source_json .splitlines ()[1 :- 1 ]))
69- if current_size + source_json_len >= ManifestGenerator . MAX_GITHUB_SIZE :
69+ if current_size + source_json_len >= self . split_size :
7070 yield current
7171 current = []
7272 current_size = BASE_CURRENT_SIZE
You can’t perform that action at this time.
0 commit comments