changeset 48842:649ff7f86f96

rust: enable Python 3 support unconditionally Note: `cpython/python3-sys` is a default feature. Differential Revision: https://phab.mercurial-scm.org/D12316
author Simon Sapin <simon.sapin@octobus.net>
date Thu, 03 Mar 2022 07:53:11 +0100
parents 2ef3b7d30cc1
children d953a42b157d
files Makefile rust/README.rst rust/hg-cpython/Cargo.toml setup.py
diffstat 4 files changed, 5 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Thu Mar 03 09:45:21 2022 +0900
+++ b/Makefile	Thu Mar 03 07:53:11 2022 +0100
@@ -151,12 +151,9 @@
         $(MAKE) -f $(HGROOT)/contrib/Makefile.python PYTHONVER=$* PREFIX=$(HGPYTHONS)/$* python )
 	cd tests && $(HGPYTHONS)/$*/bin/python run-tests.py $(TESTFLAGS)
 
-rust-tests: py_feature = $(shell $(PYTHON) -c \
- 'import sys; print(["python27-bin", "python3-bin"][sys.version_info[0] >= 3])')
 rust-tests:
 	cd $(HGROOT)/rust/hg-cpython \
-		&& $(CARGO) test --quiet --all \
-			--no-default-features --features "$(py_feature) $(HG_RUST_FEATURES)"
+		&& $(CARGO) test --quiet --all --features "$(HG_RUST_FEATURES)"
 
 check-code:
 	hg manifest | xargs python contrib/check-code.py
--- a/rust/README.rst	Thu Mar 03 09:45:21 2022 +0900
+++ b/rust/README.rst	Thu Mar 03 07:53:11 2022 +0100
@@ -40,8 +40,8 @@
 Special features
 ================
 
-You might want to check the `features` section in ``hg-cpython/Cargo.toml``.
-It may contain features that might be interesting to try out.
+In the future, compile-time opt-ins may be added
+to the `features` section in ``hg-cpython/Cargo.toml``.
 
 To use features from the Makefile, use the `HG_RUST_FEATURES` environment
 variable: for instance `HG_RUST_FEATURES="some-feature other-feature"`
--- a/rust/hg-cpython/Cargo.toml	Thu Mar 03 09:45:21 2022 +0900
+++ b/rust/hg-cpython/Cargo.toml	Thu Mar 03 07:53:11 2022 +0100
@@ -8,18 +8,8 @@
 name='rusthg'
 crate-type = ["cdylib"]
 
-[features]
-default = ["python3"]
-
-# Features to build an extension module:
-python3 = ["cpython/python3-sys", "cpython/extension-module"]
-
-# Enable this feature to build a test executable linked to libpython:
-# e.g. cargo test --no-default-features --features python3-bin
-python3-bin = ["cpython/python3-sys"]
-
 [dependencies]
-cpython = { version = "0.7.0", default-features = false }
+cpython = { version = "0.7.0", features = ["extension-module"] }
 crossbeam-channel = "0.4"
 hg-core = { path = "../hg-core"}
 libc = "0.2"
--- a/setup.py	Thu Mar 03 09:45:21 2022 +0900
+++ b/setup.py	Thu Mar 03 07:53:11 2022 +0100
@@ -1380,15 +1380,9 @@
 
         cargocmd = ['cargo', 'rustc', '--release']
 
-        feature_flags = ['python3']
-
-        cargocmd.append('--no-default-features')
-
         rust_features = env.get("HG_RUST_FEATURES")
         if rust_features:
-            feature_flags.append(rust_features)
-
-        cargocmd.extend(('--features', " ".join(feature_flags)))
+            cargocmd.extend(('--features', rust_features))
 
         cargocmd.append('--')
         if sys.platform == 'darwin':