-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #136 from Chia-Network/pip-install
Pip install
- Loading branch information
Showing
8 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .clvm_tools_rs import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import sys | ||
|
||
from clvm_tools_rs.clvm_tools_rs import cmds | ||
|
||
|
||
# this dynamic bit of programming may look super-complicated, | ||
# but it's just me being lazy and automating with a macro to | ||
# produce code of the form: | ||
# brun = lambda: cmds.brun_main(sys.argv) | ||
# run = lambda: cmds.run_main(sys.argv) | ||
# etc. | ||
|
||
|
||
for cmd in "brun run opc opd cldb shrink clisp_to_json repl".split(): | ||
code = f"{cmd} = lambda: cmds.{cmd}_main(sys.argv)" | ||
exec(code) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use pyo3::prelude::*; | ||
|
||
use crate::classic::clvm_tools::cmds; | ||
|
||
#[pyfunction] | ||
pub fn brun_main(args: Vec<String>) { | ||
cmds::brun(&args); | ||
} | ||
|
||
#[pyfunction] | ||
pub fn run_main(args: Vec<String>) { | ||
cmds::run(&args); | ||
} | ||
|
||
#[pyfunction] | ||
pub fn opc_main(args: Vec<String>) { | ||
cmds::opc(&args); | ||
} | ||
|
||
#[pyfunction] | ||
pub fn opd_main(args: Vec<String>) { | ||
cmds::opd(&args); | ||
} | ||
|
||
#[pyfunction] | ||
pub fn cldb_main(args: Vec<String>) { | ||
cmds::cldb(&args); | ||
} | ||
|
||
/// A Python module implemented in Rust. | ||
pub fn create_cmds_module(py: Python) -> PyResult<&'_ PyModule> { | ||
let m = PyModule::new(py, "cmds")?; | ||
m.add_function(wrap_pyfunction!(brun_main, m)?)?; | ||
m.add_function(wrap_pyfunction!(run_main, m)?)?; | ||
m.add_function(wrap_pyfunction!(opc_main, m)?)?; | ||
m.add_function(wrap_pyfunction!(opd_main, m)?)?; | ||
m.add_function(wrap_pyfunction!(cldb_main, m)?)?; | ||
Ok(m) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pub mod api; | ||
mod cmds; | ||
pub mod pyval; |