Move the codegen into its own crate
This makes the code generatioin reusable from third party crates.
This commit is contained in:
parent
5a8f5034d6
commit
29fdc05b60
18
pyo3-derive-backend/Cargo.toml
Normal file
18
pyo3-derive-backend/Cargo.toml
Normal file
|
@ -0,0 +1,18 @@
|
|||
[package]
|
||||
name = "pyo3-derive-backend"
|
||||
version = "0.2.1"
|
||||
description = "Code generation for PyO3 package"
|
||||
authors = ["PyO3 Project and Contributors <https://github.com/PyO3"]
|
||||
homepage = "https://github.com/pyo3/pyo3"
|
||||
repository = "https://github.com/pyo3/pyo3.git"
|
||||
documentation = "http://pyo3.github.io/PyO3/pyo3/"
|
||||
categories = ["api-bindings", "development-tools::ffi"]
|
||||
license = "Apache-2.0"
|
||||
|
||||
[dependencies]
|
||||
quote="0.3"
|
||||
log="0.4"
|
||||
|
||||
[dependencies.syn]
|
||||
version="0.11"
|
||||
features=["full"]
|
21
pyo3-derive-backend/src/lib.rs
Normal file
21
pyo3-derive-backend/src/lib.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
// Copyright (c) 2017-present PyO3 Project and Contributors
|
||||
|
||||
#![recursion_limit = "1024"]
|
||||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
#[macro_use]
|
||||
extern crate quote;
|
||||
extern crate syn;
|
||||
extern crate proc_macro;
|
||||
|
||||
pub mod py_class;
|
||||
pub mod py_impl;
|
||||
pub mod py_proto;
|
||||
pub mod py_method;
|
||||
pub mod args;
|
||||
pub mod defs;
|
||||
pub mod func;
|
||||
pub mod method;
|
||||
pub mod module;
|
||||
pub mod utils;
|
|
@ -14,8 +14,10 @@ proc-macro = true
|
|||
|
||||
[dependencies]
|
||||
quote="0.3"
|
||||
log="0.4"
|
||||
|
||||
[dependencies.syn]
|
||||
version="0.11"
|
||||
features=["full"]
|
||||
|
||||
[dependencies.pyo3-derive-backend]
|
||||
path = "../pyo3-derive-backend"
|
||||
|
|
|
@ -5,24 +5,14 @@
|
|||
|
||||
extern crate proc_macro;
|
||||
extern crate syn;
|
||||
#[macro_use] extern crate quote;
|
||||
#[macro_use] extern crate log;
|
||||
extern crate quote;
|
||||
extern crate pyo3_derive_backend;
|
||||
|
||||
use std::str::FromStr;
|
||||
use proc_macro::TokenStream;
|
||||
|
||||
use quote::{Tokens, ToTokens};
|
||||
|
||||
mod py_class;
|
||||
mod py_impl;
|
||||
mod py_proto;
|
||||
mod py_method;
|
||||
mod args;
|
||||
mod defs;
|
||||
mod func;
|
||||
mod method;
|
||||
mod module;
|
||||
mod utils;
|
||||
use pyo3_derive_backend::*;
|
||||
|
||||
|
||||
#[proc_macro_attribute]
|
||||
|
|
Loading…
Reference in a new issue