Skip to content

Commit a2f9ba1

Browse files
committed
Remove ouroboros
1 parent ff0eef7 commit a2f9ba1

File tree

9 files changed

+298
-250
lines changed

9 files changed

+298
-250
lines changed

Cargo.lock

Lines changed: 0 additions & 68 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ edition = "2021"
88
[dependencies]
99
anyhow = "1.0.75"
1010
maplit = "1.0.2"
11-
ouroboros = "0.18.0"
1211
pathfinding = "4.3.3"
1312
rayon = "1.8.0"
1413
rustpython-parser = "0.3.0"

src/import_graph/builder.rs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
use anyhow::Result;
22
use std::path::{Path, PathBuf};
3+
use std::sync::Arc;
34

45
use super::graph;
6+
use super::import_discovery;
7+
use super::indexing;
8+
use super::package_discovery;
59

610
pub struct ImportGraphBuilder {
711
pub(super) root_package_path: PathBuf, // ignored_imports
@@ -16,7 +20,20 @@ impl ImportGraphBuilder {
1620
}
1721
}
1822

19-
pub fn build(self) -> Result<graph::ImportGraph> {
20-
graph::ImportGraph::build(self)
23+
pub fn build(&self) -> Result<graph::ImportGraph> {
24+
let root_package = package_discovery::discover_package(self.root_package_path.as_path())?;
25+
let packages_by_pypath = indexing::get_packages_by_pypath(Arc::clone(&root_package))?;
26+
let modules_by_pypath = indexing::get_modules_by_pypath(Arc::clone(&root_package))?;
27+
let packages_by_module = indexing::get_packages_by_module(Arc::clone(&root_package))?;
28+
let imports =
29+
import_discovery::discover_imports(Arc::clone(&root_package), &modules_by_pypath)?;
30+
let reverse_imports = indexing::reverse_imports(&imports)?;
31+
Ok(graph::ImportGraph {
32+
packages_by_pypath,
33+
modules_by_pypath,
34+
packages_by_module,
35+
imports,
36+
reverse_imports,
37+
})
2138
}
2239
}

0 commit comments

Comments
 (0)