Skip to content

Commit d973817

Browse files
Merge pull request #640 from genn-team/better_setuptools_fix
Better setuptools fix
2 parents 134575e + 7813e7f commit d973817

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

pygenn/genn_model.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
from os import path, environ
3232
from platform import system
3333
from psutil import cpu_count
34-
from setuptools import msvc
3534
from shutil import which
3635
from subprocess import check_call # to call make
3736
from textwrap import dedent
@@ -70,9 +69,17 @@
7069

7170
# If we're on windows
7271
if system() == "Windows":
72+
# Try import the helper to get Visual C++ environment from setuptools
73+
# **NOTE** this was removed in version 74.0
74+
try:
75+
from setuptools.msvc import msvc14_get_vc_env as _get_vc_env
76+
# If this fails, import from distutils
77+
except ImportError:
78+
from distutils._msvccompiler import _get_vc_env
79+
7380
# Get environment and cache in class, convertings
7481
# all keys to upper-case for consistency
75-
_msvc_env = msvc.msvc14_get_vc_env("x86_amd64")
82+
_msvc_env = _get_vc_env("x86_amd64")
7683
_msvc_env = {k.upper(): v for k, v in _msvc_env.items()}
7784

7885
# Update process's environment with this

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@
290290
python_requires=">=3.6",
291291
install_requires=["numpy>=1.17", "psutil",
292292
"importlib-metadata>=1.0;python_version<'3.8'",
293-
"setuptools<74.0"],
293+
"setuptools"],
294294
extras_require={
295295
"doc": ["sphinx", "sphinx-gallery", "sphinx-argparse"],
296296
"userproject": ["mnist", "tqdm", "scipy", "matplotlib"],

0 commit comments

Comments
 (0)