# HG changeset patch # User Yuya Nishihara <y...@tcha.org> # Date 1570952770 -32400 # Sun Oct 13 16:46:10 2019 +0900 # Node ID 6ecc771edbad738c634b50846de1943ea7d34d9e # Parent dbe969ca04b9711aa3b244b2dcea9b9925bab960 rust-cpython: alias python(27|3)_sys globally
diff --git a/rust/hg-cpython/src/cindex.rs b/rust/hg-cpython/src/cindex.rs --- a/rust/hg-cpython/src/cindex.rs +++ b/rust/hg-cpython/src/cindex.rs @@ -9,15 +9,11 @@ //! //! Ideally, we should use an Index entirely implemented in Rust, //! but this will take some time to get there. -#[cfg(feature = "python27")] -use python27_sys as python_sys; -#[cfg(feature = "python3")] -use python3_sys as python_sys; +use crate::python_sys::{self, PyCapsule_Import}; use cpython::{PyClone, PyErr, PyObject, PyResult, Python}; use hg::{Graph, GraphError, Revision, WORKING_DIRECTORY_REVISION}; use libc::c_int; -use python_sys::PyCapsule_Import; use std::ffi::CStr; use std::mem::transmute; diff --git a/rust/hg-cpython/src/dirstate.rs b/rust/hg-cpython/src/dirstate.rs --- a/rust/hg-cpython/src/dirstate.rs +++ b/rust/hg-cpython/src/dirstate.rs @@ -9,10 +9,13 @@ //! `hg-core` package. //! //! From Python, this will be seen as `mercurial.rustext.dirstate` + mod copymap; mod dirs_multiset; mod dirstate_map; + use crate::dirstate::{dirs_multiset::Dirs, dirstate_map::DirstateMap}; +use crate::python_sys::PyCapsule_Import; use cpython::{ exc, PyBytes, PyDict, PyErr, PyModule, PyObject, PyResult, PySequence, Python, @@ -22,10 +25,6 @@ use hg::{ StateMap, }; use libc::{c_char, c_int}; -#[cfg(feature = "python27")] -use python27_sys::PyCapsule_Import; -#[cfg(feature = "python3")] -use python3_sys::PyCapsule_Import; use std::convert::TryFrom; use std::ffi::CStr; use std::mem::transmute; diff --git a/rust/hg-cpython/src/lib.rs b/rust/hg-cpython/src/lib.rs --- a/rust/hg-cpython/src/lib.rs +++ b/rust/hg-cpython/src/lib.rs @@ -24,6 +24,11 @@ #[macro_use] extern crate cpython; +#[cfg(feature = "python27")] +use python27_sys as python_sys; +#[cfg(feature = "python3")] +use python3_sys as python_sys; + pub mod ancestors; mod cindex; mod conversion; _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel