Commit 46b15df0 authored by payno's avatar payno

Merge branch 'rm_numpy_dep_setup' into 'master'

[setup] remove numpy dependancy and clean up the setup.py file

See merge request !5
parents 4220c94c a51ae793
......@@ -42,10 +42,8 @@ try:
logger.info("Use setuptools")
except ImportError:
try:
from numpy.distutils.core import Command
except ImportError:
from distutils.core import Command
from distutils.core import Command
cmdclass = {'build_sphinx': BuildDoc}
......@@ -121,98 +119,26 @@ else:
PACKAGES = find_packages()
def configuration(parent_package='', top_path=None):
"""Recursive construction of package info to be used in setup().
See http://docs.scipy.org/doc/numpy/reference/distutils.html#numpy.distutils.misc_util.Configuration
"""
try:
from numpy.distutils.misc_util import Configuration
except ImportError:
raise ImportError(
"To install this package, you must install numpy first\n"
"(See https://pypi.python.org/pypi/numpy)")
config = Configuration(None, parent_package, top_path)
config.set_options(
ignore_setup_xxx_py=True,
assume_default_configuration=True,
delegate_options_to_subpackages=True,
quiet=True)
config.add_subpackage(PROJECT)
return config
def get_project_configuration(dry_run):
"""Returns project arguments for setup"""
install_requires = ["python-dateutil"]
setup_requires = ["setuptools", "numpy"]
package_data = {
}
entry_points = {
}
cmdclass = dict(
build_doc=BuildDocCommand)
config = configuration()
setup_kwargs = config.todict()
setup_kwargs.update(name=PROJECT,
version=VERSION,
url="https://gitlab.esrf.fr/denolf/oarpy",
author="Wout De Nolf",
author_email="wout.de_nolf@esrf.fr",
classifiers=classifiers,
description="Python binding for OAR",
long_description=get_readme(),
packages=PACKAGES,
install_requires=install_requires,
setup_requires=setup_requires,
cmdclass=cmdclass,
package_data=package_data,
zip_safe=False,
entry_points=entry_points,
)
return setup_kwargs
def setup_package():
"""Run setup(**kwargs)
Depending on the command, it either runs the complete setup which depends on numpy,
or a *dry run* setup with no dependency on numpy.
"""
from setuptools import setup
setup(name=PROJECT,
version=VERSION,
url="https://gitlab.esrf.fr/denolf/oarpy",
author="Wout De Nolf",
author_email="wout.de_nolf@esrf.fr",
classifiers=classifiers,
description="Python binding for OAR",
long_description=get_readme(),
packages=PACKAGES,
install_requires=["python-dateutil", ],
setup_requires=["setuptools",],
cmdclass=cmdclass,
zip_safe=False,
)
# Check if action requires build/install
dry_run = len(sys.argv) == 1 or (len(sys.argv) >= 2 and (
'--help' in sys.argv[1:] or
sys.argv[1] in ('--help-commands', 'egg_info', '--version',
'clean', '--name')))
if dry_run:
# DRY_RUN implies actions which do not require dependancies, like NumPy
try:
from setuptools import setup
logger.info("Use setuptools.setup")
except ImportError:
from distutils.core import setup
logger.info("Use distutils.core.setup")
else:
try:
from setuptools import setup
except ImportError:
from numpy.distutils.core import setup
logger.info("Use numpydistutils.setup")
setup_kwargs = get_project_configuration(dry_run)
setup(**setup_kwargs)
DATA_FILES = [
# Data files that will be installed outside site-packages folder
]
if __name__ == "__main__":
setup_package()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment