|
@@
-3,6
+3,7
b''
|
|
3
|
#
|
|
3
|
#
|
|
4
|
# 'python setup.py install', or
|
|
4
|
# 'python setup.py install', or
|
|
5
|
# 'python setup.py --help' for more options
|
|
5
|
# 'python setup.py --help' for more options
|
|
|
|
|
6
|
from __future__ import print_function
|
|
6
|
|
|
7
|
|
|
7
|
import os
|
|
8
|
import os
|
|
8
|
|
|
9
|
|
|
@@
-141,7
+142,9
b" hgrustext = os.environ.get('HGWITHRUSTEX"
|
|
141
|
# TODO record it for proper rebuild upon changes
|
|
142
|
# TODO record it for proper rebuild upon changes
|
|
142
|
# (see mercurial/__modulepolicy__.py)
|
|
143
|
# (see mercurial/__modulepolicy__.py)
|
|
143
|
if hgrustext != 'cpython' and hgrustext is not None:
|
|
144
|
if hgrustext != 'cpython' and hgrustext is not None:
|
|
144
|
hgrustext = 'direct-ffi'
|
|
145
|
if hgrustext:
|
|
|
|
|
146
|
print('unkown HGWITHRUSTEXT value: %s' % hgrustext, file=sys.stderr)
|
|
|
|
|
147
|
hgrustext = None
|
|
145
|
|
|
148
|
|
|
146
|
import ctypes
|
|
149
|
import ctypes
|
|
147
|
import errno
|
|
150
|
import errno
|
|
@@
-543,7
+546,7
b' class hgbuildext(build_ext):'
|
|
543
|
# Build Rust standalon extensions if it'll be used
|
|
546
|
# Build Rust standalon extensions if it'll be used
|
|
544
|
# and its build is not explictely disabled (for external build
|
|
547
|
# and its build is not explictely disabled (for external build
|
|
545
|
# as Linux distributions would do)
|
|
548
|
# as Linux distributions would do)
|
|
546
|
if self.distribution.rust and self.rust and hgrustext != 'direct-ffi':
|
|
549
|
if self.distribution.rust and self.rust:
|
|
547
|
for rustext in ruststandalones:
|
|
550
|
for rustext in ruststandalones:
|
|
548
|
rustext.build('' if self.inplace else self.build_lib)
|
|
551
|
rustext.build('' if self.inplace else self.build_lib)
|
|
549
|
|
|
552
|
|
|
@@
-1391,29
+1394,6
b' class RustExtension(Extension):'
|
|
1391
|
)
|
|
1394
|
)
|
|
1392
|
|
|
1395
|
|
|
1393
|
|
|
1396
|
|
|
1394
|
class RustEnhancedExtension(RustExtension):
|
|
|
|
|
1395
|
"""A C Extension, conditionally enhanced with Rust code.
|
|
|
|
|
1396
|
|
|
|
|
|
1397
|
If the HGWITHRUSTEXT environment variable is set to something else
|
|
|
|
|
1398
|
than 'cpython', the Rust sources get compiled and linked within
|
|
|
|
|
1399
|
the C target shared library object.
|
|
|
|
|
1400
|
"""
|
|
|
|
|
1401
|
|
|
|
|
|
1402
|
def __init__(self, mpath, sources, rustlibname, subcrate, **kw):
|
|
|
|
|
1403
|
RustExtension.__init__(
|
|
|
|
|
1404
|
self, mpath, sources, rustlibname, subcrate, **kw
|
|
|
|
|
1405
|
)
|
|
|
|
|
1406
|
if hgrustext != 'direct-ffi':
|
|
|
|
|
1407
|
return
|
|
|
|
|
1408
|
self.extra_compile_args.append('-DWITH_RUST')
|
|
|
|
|
1409
|
self.libraries.append(rustlibname)
|
|
|
|
|
1410
|
self.library_dirs.append(self.rusttargetdir)
|
|
|
|
|
1411
|
|
|
|
|
|
1412
|
def rustbuild(self):
|
|
|
|
|
1413
|
if hgrustext == 'direct-ffi':
|
|
|
|
|
1414
|
RustExtension.rustbuild(self)
|
|
|
|
|
1415
|
|
|
|
|
|
1416
|
|
|
|
|
|
1417
|
class RustStandaloneExtension(RustExtension):
|
|
1397
|
class RustStandaloneExtension(RustExtension):
|
|
1418
|
def __init__(self, pydottedname, rustcrate, dylibname, **kw):
|
|
1398
|
def __init__(self, pydottedname, rustcrate, dylibname, **kw):
|
|
1419
|
RustExtension.__init__(
|
|
1399
|
RustExtension.__init__(
|
|
@@
-1453,7
+1433,7
b' extmodules = ['
|
|
1453
|
include_dirs=common_include_dirs,
|
|
1433
|
include_dirs=common_include_dirs,
|
|
1454
|
depends=common_depends,
|
|
1434
|
depends=common_depends,
|
|
1455
|
),
|
|
1435
|
),
|
|
1456
|
RustEnhancedExtension(
|
|
1436
|
Extension(
|
|
1457
|
'mercurial.cext.parsers',
|
|
1437
|
'mercurial.cext.parsers',
|
|
1458
|
[
|
|
1438
|
[
|
|
1459
|
'mercurial/cext/charencode.c',
|
|
1439
|
'mercurial/cext/charencode.c',
|
|
@@
-1463,16
+1443,9
b' extmodules = ['
|
|
1463
|
'mercurial/cext/pathencode.c',
|
|
1443
|
'mercurial/cext/pathencode.c',
|
|
1464
|
'mercurial/cext/revlog.c',
|
|
1444
|
'mercurial/cext/revlog.c',
|
|
1465
|
],
|
|
1445
|
],
|
|
1466
|
'hgdirectffi',
|
|
|
|
|
1467
|
'hg-direct-ffi',
|
|
|
|
|
1468
|
include_dirs=common_include_dirs,
|
|
1446
|
include_dirs=common_include_dirs,
|
|
1469
|
depends=common_depends
|
|
1447
|
depends=common_depends
|
|
1470
|
+ [
|
|
1448
|
+ ['mercurial/cext/charencode.h', 'mercurial/cext/revlog.h',],
|
|
1471
|
'mercurial/cext/charencode.h',
|
|
|
|
|
1472
|
'mercurial/cext/revlog.h',
|
|
|
|
|
1473
|
'rust/hg-core/src/ancestors.rs',
|
|
|
|
|
1474
|
'rust/hg-core/src/lib.rs',
|
|
|
|
|
1475
|
],
|
|
|
|
|
1476
|
),
|
|
1449
|
),
|
|
1477
|
Extension(
|
|
1450
|
Extension(
|
|
1478
|
'mercurial.cext.osutil',
|
|
1451
|
'mercurial.cext.osutil',
|