From 1e63f205f40c9e5b9d2392d8fbee0ea2477b68f5 Mon Sep 17 00:00:00 2001 From: Mark Thomas Date: Tue, 28 Jan 2020 20:15:35 -0800 Subject: [PATCH] rust-cpython: allow compilation for both py2 and py3 Summary: Set up the `cpython-ext` and `hgcommands` libraries so that they can compile against py2 and py3 versions of rust-cpython. Make py2 the default so that cargo test still works. Reviewed By: singhsrb Differential Revision: D19615656 fbshipit-source-id: 3403e7077deb3c0a9dfe0e3b7d4f4ad1da73bba3 --- .../edenscmnative/bindings/modules/pyblackbox/Cargo.toml | 2 +- .../bindings/modules/pybookmarkstore/Cargo.toml | 2 +- .../edenscmnative/bindings/modules/pycliparser/Cargo.toml | 2 +- .../edenscmnative/bindings/modules/pycommands/Cargo.toml | 2 +- .../bindings/modules/pyconfigparser/Cargo.toml | 2 +- eden/scm/edenscmnative/bindings/modules/pydag/Cargo.toml | 2 +- .../scm/edenscmnative/bindings/modules/pyedenapi/Cargo.toml | 2 +- eden/scm/edenscmnative/bindings/modules/pyerror/Cargo.toml | 2 +- eden/scm/edenscmnative/bindings/modules/pyhgtime/Cargo.toml | 2 +- .../scm/edenscmnative/bindings/modules/pyindexes/Cargo.toml | 2 +- eden/scm/edenscmnative/bindings/modules/pylz4/Cargo.toml | 2 +- .../edenscmnative/bindings/modules/pymanifest/Cargo.toml | 2 +- .../scm/edenscmnative/bindings/modules/pymetalog/Cargo.toml | 2 +- .../bindings/modules/pymutationstore/Cargo.toml | 2 +- .../scm/edenscmnative/bindings/modules/pynodemap/Cargo.toml | 2 +- .../edenscmnative/bindings/modules/pypathmatcher/Cargo.toml | 2 +- .../bindings/modules/pyrevisionstore/Cargo.toml | 2 +- .../edenscmnative/bindings/modules/pyrevlogindex/Cargo.toml | 2 +- .../scm/edenscmnative/bindings/modules/pytracing/Cargo.toml | 2 +- .../edenscmnative/bindings/modules/pytreestate/Cargo.toml | 2 +- eden/scm/edenscmnative/bindings/modules/pyvlq/Cargo.toml | 2 +- .../edenscmnative/bindings/modules/pyworkingcopy/Cargo.toml | 2 +- eden/scm/edenscmnative/bindings/modules/pyzstd/Cargo.toml | 2 +- eden/scm/edenscmnative/bindings/modules/pyzstore/Cargo.toml | 2 +- eden/scm/lib/cpython-ext/Cargo.toml | 6 +++--- eden/scm/lib/hgcommands/Cargo.toml | 2 +- 26 files changed, 28 insertions(+), 28 deletions(-) diff --git a/eden/scm/edenscmnative/bindings/modules/pyblackbox/Cargo.toml b/eden/scm/edenscmnative/bindings/modules/pyblackbox/Cargo.toml index c8123b27e5..8733d0fad7 100644 --- a/eden/scm/edenscmnative/bindings/modules/pyblackbox/Cargo.toml +++ b/eden/scm/edenscmnative/bindings/modules/pyblackbox/Cargo.toml @@ -5,5 +5,5 @@ edition = "2018" [dependencies] blackbox = { path = "../../../../lib/blackbox" } -cpython-ext = { path = "../../../../lib/cpython-ext" } +cpython-ext = { path = "../../../../lib/cpython-ext", default-features = false } cpython = { version = "0.4", default-features = false } diff --git a/eden/scm/edenscmnative/bindings/modules/pybookmarkstore/Cargo.toml b/eden/scm/edenscmnative/bindings/modules/pybookmarkstore/Cargo.toml index c57ee827e9..6f1a217f56 100644 --- a/eden/scm/edenscmnative/bindings/modules/pybookmarkstore/Cargo.toml +++ b/eden/scm/edenscmnative/bindings/modules/pybookmarkstore/Cargo.toml @@ -6,5 +6,5 @@ edition = "2018" [dependencies] bookmarkstore = { path = "../../../../lib/bookmarkstore" } cpython = { version = "0.4", default-features = false } -cpython-ext = { path = "../../../../lib/cpython-ext" } +cpython-ext = { path = "../../../../lib/cpython-ext", default-features = false } types = { path = "../../../../lib/types" } diff --git a/eden/scm/edenscmnative/bindings/modules/pycliparser/Cargo.toml b/eden/scm/edenscmnative/bindings/modules/pycliparser/Cargo.toml index 8a0af6781b..e65f6e7db2 100644 --- a/eden/scm/edenscmnative/bindings/modules/pycliparser/Cargo.toml +++ b/eden/scm/edenscmnative/bindings/modules/pycliparser/Cargo.toml @@ -6,6 +6,6 @@ edition = "2018" [dependencies] clidispatch = { path = "../../../../lib/clidispatch" } cliparser = { path = "../../../../lib/cliparser", features = ["python"] } -cpython-ext = { path = "../../../../lib/cpython-ext" } +cpython-ext = { path = "../../../../lib/cpython-ext", default-features = false } cpython = { version = "0.4", default-features = false } pyconfigparser = { path = "../pyconfigparser" } diff --git a/eden/scm/edenscmnative/bindings/modules/pycommands/Cargo.toml b/eden/scm/edenscmnative/bindings/modules/pycommands/Cargo.toml index fd22500896..99088391e1 100644 --- a/eden/scm/edenscmnative/bindings/modules/pycommands/Cargo.toml +++ b/eden/scm/edenscmnative/bindings/modules/pycommands/Cargo.toml @@ -5,6 +5,6 @@ edition = "2018" [dependencies] clidispatch = { path = "../../../../lib/clidispatch" } -cpython-ext = { path = "../../../../lib/cpython-ext" } +cpython-ext = { path = "../../../../lib/cpython-ext", default-features = false } cpython = { version = "0.4", default-features = false } hgcommands = { path = "../../../../lib/hgcommands" } diff --git a/eden/scm/edenscmnative/bindings/modules/pyconfigparser/Cargo.toml b/eden/scm/edenscmnative/bindings/modules/pyconfigparser/Cargo.toml index 483e083460..0cf9462de5 100644 --- a/eden/scm/edenscmnative/bindings/modules/pyconfigparser/Cargo.toml +++ b/eden/scm/edenscmnative/bindings/modules/pyconfigparser/Cargo.toml @@ -7,5 +7,5 @@ edition = "2018" bytes = "0.4.11" configparser = { path = "../../../../lib/configparser" } cpython = { version = "0.4", default-features = false } -cpython-ext = { path = "../../../../lib/cpython-ext" } +cpython-ext = { path = "../../../../lib/cpython-ext", default-features = false } util = { path = "../../../../lib/util" } diff --git a/eden/scm/edenscmnative/bindings/modules/pydag/Cargo.toml b/eden/scm/edenscmnative/bindings/modules/pydag/Cargo.toml index 9f0f676956..f068959157 100644 --- a/eden/scm/edenscmnative/bindings/modules/pydag/Cargo.toml +++ b/eden/scm/edenscmnative/bindings/modules/pydag/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2018" [dependencies] -cpython-ext = { path = "../../../../lib/cpython-ext" } +cpython-ext = { path = "../../../../lib/cpython-ext", default-features = false } cpython = { version = "0.4", default-features = false } dag = { path = "../../../../lib/dag" } anyhow = "1.0.20" diff --git a/eden/scm/edenscmnative/bindings/modules/pyedenapi/Cargo.toml b/eden/scm/edenscmnative/bindings/modules/pyedenapi/Cargo.toml index b479fb866d..5ceab7ebfc 100644 --- a/eden/scm/edenscmnative/bindings/modules/pyedenapi/Cargo.toml +++ b/eden/scm/edenscmnative/bindings/modules/pyedenapi/Cargo.toml @@ -5,7 +5,7 @@ edition = "2018" [dependencies] bytes = "0.4" -cpython-ext = { path = "../../../../lib/cpython-ext" } +cpython-ext = { path = "../../../../lib/cpython-ext", default-features = false } cpython = { version = "0.4", default-features = false } edenapi = { path = "../../../../lib/edenapi" } pyrevisionstore = { path = "../pyrevisionstore" } diff --git a/eden/scm/edenscmnative/bindings/modules/pyerror/Cargo.toml b/eden/scm/edenscmnative/bindings/modules/pyerror/Cargo.toml index eea6a045fb..93bae16842 100644 --- a/eden/scm/edenscmnative/bindings/modules/pyerror/Cargo.toml +++ b/eden/scm/edenscmnative/bindings/modules/pyerror/Cargo.toml @@ -5,7 +5,7 @@ edition = "2018" [dependencies] cpython = { version = "0.4", default-features = false } -cpython-ext = { path = "../../../../lib/cpython-ext" } +cpython-ext = { path = "../../../../lib/cpython-ext", default-features = false } indexedlog = { path = "../../../../lib/indexedlog" } metalog = { path = "../../../../lib/metalog" } revisionstore = { path = "../../../../lib/revisionstore" } diff --git a/eden/scm/edenscmnative/bindings/modules/pyhgtime/Cargo.toml b/eden/scm/edenscmnative/bindings/modules/pyhgtime/Cargo.toml index 4aa8c98ba4..1e131ac804 100644 --- a/eden/scm/edenscmnative/bindings/modules/pyhgtime/Cargo.toml +++ b/eden/scm/edenscmnative/bindings/modules/pyhgtime/Cargo.toml @@ -5,5 +5,5 @@ edition = "2018" [dependencies] cpython = { version = "0.4", default-features = false } -cpython-ext = { path = "../../../../lib/cpython-ext" } +cpython-ext = { path = "../../../../lib/cpython-ext", default-features = false } hgtime = { path = "../../../../lib/hgtime" } diff --git a/eden/scm/edenscmnative/bindings/modules/pyindexes/Cargo.toml b/eden/scm/edenscmnative/bindings/modules/pyindexes/Cargo.toml index a35218b992..4f636a938e 100644 --- a/eden/scm/edenscmnative/bindings/modules/pyindexes/Cargo.toml +++ b/eden/scm/edenscmnative/bindings/modules/pyindexes/Cargo.toml @@ -9,7 +9,7 @@ python2 = [] python3 = [] [dependencies] -cpython-ext = { path = "../../../../lib/cpython-ext" } +cpython-ext = { path = "../../../../lib/cpython-ext", default-features = false } radixbuf = { path = "../../../../lib/radixbuf" } anyhow = "1.0.20" thiserror = "1.0.5" diff --git a/eden/scm/edenscmnative/bindings/modules/pylz4/Cargo.toml b/eden/scm/edenscmnative/bindings/modules/pylz4/Cargo.toml index 8dda190621..142d91520a 100644 --- a/eden/scm/edenscmnative/bindings/modules/pylz4/Cargo.toml +++ b/eden/scm/edenscmnative/bindings/modules/pylz4/Cargo.toml @@ -4,6 +4,6 @@ version = "0.1.0" edition = "2018" [dependencies] -cpython-ext = { path = "../../../../lib/cpython-ext" } +cpython-ext = { path = "../../../../lib/cpython-ext", default-features = false } cpython = { version = "0.4", default-features = false } lz4-pyframe = { path = "../../../../lib/lz4-pyframe" } diff --git a/eden/scm/edenscmnative/bindings/modules/pymanifest/Cargo.toml b/eden/scm/edenscmnative/bindings/modules/pymanifest/Cargo.toml index f1aee518df..037b36b116 100644 --- a/eden/scm/edenscmnative/bindings/modules/pymanifest/Cargo.toml +++ b/eden/scm/edenscmnative/bindings/modules/pymanifest/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [dependencies] anyhow = "1.0.20" bytes = { version = "0.4.11" } -cpython-ext = { path = "../../../../lib/cpython-ext" } +cpython-ext = { path = "../../../../lib/cpython-ext", default-features = false } cpython = { version = "0.4", default-features = false } manifest = { path = "../../../../lib/manifest" } manifest-tree = { path = "../../../../lib/manifest-tree" } diff --git a/eden/scm/edenscmnative/bindings/modules/pymetalog/Cargo.toml b/eden/scm/edenscmnative/bindings/modules/pymetalog/Cargo.toml index 96992f6174..0ad828c905 100644 --- a/eden/scm/edenscmnative/bindings/modules/pymetalog/Cargo.toml +++ b/eden/scm/edenscmnative/bindings/modules/pymetalog/Cargo.toml @@ -5,5 +5,5 @@ edition = "2018" [dependencies] cpython = { version = "0.4", default-features = false } -cpython-ext = { path = "../../../../lib/cpython-ext" } +cpython-ext = { path = "../../../../lib/cpython-ext", default-features = false } metalog = { path = "../../../../lib/metalog" } diff --git a/eden/scm/edenscmnative/bindings/modules/pymutationstore/Cargo.toml b/eden/scm/edenscmnative/bindings/modules/pymutationstore/Cargo.toml index 62d8bde574..0f188b1c17 100644 --- a/eden/scm/edenscmnative/bindings/modules/pymutationstore/Cargo.toml +++ b/eden/scm/edenscmnative/bindings/modules/pymutationstore/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [dependencies] anyhow = "1.0.20" byteorder = "1.2.7" -cpython-ext = { path = "../../../../lib/cpython-ext" } +cpython-ext = { path = "../../../../lib/cpython-ext", default-features = false } cpython = { version = "0.4", default-features = false } mutationstore = { path = "../../../../lib/mutationstore" } thiserror = "1.0.5" diff --git a/eden/scm/edenscmnative/bindings/modules/pynodemap/Cargo.toml b/eden/scm/edenscmnative/bindings/modules/pynodemap/Cargo.toml index e012b48815..eb98cc01c6 100644 --- a/eden/scm/edenscmnative/bindings/modules/pynodemap/Cargo.toml +++ b/eden/scm/edenscmnative/bindings/modules/pynodemap/Cargo.toml @@ -5,6 +5,6 @@ edition = "2018" [dependencies] cpython = { version = "0.4", default-features = false } -cpython-ext = { path = "../../../../lib/cpython-ext" } +cpython-ext = { path = "../../../../lib/cpython-ext", default-features = false } nodemap = { path = "../../../../lib/nodemap" } types = { path = "../../../../lib/types" } diff --git a/eden/scm/edenscmnative/bindings/modules/pypathmatcher/Cargo.toml b/eden/scm/edenscmnative/bindings/modules/pypathmatcher/Cargo.toml index 951023d07b..944ad56548 100644 --- a/eden/scm/edenscmnative/bindings/modules/pypathmatcher/Cargo.toml +++ b/eden/scm/edenscmnative/bindings/modules/pypathmatcher/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2018" [dependencies] -cpython-ext = { path = "../../../../lib/cpython-ext" } +cpython-ext = { path = "../../../../lib/cpython-ext", default-features = false } cpython = { version = "0.4", default-features = false } pathmatcher = { path = "../../../../lib/pathmatcher" } types = { path = "../../../../lib/types" } diff --git a/eden/scm/edenscmnative/bindings/modules/pyrevisionstore/Cargo.toml b/eden/scm/edenscmnative/bindings/modules/pyrevisionstore/Cargo.toml index 566ba9d66d..5852b22e93 100644 --- a/eden/scm/edenscmnative/bindings/modules/pyrevisionstore/Cargo.toml +++ b/eden/scm/edenscmnative/bindings/modules/pyrevisionstore/Cargo.toml @@ -5,7 +5,7 @@ edition = "2018" [dependencies] anyhow = "1.0.20" -cpython-ext = { path = "../../../../lib/cpython-ext" } +cpython-ext = { path = "../../../../lib/cpython-ext", default-features = false } cpython = { version = "0.4", default-features = false } parking_lot = "0.9.0" pyconfigparser = { path = "../pyconfigparser" } diff --git a/eden/scm/edenscmnative/bindings/modules/pyrevlogindex/Cargo.toml b/eden/scm/edenscmnative/bindings/modules/pyrevlogindex/Cargo.toml index c4243f239b..f3847257b2 100644 --- a/eden/scm/edenscmnative/bindings/modules/pyrevlogindex/Cargo.toml +++ b/eden/scm/edenscmnative/bindings/modules/pyrevlogindex/Cargo.toml @@ -5,6 +5,6 @@ edition = "2018" [dependencies] cpython = { version = "0.4", default-features = false } -cpython-ext = { path = "../../../../lib/cpython-ext" } +cpython-ext = { path = "../../../../lib/cpython-ext", default-features = false } dag = { path = "../../../../lib/dag" } pydag = { path = "../pydag" } diff --git a/eden/scm/edenscmnative/bindings/modules/pytracing/Cargo.toml b/eden/scm/edenscmnative/bindings/modules/pytracing/Cargo.toml index 09d13bea92..367429a84f 100644 --- a/eden/scm/edenscmnative/bindings/modules/pytracing/Cargo.toml +++ b/eden/scm/edenscmnative/bindings/modules/pytracing/Cargo.toml @@ -9,7 +9,7 @@ python2 = ["python27-sys"] python3 = ["python3-sys"] [dependencies] -cpython-ext = { path = "../../../../lib/cpython-ext" } +cpython-ext = { path = "../../../../lib/cpython-ext", default-features = false } cpython = { version = "0.4", default-features = false } lazy_static = "1" mincode = { path = "../../../../lib/mincode" } diff --git a/eden/scm/edenscmnative/bindings/modules/pytreestate/Cargo.toml b/eden/scm/edenscmnative/bindings/modules/pytreestate/Cargo.toml index a30e456e79..3cb1620b77 100644 --- a/eden/scm/edenscmnative/bindings/modules/pytreestate/Cargo.toml +++ b/eden/scm/edenscmnative/bindings/modules/pytreestate/Cargo.toml @@ -5,6 +5,6 @@ edition = "2018" [dependencies] anyhow = "1.0.20" -cpython-ext = { path = "../../../../lib/cpython-ext" } +cpython-ext = { path = "../../../../lib/cpython-ext", default-features = false } cpython = { version = "0.4", default-features = false } treestate = { path = "../../../../lib/treestate" } diff --git a/eden/scm/edenscmnative/bindings/modules/pyvlq/Cargo.toml b/eden/scm/edenscmnative/bindings/modules/pyvlq/Cargo.toml index 2c7bc5f379..b1bdca235f 100644 --- a/eden/scm/edenscmnative/bindings/modules/pyvlq/Cargo.toml +++ b/eden/scm/edenscmnative/bindings/modules/pyvlq/Cargo.toml @@ -5,5 +5,5 @@ edition = "2018" [dependencies] cpython = { version = "0.4", default-features = false } -cpython-ext = { path = "../../../../lib/cpython-ext" } +cpython-ext = { path = "../../../../lib/cpython-ext", default-features = false } vlqencoding = { path = "../../../../lib/vlqencoding" } diff --git a/eden/scm/edenscmnative/bindings/modules/pyworkingcopy/Cargo.toml b/eden/scm/edenscmnative/bindings/modules/pyworkingcopy/Cargo.toml index 02d83c7a9f..24b008158a 100644 --- a/eden/scm/edenscmnative/bindings/modules/pyworkingcopy/Cargo.toml +++ b/eden/scm/edenscmnative/bindings/modules/pyworkingcopy/Cargo.toml @@ -6,7 +6,7 @@ edition = "2018" [dependencies] anyhow = "1.0.20" cpython = { version = "0.4", default-features = false } -cpython-ext = { path = "../../../../lib/cpython-ext" } +cpython-ext = { path = "../../../../lib/cpython-ext", default-features = false } pathmatcher = { path = "../../../../lib/pathmatcher" } pypathmatcher = { path = "../pypathmatcher" } types = { path = "../../../../lib/types" } diff --git a/eden/scm/edenscmnative/bindings/modules/pyzstd/Cargo.toml b/eden/scm/edenscmnative/bindings/modules/pyzstd/Cargo.toml index 4a608747c7..56605991a0 100644 --- a/eden/scm/edenscmnative/bindings/modules/pyzstd/Cargo.toml +++ b/eden/scm/edenscmnative/bindings/modules/pyzstd/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2018" [dependencies] -cpython-ext = { path = "../../../../lib/cpython-ext" } +cpython-ext = { path = "../../../../lib/cpython-ext", default-features = false } cpython = { version = "0.4", default-features = false } zstd = "0.4.18" zstdelta = { path = "../../../../lib/zstdelta/" } diff --git a/eden/scm/edenscmnative/bindings/modules/pyzstore/Cargo.toml b/eden/scm/edenscmnative/bindings/modules/pyzstore/Cargo.toml index 2fb0e3769e..e5122d0b7d 100644 --- a/eden/scm/edenscmnative/bindings/modules/pyzstore/Cargo.toml +++ b/eden/scm/edenscmnative/bindings/modules/pyzstore/Cargo.toml @@ -5,5 +5,5 @@ edition = "2018" [dependencies] cpython = { version = "0.4", default-features = false } -cpython-ext = { path = "../../../../lib/cpython-ext" } +cpython-ext = { path = "../../../../lib/cpython-ext", default-features = false } zstore = { path = "../../../../lib/zstore" } diff --git a/eden/scm/lib/cpython-ext/Cargo.toml b/eden/scm/lib/cpython-ext/Cargo.toml index 7c16ec6781..af30684070 100644 --- a/eden/scm/lib/cpython-ext/Cargo.toml +++ b/eden/scm/lib/cpython-ext/Cargo.toml @@ -4,9 +4,9 @@ version = "0.1.0" edition = "2018" [features] -default = [] -python2 = ["python27-sys"] -python3 = ["python3-sys"] +default = ["python2"] +python2 = ["python27-sys", "cpython/python27-sys"] +python3 = ["python3-sys", "cpython/python3-sys"] [dependencies] anyhow = "1.0.20" diff --git a/eden/scm/lib/hgcommands/Cargo.toml b/eden/scm/lib/hgcommands/Cargo.toml index 11273bc89b..d0967b923b 100644 --- a/eden/scm/lib/hgcommands/Cargo.toml +++ b/eden/scm/lib/hgcommands/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2018" [features] -default = [] +default = ["python2"] python2 = ["bindings/python2", "pytracing/python2", "python27-sys", "cpython-ext/python2", "cpython/python27-sys"] python3 = ["bindings/python3", "pytracing/python3", "python3-sys", "cpython-ext/python3", "cpython/python3-sys"]