Skip to content

Commit

Permalink
BLD More debug information when numpy cannot be imported
Browse files Browse the repository at this point in the history
  • Loading branch information
luispedro committed Jan 8, 2024
1 parent 69a4f26 commit ff58c8e
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2020, Luis Pedro Coelho <luis@luispedro.org>
# Copyright (C) 2009-2024, Luis Pedro Coelho <luis@luispedro.org>
# vim: set ts=4 sts=4 sw=4 expandtab smartindent:
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
Expand Down Expand Up @@ -33,7 +33,12 @@
import os
try:
import numpy
except ImportError:
except ImportError as e:
print('''
Could not import numpy ({}).
It is possible that building will fail.
'''.format(e))
class FakeNumpy(object):
def get_include(self):
return []
Expand All @@ -45,10 +50,7 @@ def get_include(self):
exec(compile(open('mahotas/mahotas_version.py').read(),
'mahotas/mahotas_version.py', 'exec'))

try:
long_description = open('README.md', encoding='utf-8').read()
except:
long_description = open('README.md').read()
long_description = open('README.md', encoding='utf-8').read()

undef_macros = []
define_macros = []
Expand Down Expand Up @@ -78,7 +80,9 @@ def get_include(self):
'mahotas.features._zernike': ['mahotas/features/_zernike.cpp'],
}

ext_modules = [setuptools.Extension(key, sources=sources, undef_macros=undef_macros, define_macros=define_macros, include_dirs=[numpy.get_include()]) for key,sources in extensions.items()]
ext_modules = [
setuptools.Extension(key, sources=sources, undef_macros=undef_macros, define_macros=define_macros, include_dirs=[numpy.get_include()])
for key,sources in extensions.items()]

packages = setuptools.find_packages()

Expand Down Expand Up @@ -123,6 +127,10 @@ def build_extensions(self):
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: C++',
'Operating System :: OS Independent',
'License :: OSI Approved :: MIT License',
Expand Down

0 comments on commit ff58c8e

Please sign in to comment.