##// END OF EJS Templates
rust: Make the hg-cpython crate default to Python 3...
Simon Sapin -
r48996:01c3dd20 default
parent child Browse files
Show More
@@ -9,7 +9,7 b" name='rusthg'"
9 crate-type = ["cdylib"]
9 crate-type = ["cdylib"]
10
10
11 [features]
11 [features]
12 default = ["python27"]
12 default = ["python3"]
13
13
14 # Features to build an extension module:
14 # Features to build an extension module:
15 python27 = ["cpython/python27-sys", "cpython/extension-module-2-7"]
15 python27 = ["cpython/python27-sys", "cpython/extension-module-2-7"]
@@ -1398,12 +1398,9 b' class RustExtension(Extension):'
1398
1398
1399 rusttargetdir = os.path.join('rust', 'target', 'release')
1399 rusttargetdir = os.path.join('rust', 'target', 'release')
1400
1400
1401 def __init__(
1401 def __init__(self, mpath, sources, rustlibname, subcrate, **kw):
1402 self, mpath, sources, rustlibname, subcrate, py3_features=None, **kw
1403 ):
1404 Extension.__init__(self, mpath, sources, **kw)
1402 Extension.__init__(self, mpath, sources, **kw)
1405 srcdir = self.rustsrcdir = os.path.join('rust', subcrate)
1403 srcdir = self.rustsrcdir = os.path.join('rust', subcrate)
1406 self.py3_features = py3_features
1407
1404
1408 # adding Rust source and control files to depends so that the extension
1405 # adding Rust source and control files to depends so that the extension
1409 # gets rebuilt if they've changed
1406 # gets rebuilt if they've changed
@@ -1451,9 +1448,11 b' class RustExtension(Extension):'
1451
1448
1452 feature_flags = []
1449 feature_flags = []
1453
1450
1454 if sys.version_info[0] == 3 and self.py3_features is not None:
1451 cargocmd.append('--no-default-features')
1455 feature_flags.append(self.py3_features)
1452 if sys.version_info[0] == 2:
1456 cargocmd.append('--no-default-features')
1453 feature_flags.append('python27')
1454 elif sys.version_info[0] == 3:
1455 feature_flags.append('python3')
1457
1456
1458 rust_features = env.get("HG_RUST_FEATURES")
1457 rust_features = env.get("HG_RUST_FEATURES")
1459 if rust_features:
1458 if rust_features:
@@ -1575,7 +1574,9 b' extmodules = ['
1575 extra_compile_args=common_cflags,
1574 extra_compile_args=common_cflags,
1576 ),
1575 ),
1577 RustStandaloneExtension(
1576 RustStandaloneExtension(
1578 'mercurial.rustext', 'hg-cpython', 'librusthg', py3_features='python3'
1577 'mercurial.rustext',
1578 'hg-cpython',
1579 'librusthg',
1579 ),
1580 ),
1580 ]
1581 ]
1581
1582
General Comments 0
You need to be logged in to leave comments. Login now