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):
"""Returns the location in the temp directory of the output file."""
platform = distutils.util.get_platform()
if platform.startswith('macosx'):
libsuffix = '.dylib'
if platform.startswith('win-'):
name = ext.name + '.dll'
elif platform.startswith('macosx'):
name = 'lib' + ext.name + '.dylib'
else:
libsuffix = '.so'
return os.path.join('debug' if self.debug else 'release',
'lib' + ext.name + libsuffix)
name = 'lib' + ext.name + '.so'
return os.path.join('debug' if self.debug else 'release', name)
def get_output_filename(self, ext):
"""Returns the filename of the build output."""