Skip to content

Commit

Permalink
fix setup.py on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
arvidn committed Dec 20, 2020
1 parent e185832 commit 4e601e8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ build_script:
b2.exe --hash openssl-lib=%ssl_lib% openssl-include=%ssl_include% warnings=all -j %NUMBER_OF_PROCESSORS% %compiler% address-model=%model% picker-debugging=on invariant-checks=full variant=%variant% link=shared crypto=%crypto% asserts=on export-extra=on windows-api=%api% windows-version=win10 libtorrent-link=shared stage_module stage_dependencies
)
- if defined python_dist (
c:\Python35-x64\python.exe setup.py bdist --format=msi
c:\Python36-x64\python.exe setup.py bdist --format=msi
)

# simulations
Expand Down
8 changes: 6 additions & 2 deletions bindings/python/setup.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
import sys
import sysconfig
import tempfile
import multiprocessing

import setuptools
import setuptools.command.build_ext as _build_ext_lib


def get_msvc_toolset():
# Reference: https://wiki.python.org/moin/WindowsCompilers
major_minor = sys.version_info()[0:2]
major_minor = sys.version_info[0:2]
if major_minor in ((2, 6), (2, 7), (3, 0), (3, 1), (3, 2)):
return "msvc-9.0"
if major_minor in ((3, 3), (3, 4)):
Expand Down Expand Up @@ -96,7 +97,8 @@ def write_b2_python_config(config):
# python.jam appends SHLIB_SUFFIX on its own.
ext_suffix = sysconfig.get_config_var("EXT_SUFFIX")
shlib_suffix = sysconfig.get_config_var("SHLIB_SUFFIX")
ext_suffix = ext_suffix[: -len(shlib_suffix)]
if shlib_suffix != None and len(shlib_suffix) < len(ext_suffix):
ext_suffix = ext_suffix[: -len(shlib_suffix)]
write(f' : "{ext_suffix}"')
write(" ;\n")

Expand Down Expand Up @@ -193,7 +195,9 @@ def build_extension_with_b2(self):
self.announce("project-config.jam contents:")
self.announce(config.read())
config.close()
args.append(f"python={sysconfig.get_python_version()}")
args.append(f"--project-config={config.name}")
args.append(f"-j{multiprocessing.cpu_count()}")
self.spawn(["b2"] + args)
finally:
os.unlink(config.name)
Expand Down

0 comments on commit 4e601e8

Please sign in to comment.