##// END OF EJS Templates
rust-python3: useless python2 specific import...
Georges Racinet -
r42549:5b795108 default
parent child Browse files
Show More
@@ -1,54 +1,53 b''
1 1 // lib.rs
2 2 //
3 3 // Copyright 2018 Georges Racinet <gracinet@anybox.fr>
4 4 //
5 5 // This software may be used and distributed according to the terms of the
6 6 // GNU General Public License version 2 or any later version.
7 7
8 8 //! Python bindings of `hg-core` objects using the `cpython` crate.
9 9 //! Once compiled, the resulting single shared library object can be placed in
10 10 //! the `mercurial` package directly as `rustext.so` or `rustext.dll`.
11 11 //! It holds several modules, so that from the point of view of Python,
12 12 //! it behaves as the `cext` package.
13 13 //!
14 14 //! Example:
15 15 //!
16 16 //! ```text
17 17 //! >>> from mercurial.rustext import ancestor
18 18 //! >>> ancestor.__doc__
19 19 //! 'Generic DAG ancestor algorithms - Rust implementation'
20 20 //! ```
21 21
22 22 #[macro_use]
23 23 extern crate cpython;
24 24 extern crate hg;
25 25 extern crate libc;
26 extern crate python27_sys;
27 26
28 27 pub mod ancestors;
29 28 mod cindex;
30 29 mod conversion;
31 30 pub mod dagops;
32 31 pub mod discovery;
33 32 pub mod exceptions;
34 33 pub mod dirstate;
35 34 pub mod filepatterns;
36 35
37 36 py_module_initializer!(rustext, initrustext, PyInit_rustext, |py, m| {
38 37 m.add(
39 38 py,
40 39 "__doc__",
41 40 "Mercurial core concepts - Rust implementation",
42 41 )?;
43 42
44 43 let dotted_name: String = m.get(py, "__name__")?.extract(py)?;
45 44 m.add(py, "ancestor", ancestors::init_module(py, &dotted_name)?)?;
46 45 m.add(py, "dagop", dagops::init_module(py, &dotted_name)?)?;
47 46 m.add(py, "discovery", discovery::init_module(py, &dotted_name)?)?;
48 47 m.add(py, "dirstate", dirstate::init_module(py, &dotted_name)?)?;
49 48 m.add(py, "filepatterns", filepatterns::init_module(py, &dotted_name)?)?;
50 49 m.add(py, "GraphError", py.get_type::<exceptions::GraphError>())?;
51 50 m.add(py, "PatternFileError", py.get_type::<exceptions::PatternFileError>())?;
52 51 m.add(py, "PatternError", py.get_type::<exceptions::PatternError>())?;
53 52 Ok(())
54 53 });
General Comments 0
You need to be logged in to leave comments. Login now