This is an archive of the discontinued Mercurial Phabricator instance.

rust-cpython: build and support for Python3
ClosedPublic

Authored by gracinet on Dec 17 2018, 9:33 AM.

Details

Summary

Defined Cargo features for Python3, making them overall simpler to
use, hooked them in build and made mercurial.rustext importable.

This is tested with Python 3.6.7.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

gracinet created this revision.Dec 17 2018, 9:33 AM
yuja added a subscriber: yuja.Dec 18 2018, 7:04 AM

Queued, thanks.

We'll probably need to add suffix to the filename to disambiguate py2/3
modules. It's $PYTHON-config --extension-suffix on my Linux machine, but
I don't know if it can be obtained directly in setup.py.

This revision was automatically updated to reflect the committed changes.

@yuja great, thanks. Didn't know about this suffix, apparently it can be obtained through the sysconfig module (thats what $PYTHON-config does)

~ $ python2 -c "import sysconfig; print(sysconfig.get_config_var('SO'))"       
.so
~ $ python3 -c "import sysconfig; print(sysconfig.get_config_var('SO'))"
-c:1: DeprecationWarning: SO is deprecated, use EXT_SUFFIX
.cpython-37m-x86_64-linux-gnu.so
~ $ python3 -c "import sysconfig; print(sysconfig.get_config_var('EXT_SUFFIX'))"
.cpython-37m-x86_64-linux-gnu.so

I suppose that's also the thing to use to build for Windows or other operating systems.