Skip to content
Snippets Groups Projects
Commit 01c3dd208c75 authored by Simon Sapin's avatar Simon Sapin
Browse files

rust: Make the hg-cpython crate default to Python 3

This default is used when running `cargo` manually such as for `cargo test`.
`setup.py` and `Makefile` both configure the Python major version explicitly.

Differential Revision: https://phab.mercurial-scm.org/D11618
parent c95f6c2d1f4e
No related branches found
No related tags found
No related merge requests found
......@@ -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"]
......
......@@ -1398,8 +1398,6 @@
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)
......@@ -1404,6 +1402,5 @@
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',
),
]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment