distutils_rust: teach distutils to look for windows libs

Summary: Make sure that we can build Rust extensions on Windows.

Test Plan:
- `set USERUST=1`
- run FB build script, which invokes `fb-hgext`'s `setup.py`
- see it not failing

Reviewers: mbthomas, #fbhgext

Differential Revision: https://phab.mercurial-scm.org/D1590
This commit is contained in:
Kostia Balytskyi 2017-12-05 13:10:33 -08:00
parent df45dfb7fc
commit e00b7af3c3

View File

@ -75,12 +75,13 @@ class BuildRustExt(Command):
def get_temp_output(self, ext): def get_temp_output(self, ext):
"""Returns the location in the temp directory of the output file.""" """Returns the location in the temp directory of the output file."""
platform = distutils.util.get_platform() platform = distutils.util.get_platform()
if platform.startswith('macosx'): if platform.startswith('win-'):
libsuffix = '.dylib' name = ext.name + '.dll'
elif platform.startswith('macosx'):
name = 'lib' + ext.name + '.dylib'
else: else:
libsuffix = '.so' name = 'lib' + ext.name + '.so'
return os.path.join('debug' if self.debug else 'release', return os.path.join('debug' if self.debug else 'release', name)
'lib' + ext.name + libsuffix)
def get_output_filename(self, ext): def get_output_filename(self, ext):
"""Returns the filename of the build output.""" """Returns the filename of the build output."""