Skip to content

Commit

Permalink
Drop distutils
Browse files Browse the repository at this point in the history
Allows to use Python 3.12
  • Loading branch information
jschueller committed May 17, 2024
1 parent 2dc38c5 commit c01d896
Showing 1 changed file with 1 addition and 24 deletions.
25 changes: 1 addition & 24 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,13 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import distutils
from setuptools import setup
import os
import shutil
import numpy as np
import ctypes.util
import sys

#If prefix is set, we want to allow installation in a directory that is not on PYTHONPATH
#and this is only possible with distutils, not setuptools
if str(sys.argv[1:]).find("--prefix") == -1:
from setuptools import setup
else:
from distutils.core import setup

try:
from Cython.Distutils import build_ext
from Cython.Build import cythonize
Expand Down Expand Up @@ -104,7 +97,6 @@
copy_gcc_lib = False
gcc_lib = None
force_32bit = False
no_msvcr = False
with_openmp = False

static_link_gcc = "-static-libgcc"
Expand All @@ -113,8 +105,6 @@

# Fix path sep
for x in sys.argv[1:]:
if not x.find('--prefix'):
copy_args[copy_args.index(x)] = x.replace('/',os.sep)
if not x.find('--fmil-home'):
incdirs = os.path.join(x[12:],'include')
libdirs = os.path.join(x[12:],'lib')
Expand All @@ -134,10 +124,6 @@
if x[14:].upper() == "TRUE":
force_32bit = True
copy_args.remove(x)
if not x.find('--no-msvcr'):
if x[11:].upper() == "TRUE":
no_msvcr = True
copy_args.remove(x)
if not x.find('--extra-c-flags'):
extra_c_flags = x[16:]
copy_args.remove(x)
Expand Down Expand Up @@ -178,14 +164,6 @@
shutil.copy2(path_gcc_lib,os.path.join(".","src","pyfmi"))
gcc_lib = os.path.join(".","src","pyfmi","libgcc_s_dw2-1.dll")

if no_msvcr:
# prevent the MSVCR* being added to the DLLs passed to the linker
def msvc_runtime_library_mod():
return None

import numpy.distutils
numpy.distutils.misc_util.msvc_runtime_library = msvc_runtime_library_mod

def check_extensions():
ext_list = []
extra_link_flags = []
Expand Down Expand Up @@ -308,7 +286,6 @@ def check_extensions():
extra_package_data = ['*fmilib_shared*'] if sys.platform.startswith("win") else []
extra_package_data += ['libgcc_s_dw2-1.dll'] if copy_gcc_lib else []

from numpy.distutils.core import setup
setup(name=NAME,
version=VERSION,
license=LICENSE,
Expand Down

0 comments on commit c01d896

Please sign in to comment.