Skip to content

Commit 1fa8efc

Browse files
gasinveinrefi64
authored andcommitted
node: Use data source for npm cache items...
...instead of a python script.
1 parent 53c2cee commit 1fa8efc

1 file changed

Lines changed: 1 addition & 22 deletions

File tree

node/flatpak-node-generator.py

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,29 +1422,8 @@ def _finalize(self) -> None:
14221422
self.gen.add_command(f'FLATPAK_BUILDER_BUILDDIR=$PWD {patch_all_dest}')
14231423

14241424
if self.index_entries:
1425-
# (ab-)use a "script" module to generate the index.
1426-
parents: Set[str] = set()
1427-
1428-
for path in self.index_entries:
1429-
for parent in map(str, path.relative_to(self.cacache_dir).parents):
1430-
if parent != '.':
1431-
parents.add(parent)
1432-
1433-
index_commands: List[str] = []
1434-
index_commands.append('import os')
1435-
index_commands.append(f'os.chdir({str(self.cacache_dir)!r})')
1436-
1437-
for parent in sorted(parents, key=len):
1438-
index_commands.append(f'os.makedirs({parent!r}, exist_ok=True)')
1439-
14401425
for path, entry in self.index_entries.items():
1441-
path = path.relative_to(self.cacache_dir)
1442-
index_commands.append(f'with open({str(path)!r}, "w") as fp:')
1443-
index_commands.append(f' fp.write({entry!r})')
1444-
1445-
script_dest = self.gen.data_root / 'generate-index.py'
1446-
self.gen.add_script_source(index_commands, script_dest)
1447-
self.gen.add_command(f'python3 {script_dest}')
1426+
self.gen.add_data_source(entry, path)
14481427

14491428

14501429
class YarnLockfileProvider(LockfileProvider):

0 commit comments

Comments
 (0)