D12316: rust: enable Python 3 support unconditionally
SimonSapin
phabricator at mercurial-scm.org
Thu Mar 3 07:13:57 UTC 2022
SimonSapin created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
Note: `cpython/python3-sys` is a default feature.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D12316
AFFECTED FILES
Makefile
rust/README.rst
rust/hg-cpython/Cargo.toml
setup.py
CHANGE DETAILS
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -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':
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
@@ -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"
diff --git a/rust/README.rst b/rust/README.rst
--- a/rust/README.rst
+++ b/rust/README.rst
@@ -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"`
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -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
To: SimonSapin, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
More information about the Mercurial-devel
mailing list