Skip to content

Commit

Permalink
revert to networkx for builder
Browse files Browse the repository at this point in the history
  • Loading branch information
Riolku committed Nov 17, 2023
1 parent 3325d0a commit 4f74359
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/linux-nodejs-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Install networkx
run: /opt/python/cp310-cp310/bin/python -m pip install networkx --user

- name: Build Node.js native module
run: |
make nodejs NUM_THREADS=$(nproc)
Expand All @@ -29,6 +32,9 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Install networkx
run: /opt/python/cp310-cp310/bin/python -m pip install networkx --user

- name: Build Node.js native module
run: |
make nodejs NUM_THREADS=$(nproc)
Expand Down
13 changes: 7 additions & 6 deletions scripts/collect-single-file-header.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python
import graphlib
import logging
import networkx as nx
import os
import sys
import shutil
import logging
import sys

from typing import Optional
from pathlib import Path
Expand Down Expand Up @@ -62,19 +62,20 @@ def build_graph(graph, source_file):
logging.debug(
"Resolved %s in %s to %s" % (header_path, source_file, header_real_path)
)
graph.add(source_file, header_real_path)
graph.add_edge(source_file, header_real_path)
build_graph(graph, header_real_path)


def create_merged_header():
graph = graphlib.TopologicalSorter()
graph = nx.DiGraph()
logging.info("Building dependency graph...")
build_graph(graph, START_POINT)
topo_order = list(nx.topological_sort(graph))
logging.info("Topological sorting...")
logging.info("Writing merged header...")
with open(OUTPUT_PATH, "w") as f:
f.write("#pragma once\n")
for header_path in graph.static_order():
for header_path in reversed(topo_order):
with header_path.open() as f2:
for line in f2.readlines():
if not (
Expand Down

0 comments on commit 4f74359

Please sign in to comment.