Skip to content

Commit

Permalink
Build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioz committed Dec 10, 2022
1 parent cbd9f29 commit a2b0aea
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions plugins/org.python.pydev.core/pysrc/build_tools/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,25 @@ def build():

env = os.environ.copy()
if sys.version_info[:2] in ((3, 6), (3, 7), (3, 8), (3, 9), (3, 10), (3, 11)):
import setuptools # We have to import it first for the compiler to be found
from distutils import msvc9compiler

if sys.version_info[:2] in ((3, 5), (3, 6), (3, 7), (3, 8), (3, 9), (3, 10), (3, 11)):
vcvarsall = msvc9compiler.find_vcvarsall(14.0)
if vcvarsall is None or not os.path.exists(vcvarsall):
raise RuntimeError('Error finding vcvarsall.')

if is_python_64bit():
env.update(get_environment_from_batch_command(
[vcvarsall, 'amd64'],
initial=os.environ.copy()))
FORCE_PYDEVD_VC_VARS = os.environ.get('FORCE_PYDEVD_VC_VARS')
if FORCE_PYDEVD_VC_VARS:
env.update(get_environment_from_batch_command([FORCE_PYDEVD_VC_VARS], initial=os.environ.copy()))
else:
env.update(get_environment_from_batch_command(
[vcvarsall, 'x86'],
initial=os.environ.copy()))
import setuptools # We have to import it first for the compiler to be found
from distutils import msvc9compiler

vcvarsall = msvc9compiler.find_vcvarsall(14.0)
if vcvarsall is None or not os.path.exists(vcvarsall):
raise RuntimeError('Error finding vcvarsall.')

if is_python_64bit():
env.update(get_environment_from_batch_command(
[vcvarsall, 'amd64'],
initial=os.environ.copy()))
else:
env.update(get_environment_from_batch_command(
[vcvarsall, 'x86'],
initial=os.environ.copy()))

else:
raise AssertionError('Unable to setup environment for Python: %s' % (sys.version,))
Expand Down

0 comments on commit a2b0aea

Please sign in to comment.