diff --git a/rust/hg-cpython/Cargo.toml b/rust/hg-cpython/Cargo.toml --- a/rust/hg-cpython/Cargo.toml +++ b/rust/hg-cpython/Cargo.toml @@ -9,7 +9,7 @@ crate-type = ["cdylib"] [features] -default = ["python27"] +default = ["python3"] # Features to build an extension module: python27 = ["cpython/python27-sys", "cpython/extension-module-2-7"] diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -1398,12 +1398,9 @@ rusttargetdir = os.path.join('rust', 'target', 'release') - def __init__( - self, mpath, sources, rustlibname, subcrate, py3_features=None, **kw - ): + def __init__(self, mpath, sources, rustlibname, subcrate, **kw): Extension.__init__(self, mpath, sources, **kw) srcdir = self.rustsrcdir = os.path.join('rust', subcrate) - self.py3_features = py3_features # adding Rust source and control files to depends so that the extension # gets rebuilt if they've changed @@ -1451,9 +1448,11 @@ feature_flags = [] - if sys.version_info[0] == 3 and self.py3_features is not None: - feature_flags.append(self.py3_features) - cargocmd.append('--no-default-features') + cargocmd.append('--no-default-features') + if sys.version_info[0] == 2: + feature_flags.append('python27') + elif sys.version_info[0] == 3: + feature_flags.append('python3') rust_features = env.get("HG_RUST_FEATURES") if rust_features: @@ -1575,7 +1574,9 @@ extra_compile_args=common_cflags, ), RustStandaloneExtension( - 'mercurial.rustext', 'hg-cpython', 'librusthg', py3_features='python3' + 'mercurial.rustext', + 'hg-cpython', + 'librusthg', ), ]